Package org.broadinstitute.gatk.engine

Examples of org.broadinstitute.gatk.engine.GenomeAnalysisEngine


        else
            uac.MAX_DELETION_FRACTION = 1.0;
        if (emitConf >= 0) uac.genotypeArgs.STANDARD_CONFIDENCE_FOR_EMITTING = emitConf;
        if (callConf >= 0) uac.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING = callConf;

        final GenomeAnalysisEngine toolkit = getToolkit();
        uac.GLmodel = GenotypeLikelihoodsCalculationModel.Model.SNP;
        snpEngine = new UnifiedGenotypingEngine(uac,
                FixedAFCalculatorProvider.createThreadSafeProvider(toolkit, uac, logger),toolkit);

View Full Code Here


        } else if ( ! doNotRunPhysicalPhasing ) {
            doNotRunPhysicalPhasing = true;
            logger.info("Disabling physical phasing, which is supported only for reference-model confidence output");
        }

        final GenomeAnalysisEngine toolkit = getToolkit();
        samplesList = toolkit.getReadSampleList();
        Set<String> sampleSet = SampleListUtils.asSet(samplesList);

        if (sampleNameToUse != null) {
            if (!sampleSet.contains(sampleNameToUse))
                throw new UserException.BadArgumentValue("sample_name", "Specified name does not exist in input bam files");
            if (sampleSet.size() == 1) {
                //No reason to incur performance penalty associated with filtering if they specified the name of the only sample
                sampleNameToUse = null;
            } else {
                samplesList = new IndexedSampleList(sampleNameToUse);
                sampleSet = SampleListUtils.asSet(samplesList);
            }
        }


        // create a UAC but with the exactCallsLog = null, so we only output the log for the HC caller itself, if requested
        final UnifiedArgumentCollection simpleUAC = SCAC.cloneTo(UnifiedArgumentCollection.class);
        simpleUAC.outputMode = OutputMode.EMIT_VARIANTS_ONLY;
        simpleUAC.genotypingOutputMode = GenotypingOutputMode.DISCOVERY;
        simpleUAC.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING = Math.min( 4.0, SCAC.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING ); // low values used for isActive determination only, default/user-specified values used for actual calling
        simpleUAC.genotypeArgs.STANDARD_CONFIDENCE_FOR_EMITTING = Math.min( 4.0, SCAC.genotypeArgs.STANDARD_CONFIDENCE_FOR_EMITTING ); // low values used for isActive determination only, default/user-specified values used for actual calling
        simpleUAC.CONTAMINATION_FRACTION = 0.0;
        simpleUAC.CONTAMINATION_FRACTION_FILE = null;
        simpleUAC.exactCallsLog = null;
        // Seems that at least with some test data we can lose genuine haploid variation if we use
        // UGs engine with ploidy == 1
        simpleUAC.genotypeArgs.samplePloidy = Math.max(2,SCAC.genotypeArgs.samplePloidy);

        activeRegionEvaluationGenotyperEngine = new UnifiedGenotypingEngine(simpleUAC,
                FixedAFCalculatorProvider.createThreadSafeProvider(getToolkit(),simpleUAC,logger), toolkit);
        activeRegionEvaluationGenotyperEngine.setLogger(logger);

        if( SCAC.CONTAMINATION_FRACTION_FILE != null )
            SCAC.setSampleContamination(AlleleBiasedDownsamplingUtils.loadContaminationFile(SCAC.CONTAMINATION_FRACTION_FILE, SCAC.CONTAMINATION_FRACTION, sampleSet, logger));

        if( SCAC.genotypingOutputMode == GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES && consensusMode )
            throw new UserException("HaplotypeCaller cannot be run in both GENOTYPE_GIVEN_ALLELES mode and in consensus mode at the same time. Please choose one or the other.");

        final GenomeLocParser genomeLocParser = toolkit.getGenomeLocParser();

        genotypingEngine = new HaplotypeCallerGenotypingEngine( SCAC, samplesList, genomeLocParser, FixedAFCalculatorProvider.createThreadSafeProvider(getToolkit(),SCAC,logger), !doNotRunPhysicalPhasing);
        // initialize the output VCF header
        final VariantAnnotatorEngine annotationEngine = new VariantAnnotatorEngine(Arrays.asList(annotationClassesToUse), annotationsToUse, annotationsToExclude, this, getToolkit());
View Full Code Here

        }
    }

    @Test(dataProvider="threadSafeFactoryData")
    public void testThreadSafeConstructors(final int ploidy, final int maxAltAlleles, final int cpuThreadCount, final int dataThreadCount) {
        final GenomeAnalysisEngine toolkit = new GenomeAnalysisEngine();
        final GATKArgumentCollection gatkArguments = new GATKArgumentCollection();
        gatkArguments.numberOfCPUThreadsPerDataThread =cpuThreadCount;
        gatkArguments.numberOfDataThreads = dataThreadCount;
        toolkit.setArguments(gatkArguments);
        final GenotypeCalculationArgumentCollection genotypeArgs = new GenotypeCalculationArgumentCollection();
        genotypeArgs.samplePloidy = ploidy;
        genotypeArgs.MAX_ALTERNATE_ALLELES = maxAltAlleles;
        final AFCalculatorProvider provider = GeneralPloidyFailOverAFCalculatorProvider.createThreadSafeProvider(toolkit,genotypeArgs,null);
        final Hashtable<Thread,AFCalculator> perThreadProvider = new Hashtable(cpuThreadCount * dataThreadCount);
 
View Full Code Here

        }
    }

    @Test(dataProvider="threadSafeFactoryData")
    public void testThreadSafeConstructors(final int ploidy, final int maxAltAlleles, final AFCalculatorImplementation impl, final int cpuThreadCount, final int dataThreadCount) {
        final GenomeAnalysisEngine toolkit = new GenomeAnalysisEngine();
        final GATKArgumentCollection gatkArguments = new GATKArgumentCollection();
        gatkArguments.numberOfCPUThreadsPerDataThread =cpuThreadCount;
        gatkArguments.numberOfDataThreads = dataThreadCount;
        toolkit.setArguments(gatkArguments);
        final StandardCallerArgumentCollection callerArgs = new StandardCallerArgumentCollection();
        if (impl != null) callerArgs.requestedAlleleFrequencyCalculationModel = impl;
        final GenotypeCalculationArgumentCollection genotypeArgs = new GenotypeCalculationArgumentCollection();
        callerArgs.genotypeArgs = genotypeArgs;
        genotypeArgs.samplePloidy = ploidy;
View Full Code Here

        UAC.outputMode = OutputMode.EMIT_ALL_SITES;
        UAC.genotypingOutputMode = GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES;

        String trackName = variantCollection.variants.getName();

        final GenomeAnalysisEngine toolkit = getToolkit();
        final SampleList samples =
                new IndexedSampleList(SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(trackName)));
        final Set<String> sampleNameSet = SampleListUtils.asSet(samples);
        UG_engine = new UnifiedGenotypingEngine(UAC, samples,toolkit.getGenomeLocParser(),
                FixedAFCalculatorProvider.createThreadSafeProvider(toolkit,UAC,logger),
                toolkit.getArguments().BAQMode);

        final Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
        hInfo.addAll(GATKVCFUtils.getHeaderFields(getToolkit(), Arrays.asList(trackName)));
        hInfo.addAll(UnifiedGenotyper.getHeaderInfo(UAC, null, null));
View Full Code Here

    public void initialize() {
        // collect the actual rod bindings into a list for use later
        for ( final RodBindingCollection<VariantContext> variantCollection : variantCollections )
            variants.addAll(variantCollection.getRodBindings());

        final GenomeAnalysisEngine toolkit = getToolkit();
        final Map<String, VCFHeader> vcfRods = GATKVCFUtils.getVCFHeadersFromRods(toolkit, variants);
        final SampleList samples = new IndexedSampleList(SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE));
        // create the genotyping engine
        genotypingEngine = new UnifiedGenotypingEngine(createUAC(), samples, toolkit.getGenomeLocParser(), GeneralPloidyFailOverAFCalculatorProvider.createThreadSafeProvider(toolkit, genotypeArgs, logger),
                toolkit.getArguments().BAQMode);
        // create the annotation engine
        annotationEngine = new VariantAnnotatorEngine(Arrays.asList("none"), annotationsToUse, Collections.<String>emptyList(), this, toolkit);

        // take care of the VCF headers
        final Set<VCFHeaderLine> headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true);
View Full Code Here

    private final static double TOLERANCE = 1e-5;
    private UnifiedGenotypingEngine ugEngine;

    @BeforeClass
    public void setUp() throws Exception {
        final GenomeAnalysisEngine engine = new GenomeAnalysisEngine();
        engine.setArguments(new GATKArgumentCollection());

        final UnifiedArgumentCollection args = new UnifiedArgumentCollection();
        final SampleList fakeSamples = SampleListUtils.singletonList("fake");

        ugEngine = new UnifiedGenotypingEngine(args,fakeSamples,engine.getGenomeLocParser(),
                new FixedAFCalculatorProvider(args,null,true),engine.getArguments().BAQMode);
    }
View Full Code Here

     *
     **/
    public void initialize() {
        super.initialize();

        final GenomeAnalysisEngine toolkit = getToolkit();
        final Set<String> sampleNameSet;
        if ( UAC.TREAT_ALL_READS_AS_SINGLE_POOL ) {
            sampleNameSet = Collections.singleton(GenotypeLikelihoodsCalculationModel.DUMMY_SAMPLE_NAME);
        } else {
            // get all of the unique sample names
            sampleNameSet = SampleUtils.getSAMFileSamples(toolkit.getSAMFileHeader());
            if ( UAC.referenceSampleName != null )
                sampleNameSet.remove(UAC.referenceSampleName);
        }
        final SampleList samples = new IndexedSampleList(sampleNameSet);

        if ( UAC.CONTAMINATION_FRACTION_FILE != null )
            UAC.setSampleContamination(AlleleBiasedDownsamplingUtils.loadContaminationFile(UAC.CONTAMINATION_FRACTION_FILE, UAC.CONTAMINATION_FRACTION, sampleNameSet, logger));

        // check for a bad max alleles value
        if ( UAC.genotypeArgs.MAX_ALTERNATE_ALLELES > GenotypeLikelihoods.MAX_ALT_ALLELES_THAT_CAN_BE_GENOTYPED)
            throw new UserException.BadArgumentValue("max_alternate_alleles", "the maximum possible value is " + GenotypeLikelihoods.MAX_ALT_ALLELES_THAT_CAN_BE_GENOTYPED);

        // warn the user for misusing EMIT_ALL_SITES
        if ( UAC.outputMode == OutputMode.EMIT_ALL_SITES &&
                UAC.genotypingOutputMode == GenotypingOutputMode.DISCOVERY &&
                UAC.GLmodel != GenotypeLikelihoodsCalculationModel.Model.SNP )
            logger.warn("WARNING: note that the EMIT_ALL_SITES option is intended only for point mutations (SNPs) in DISCOVERY mode or generally when running in GENOTYPE_GIVEN_ALLELES mode; it will by no means produce a comprehensive set of indels in DISCOVERY mode");
       
         // initialize the verbose writer
        if ( verboseWriter != null )
            verboseWriter.println("AFINFO\tLOC\tREF\tALT\tMAF\tF\tAFprior\tMLE\tMAP");

        final VariantAnnotatorEngine annotationEngine = new VariantAnnotatorEngine(Arrays.asList(annotationClassesToUse), annotationsToUse, annotationsToExclude, this, getToolkit());

        final AFCalculatorProvider afCalcAFCalculatorProvider = FixedAFCalculatorProvider.createThreadSafeProvider(getToolkit(),UAC,logger);
        genotypingEngine = new UnifiedGenotypingEngine(UAC, samples, toolkit.getGenomeLocParser(), afCalcAFCalculatorProvider, toolkit.getArguments().BAQMode);
        genotypingEngine.setVerboseWriter(verboseWriter);
        genotypingEngine.setAnnotationEngine(annotationEngine);

        // initialize the header
        Set<VCFHeaderLine> headerInfo = getHeaderInfo(UAC, annotationEngine, dbsnp);
View Full Code Here



    @Override
    public void initialize() {
        final GenomeAnalysisEngine toolkit = getToolkit();

        if ( getToolkit() != null ) {
            for (final ReadTransformer transformer: getToolkit().getReadTransformers())
                if(transformer instanceof RNAReadTransformer)                     // TODO: when a read transformer can be called directly from the command line we won't need that mechanism any more
                    rnaReadTransformers.add((RNAReadTransformer)transformer);
        }
        if ( !NO_PG_TAG ) {
            // we don't want to assume that reads will be written in order by the manager because in deep, deep pileups it won't work
            Utils.setupWriter(writer, toolkit, toolkit.getSAMFileHeader(), false, this, PROGRAM_RECORD_NAME);
        }

        try {
            final CachingIndexedFastaSequenceFile referenceReader = new CachingIndexedFastaSequenceFile(toolkit.getArguments().referenceFile);
            overhangManager = new OverhangFixingManager(writer, toolkit.getGenomeLocParser(), referenceReader, MAX_RECORDS_IN_MEMORY, MAX_MISMATCHES_IN_OVERHANG, MAX_BASES_TO_CLIP, doNotFixOverhangs);
        }
        catch (FileNotFoundException ex) {
            throw new UserException.CouldNotReadInputFile(toolkit.getArguments().referenceFile, ex);
        }
    }
View Full Code Here

        super.setUp();
    }

    public void timeWalkerPerformance(final int reps) {
        for(int i = 0; i < reps; i++) {
            GenomeAnalysisEngine engine = new GenomeAnalysisEngine();

            // Establish the argument collection
            GATKArgumentCollection argCollection = new GATKArgumentCollection();
            argCollection.referenceFile = new File(referenceFile);
            argCollection.samFiles = Collections.singletonList(inputFile.getAbsolutePath());

            engine.setArguments(argCollection);
            // Bugs in the engine mean that this has to be set twice.
            engine.setSAMFileIDs(Collections.singletonList(new SAMReaderID(inputFile,new Tags())));
            engine.setFilters(Collections.<ReadFilter>singletonList(new UnmappedReadFilter()));
            engine.setReferenceMetaDataFiles(Collections.<RMDTriplet>emptyList());

            // Create the walker
            engine.setWalker(walkerType.create());

            engine.execute();
        }
    }
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.engine.GenomeAnalysisEngine

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.