Package org.broadinstitute.gatk.utils.exceptions

Examples of org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException


     */
    public static <T> T getObjectOfType(Collection<Object> objectsToFilter, Class<T> type) {
        // TODO: Make JVM utils.
        Collection<T> selectedObjects = getObjectsOfType(objectsToFilter,type);
        if(selectedObjects.size() > 1)
            throw new ReviewedGATKException("User asked for a single instance of the type, multiple were present");
        if(selectedObjects.size() == 0)
            throw new ReviewedGATKException("User asked for a single instance of the type, but none were present");
        return selectedObjects.iterator().next();
    }
View Full Code Here


    public static Class getParameterizedTypeClass(Type t) {
        if ( t instanceof ParameterizedType ) {
            ParameterizedType parameterizedType = (ParameterizedType)t;
            if ( parameterizedType.getActualTypeArguments().length != 1 )
                throw new ReviewedGATKException("BUG: more than 1 generic type found on class" + t);
            return (Class)parameterizedType.getActualTypeArguments()[0];
        } else
            throw new ReviewedGATKException("BUG: could not find generic type on class " + t);
    }
View Full Code Here

                }
                break;
            }

            default:
                throw new ReviewedGATKException("Unexpected SequenceDictionaryComparison type: " + type);
        }
    }
View Full Code Here

            running.add(this);
        } catch (IOException e) {
            String message = String.format("Unable to start command: %s\nReason: %s",
                    StringUtils.join(builder.command(), " "),
                    e.getMessage());
            throw new ReviewedGATKException(message);
        }

        int exitCode;

        try {
            // Notify the background threads to start capturing.
            synchronized (toCapture) {
                toCapture.put(ProcessStream.Stdout,
                        new CapturedStreamOutput(settings.getStdoutSettings(), process.getInputStream(), System.out));
                toCapture.put(ProcessStream.Stderr,
                        new CapturedStreamOutput(settings.getStderrSettings(), process.getErrorStream(), System.err));
                toCapture.notifyAll();
            }

            // Write stdin content
            InputStreamSettings stdinSettings = settings.getStdinSettings();
            Set<StreamLocation> streamLocations = stdinSettings.getStreamLocations();
            if (!streamLocations.isEmpty()) {
                try {
                    OutputStream stdinStream = process.getOutputStream();
                    for (StreamLocation location : streamLocations) {
                        InputStream inputStream;
                        switch (location) {
                            case Buffer:
                                inputStream = new ByteArrayInputStream(stdinSettings.getInputBuffer());
                                break;
                            case File:
                                try {
                                    inputStream = FileUtils.openInputStream(stdinSettings.getInputFile());
                                } catch (IOException e) {
                                    throw new UserException.BadInput(e.getMessage());
                                }
                                break;
                            case Standard:
                                inputStream = System.in;
                                break;
                            default:
                                throw new ReviewedGATKException("Unexpected stream location: " + location);
                        }
                        try {
                            IOUtils.copy(inputStream, stdinStream);
                        } finally {
                            if (location != StreamLocation.Standard)
                                IOUtils.closeQuietly(inputStream);
                        }
                    }
                    stdinStream.flush();
                } catch (IOException e) {
                    throw new ReviewedGATKException("Error writing to stdin on command: " + StringUtils.join(builder.command(), " "), e);
                }
            }

            // Wait for the process to complete.
            try {
                process.getOutputStream().close();
                process.waitFor();
            } catch (IOException e) {
                throw new ReviewedGATKException("Unable to close stdin on command: " + StringUtils.join(builder.command(), " "), e);
            } catch (InterruptedException e) {
                throw new ReviewedGATKException("Process interrupted", e);
            } finally {
                while (!destroyed && stdout == null || stderr == null) {
                    synchronized (fromCapture) {
                        if (fromCapture.containsKey(ProcessStream.Stdout))
                            stdout = fromCapture.remove(ProcessStream.Stdout);
View Full Code Here

        this.cmode = engine.getArguments().BAQMode;
        this.qmode = mode.QualityMode();
        baqHMM = new BAQ(engine.getArguments().BAQGOP);

        if ( qmode == BAQ.QualityMode.DONT_MODIFY )
            throw new ReviewedGATKException("BUG: shouldn't create BAQ transformer with quality mode DONT_MODIFY");

        if ( mode.ApplicationTime() == ReadTransformer.ApplicationTime.FORBIDDEN && enabled() )
            throw new UserException.BadArgumentValue("baq", "Walker cannot accept BAQ'd base qualities, and yet BAQ mode " + cmode + " was requested.");

        return mode.ApplicationTime();
View Full Code Here

     */
    public LoggingNestedIntegerArray( PrintStream log, String logEntryLabel, final int... dimensions ) {
        super(dimensions);

        if ( log == null ) {
            throw new ReviewedGATKException("Log output stream must not be null");
        }
        this.log = log;
        this.logEntryLabel = logEntryLabel != null ? logEntryLabel : "";

        // Write the header line recording the dimensions of this NestedIntegerArray:
View Full Code Here

        public GenomeLoc nextLoc = null;

        public Element(Iterator<RODRecordList> it) {
            if ( it instanceof LocationAwareSeekableRODIterator) {
                this.it = (LocationAwareSeekableRODIterator)it;
                if ( ! it.hasNext() ) throw new ReviewedGATKException("Iterator is empty");
                update();
            } else {
                throw new ReviewedGATKException("Iterator passed to RODMergingIterator is not LocationAwareSeekableRODIterator");
            }
        }
View Full Code Here

    public static String getIndelClassificationName(int k) {
        if (k >=0 && k < COLUMN_KEYS.length)
            return COLUMN_KEYS[k];
        else
            throw new ReviewedGATKException("Invalid index when trying to get indel classification name");
    }
View Full Code Here

            sleepCount++;
        }

        if (dir.listFiles() == null) {
            throw new ReviewedGATKException("The volume '" + dir.getAbsolutePath() + "' could not be accessed.");
        }
    }
View Full Code Here

     */
    private void notifyDeprecatedCommandLineArgument(ArgumentSource argumentSource) {
        // Grab the first argument definition and report that one as the failure.  Theoretically, we should notify of all failures.
        List<ArgumentDefinition> definitions = argumentSource.createArgumentDefinitions();
        if(definitions.size() < 1)
            throw new ReviewedGATKException("Internal error.  Argument source creates no definitions.");
        ArgumentDefinition definition = definitions.get(0);
        throw new UserException.DeprecatedArgument(definition.fullName,definition.doc);
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.