Package org.broadinstitute.gatk.utils.exceptions

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


                for ( final Sample pSample : samplesFromPedigrees )
                    sampleNamesFromPedigrees.add(pSample.getID());

                for ( final Sample dsSample : samplesFromDataSources )
                    if ( ! sampleNamesFromPedigrees.contains(dsSample.getID()) )
                        throw new UserException("Sample " + dsSample.getID() + " found in data sources but not in pedigree files with STRICT pedigree validation");
            }
        }
    }
View Full Code Here


        if (samFilesArePresent && !WalkerManager.isAllowed(walker, DataSource.READS))
            throw new ArgumentException("Walker does not allow reads but reads were provided.");

        //Make sure SAM list specified by the user (if necessary) is not empty
        if(WalkerManager.isRequired(walker, DataSource.READS) && samFilesArePresent && samReaderIDs.isEmpty() ) {
            throw new UserException("The list of input files does not contain any BAM files.");
        }

        // Make sure no SAM files were specified multiple times by the user.
        checkForDuplicateSamFiles();
    }
View Full Code Here

                encounteredSamFiles.add(samFile);
            }
        }

        if ( duplicateSamFiles.size() > 0 ) {
            throw new UserException("The following BAM files appear multiple times in the list of input files: " +
                                    duplicateSamFiles + " BAM files may be specified at most once.");
        }

    }
View Full Code Here

        // masked out of memory error
        if ( t instanceof OutOfMemoryError )
            exitSystemWithUserError(new UserException.NotEnoughMemory());
        // masked user error
        if ( t instanceof UserException || t instanceof TribbleException )
            exitSystemWithUserError(new UserException(t.getMessage()));

        // no message means no masked error
        final String message = t.getMessage();
        if ( message == null )
            return;

        // too many open files error
        if ( message.contains("Too many open files") )
            exitSystemWithUserError(new UserException.TooManyOpenFiles());

        // malformed BAM looks like a SAM file
        if ( message.contains(PICARD_TEXT_SAM_FILE_ERROR_1) || message.contains(PICARD_TEXT_SAM_FILE_ERROR_2) )
            exitSystemWithSamError(t);

        // can't close tribble index when writing
        if ( message.contains("Unable to close index for") )
            exitSystemWithUserError(new UserException(t.getCause() == null ? message : t.getCause().getMessage()));

        // disk is full
        if ( message.contains(NO_SPACE_LEFT_ON_DEVICE_ERROR) || message.contains(DISK_QUOTA_EXCEEDED_ERROR) )
            exitSystemWithUserError(new UserException.NoSpaceOnDevice());
View Full Code Here

        final ReferenceSequenceFile ref;
        try {
            ref = ReferenceSequenceFileFactory.getReferenceSequenceFile(refFile);
        } catch ( Exception e ) {
            throw new UserException("Couldn't load provided reference sequence file " + refFile, e);
        }

        variant = parseVariantList(variant);

        Comparator<Pair<Integer,File>> positionComparator = new PositionComparator();

        Queue<Pair<Integer,File>> priorityQueue;
        if (assumeSorted)
            priorityQueue = new LinkedList<>();
        else
            priorityQueue = new PriorityQueue<>(10000, positionComparator);

        FileType fileType = FileType.INVALID;
        for (File file : variant) {
            // if it returns a valid type, it will be the same for all files
            fileType = fileExtensionCheck(file, outputFile);
            if (fileType == FileType.INVALID)
                return 1;

            if (assumeSorted){
                priorityQueue.add(new Pair<>(0,file));
            }
            else{
                if (!file.exists()) {
                    throw new UserException(String.format("File %s doesn't exist",file.getAbsolutePath()));
                }
                FeatureReader<VariantContext> reader = getFeatureReader(fileType, file);
                Iterator<VariantContext> it = reader.iterator();
                if(!it.hasNext()){
                    System.err.println(String.format("File %s is empty. This file will be ignored",file.getAbsolutePath()));
                    continue;
                }
                VariantContext vc = it.next();
                int firstPosition = vc.getStart();
                reader.close();
                priorityQueue.add(new Pair<>(firstPosition,file));
            }

        }

        FileOutputStream outputStream = new FileOutputStream(outputFile);
        EnumSet<Options> options = EnumSet.of(Options.INDEX_ON_THE_FLY);
        final IndexCreator idxCreator = GATKVCFUtils.getIndexCreator(variant_index_type, variant_index_parameter, outputFile, ref.getSequenceDictionary());
        final VariantContextWriter outputWriter = VariantContextWriterFactory.create(outputFile, outputStream, ref.getSequenceDictionary(), idxCreator, options);

        boolean firstFile = true;
        int count = 0;
        while(!priorityQueue.isEmpty() ){
            count++;
            File file = priorityQueue.remove().getSecond();
            if (!file.exists()) {
                throw new UserException(String.format("File %s doesn't exist",file.getAbsolutePath()));
            }
            FeatureReader<VariantContext> reader = getFeatureReader(fileType, file);

            if(count%10 ==0)
                System.out.print(count);
View Full Code Here

     */
    private void authorizeGATKRun() {
        if ( getArgumentCollection().phoneHomeType == GATKRunReport.PhoneHomeOption.NO_ET ||
             getArgumentCollection().phoneHomeType == GATKRunReport.PhoneHomeOption.STDOUT ) {
            if ( getArgumentCollection().gatkKeyFile == null ) {
                throw new UserException("Running with the -et NO_ET or -et STDOUT option requires a GATK Key file. " +
                                        "Please see " + UserException.PHONE_HOME_DOCS_URL +
                                        " for more information and instructions on how to obtain a key.");
            }
            else {
                PublicKey gatkPublicKey = CryptUtils.loadGATKDistributedPublicKey();
View Full Code Here

    }

    private void validate() {
        // Can't leave toFraction and toCoverage null unless type is NONE
        if ( type != DownsampleType.NONE && toFraction == null && toCoverage == null )
            throw new UserException("Must specify either toFraction or toCoverage when downsampling.");

        // Fraction and coverage cannot both be specified.
        if ( toFraction != null && toCoverage != null )
            throw new UserException("Downsampling coverage and fraction are both specified. Please choose only one.");

        // toCoverage must be > 0 when specified
        if ( toCoverage != null && toCoverage <= 0 ) {
            throw new UserException("toCoverage must be > 0 when downsampling to coverage");
        }

        // toFraction must be >= 0.0 and <= 1.0 when specified
        if ( toFraction != null && (toFraction < 0.0 || toFraction > 1.0) ) {
            throw new UserException("toFraction must be >= 0.0 and <= 1.0 when downsampling to a fraction of reads");
        }
    }
View Full Code Here

    public void checkCompatibilityWithWalker( Walker walker ) {
        boolean isLocusTraversal = walker instanceof LocusWalker || walker instanceof ActiveRegionWalker;

        if ( isLocusTraversal && type == DownsampleType.ALL_READS && toCoverage != null ) {
            throw new UserException("Downsampling to coverage with the ALL_READS method for locus-based traversals (eg., LocusWalkers) is not currently supported (though it is supported for ReadWalkers).");
        }

        // For locus traversals, ensure that the dcov value (if present) is not problematically low
        if ( isLocusTraversal && type != DownsampleType.NONE && toCoverage != null &&
             toCoverage < MINIMUM_SAFE_COVERAGE_TARGET_FOR_LOCUS_BASED_TRAVERSALS ) {
            throw new UserException(String.format("Locus-based traversals (ie., Locus and ActiveRegion walkers) require " +
                                                  "a minimum -dcov value of %d when downsampling to coverage. Values less " +
                                                  "than this can produce problematic downsampling artifacts while providing " +
                                                  "only insignificant improvements in memory usage in most cases.",
                                                  MINIMUM_SAFE_COVERAGE_TARGET_FOR_LOCUS_BASED_TRAVERSALS));
        }
View Full Code Here

                        countPileup.add(addElem);
                }
                break;

            default:
                throw new UserException("Must use valid CountPileupType");
        }

        for (PileupElement e : countPileup) {
            SAMReadGroupRecord readGroup = getReadGroup(e.getRead());
            if (!countsByRG.keySet().contains(readGroup))
View Full Code Here

        final boolean sampleNamesAreUnique = SampleUtils.verifyUniqueSamplesNames(vcfRods);

        if (genotypeMergeOption == null) {
            if (!sampleNamesAreUnique)
                throw new UserException("Duplicate sample names were discovered but no genotypemergeoption was supplied. " +
                    "To combine samples without merging specify --genotypemergeoption UNIQUIFY. Merging duplicate samples " +
                    "without specified priority is unsupported, but can be achieved by specifying --genotypemergeoption UNSORTED.");
            else
                genotypeMergeOption = GATKVariantContextUtils.GenotypeMergeType.UNSORTED;
        }
View Full Code Here

TOP

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

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.