Package org.broadinstitute.gatk.utils.exceptions

Examples of org.broadinstitute.gatk.utils.exceptions.UserException$MissortedFile


        try {
            scheduleFile = File.createTempFile("bamschedule."+referenceSequence,null);
            scheduleFileChannel = new RandomAccessFile(scheduleFile,"rw").getChannel();
        }
        catch(IOException ex) {
            throw new UserException("Unable to create a temporary BAM schedule file.  Please make sure Java can write to the default temp directory or use -Djava.io.tmpdir= to instruct it to use a different temp directory instead.",ex);
        }
        scheduleFile.deleteOnExit();

    }
View Full Code Here


    }

    public DiffElement createDiffableFromFile(File file, int maxElementsToRead) {
        DiffableReader reader = findReaderForFile(file);
        if ( reader == null )
            throw new UserException("Unsupported file type: " + file);
        else
            return reader.readFromFile(file, maxElementsToRead);
    }
View Full Code Here

        }
        else if(stub.getOutputStream() != null){
            this.writer = factory.makeSAMWriter( stub.getFileHeader(), stub.isPresorted(), stub.getOutputStream());
        }
        else
            throw new UserException("Unable to write to SAM file; neither a target file nor a stream has been specified");

        // if we want to send the BAM file through the simplifying writer, wrap it here
        if ( stub.simplifyBAM() ) {
            this.writer = new SimplifyingSAMFileWriter(this.writer);
        }
View Full Code Here

        PrintStream o;
        try {
            o = new PrintStream(output);
        } catch (FileNotFoundException e) {
            throw new UserException(String.format("File %s to be output by GATKReportGatherer function was not found", output));
        }

        GATKReport current = new GATKReport();
        boolean isFirst = true;
        for (File input : inputs) {
View Full Code Here

            } catch (FileNotFoundException e) {
                String message = "Error loading black list: " + file.getAbsolutePath();
                if (parentFile != null) {
                    message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
                }
                throw new UserException(message);
            }
        } else {
            String[] filterEntry = filter.split(":", 2);

            String message = null;
            if (filterEntry.length != 2) {
                message = "Invalid read group filter: " + filter;
            } else if (filterEntry[0].length() != 2) {
                message = "Tag is not two characters: " + filter;
            }

            if (message != null) {
                if (parentFile != null) {
                    message += ", " + parentFile.getAbsolutePath() + ":" + parentLineNum;
                }
                message += ", format is <TAG>:<SUBSTRING>";
                throw new UserException(message);
            }

            if (!filters.containsKey(filterEntry[0]))
                filters.put(filterEntry[0], new TreeSet<String>());
            filters.get(filterEntry[0]).add(filterEntry[1]);
View Full Code Here

        // Read the first line for the version and number of tables.
        version = GATKReportVersion.fromHeader(reportHeader);
        if (version.equals(GATKReportVersion.V0_1) ||
                version.equals(GATKReportVersion.V0_2))
            throw new UserException("The GATK no longer supports reading legacy GATK Reports. Please use v1.0 or newer.");

        int nTables = Integer.parseInt(reportHeader.split(":")[2]);

        // Read each table according ot the number of tables
        for (int i = 0; i < nTables; i++) {
View Full Code Here

     * @param fastaFile Fasta file to be used as reference
     */
    public ReferenceDataSource(File fastaFile) {
        // does the fasta file exist? check that first...
        if (!fastaFile.exists())
            throw new UserException("The fasta file you specified (" + fastaFile.getAbsolutePath() + ") does not exist.");

        final boolean isGzipped = fastaFile.getAbsolutePath().endsWith(".gz");
        if ( isGzipped ) {
            throw new UserException.CannotHandleGzippedRef();
        }
View Full Code Here

     * @throws UserException if the header is from a reduced bam
     */
    private void checkForUnsupportedBamFile(final SAMFileHeader header) {
        for ( final SAMProgramRecord PGrecord : header.getProgramRecords() ) {
            if ( unsupportedPGs.containsKey(PGrecord.getId()) )
                throw new UserException("The GATK no longer supports running off of BAMs produced by " + unsupportedPGs.get(PGrecord.getId()));
        }
    }
View Full Code Here

            else {
                // both o1 and o2 have a value
                if ( o1 == o2 )
                    return o1;
                else
                    throw new UserException("Inconsistent values detected for " + name + " for field " + field + " value1 " + o1 + " value2 " + o2);
            }
        }
    }
View Full Code Here

            for ( final SAMReadGroupRecord readGroup : header.getReadGroups() ) {
                final String thisReadGroupSample = readGroup.getSample();

                if ( thisReadGroupSample == null ) {
                    throw new UserException(String.format("On-the fly sample renaming was requested for bam file %s, however this " +
                                                          "bam file contains a read group (id: %s) with a null sample attribute",
                                                          readerID.getSamFilePath(), readGroup.getId()));
                }
                else if ( firstEncounteredSample == null ) {
                    firstEncounteredSample = thisReadGroupSample;
                }
                else if ( ! firstEncounteredSample.equals(thisReadGroupSample) ) {
                    throw new UserException(String.format("On-the-fly sample renaming was requested for bam file %s, " +
                                                          "however this bam file contains reads from more than one sample " +
                                                          "(encountered samples %s and %s in the bam header). The GATK requires that " +
                                                          "all bams for which on-the-fly sample renaming is requested " +
                                                          "contain reads from only a single sample per bam.",
                                                          readerID.getSamFilePath(), firstEncounteredSample, thisReadGroupSample));
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.exceptions.UserException$MissortedFile

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.