Package org.broadinstitute.gatk.utils

Examples of org.broadinstitute.gatk.utils.SimpleTimer


        for ( final ExactCallLogger.ExactCall call : loggedCalls ) {
            final AFCalculatorTestBuilder testBuilder = new AFCalculatorTestBuilder(call.vc.getNSamples(), 1,
                    AFCalculatorImplementation.EXACT_INDEPENDENT,
                    AFCalculatorTestBuilder.PriorType.human);
            logger.info(call);
            final SimpleTimer timer = new SimpleTimer().start();
            final AFCalculationResult result = testBuilder.makeModel().getLog10PNonRef(call.vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles,testBuilder.makePriors());
            final long newNanoTime = timer.getElapsedTimeNano();
            if ( call.originalCall.anyPolymorphic(-1) || result.anyPolymorphic(-1) ) {
                logger.info("**** ONE IS POLY");
            }
            logger.info("\t\t getLog10PosteriorOfAFGT0: " + call.originalCall.getLog10PosteriorOfAFGT0() + " vs " + result.getLog10PosteriorOfAFGT0());
            final double speedup = call.runtime / (1.0 * newNanoTime);
 
View Full Code Here


                AFCalculatorImplementation.EXACT_INDEPENDENT,
                AFCalculatorTestBuilder.PriorType.human);

        final VariantContext vc = testBuilder.makeACTest(new int[]{ac}, 0, 100);

        final SimpleTimer timer = new SimpleTimer().start();
        final AFCalculationResult resultTracker = testBuilder.makeModel().getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, testBuilder.makePriors());
        final long runtime = timer.getElapsedTimeNano();
        logger.info("result " + resultTracker.getLog10PosteriorOfAFGT0());
        logger.info("runtime " + runtime);
    }
View Full Code Here

        public AnalyzeByACAndPL(final List<String> columns) {
            super("AnalyzeByACAndPL", Utils.append(columns, "non.type.pls", "ac", "n.alt.seg", "other.ac"));
        }

        public void run(final AFCalculatorTestBuilder testBuilder, final List<Object> coreValues) {
            final SimpleTimer timer = new SimpleTimer();

            for ( final int nonTypePL : Arrays.asList(100) ) {
                final AFCalculator calc = testBuilder.makeModel();
                final double[] priors = testBuilder.makePriors();

                for ( int[] ACs : makeACs(testBuilder.numAltAlleles, testBuilder.nSamples*2) ) {
                    final VariantContext vc = testBuilder.makeACTest(ACs, 0, nonTypePL);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
                    final long runtime = timer.getElapsedTimeNano();

                    int otherAC = 0;
                    int nAltSeg = 0;
                    for ( int i = 0; i < ACs.length; i++ ) {
                        nAltSeg += ACs[i] > 0 ? 1 : 0;
View Full Code Here

        public AnalyzeBySingletonPosition(final List<String> columns) {
            super("AnalyzeBySingletonPosition", Utils.append(columns, "non.type.pls", "position.of.singleton"));
        }

        public void run(final AFCalculatorTestBuilder testBuilder, final List<Object> coreValues) {
            final SimpleTimer timer = new SimpleTimer();

            for ( final int nonTypePL : Arrays.asList(100) ) {
                final AFCalculator calc = testBuilder.makeModel();
                final double[] priors = testBuilder.makePriors();

                final int[] ac = new int[testBuilder.numAltAlleles];
                ac[0] = 1;
                final VariantContext vc = testBuilder.makeACTest(ac, 0, nonTypePL);

                for ( final int position : MathUtils.log10LinearRange(0, vc.getNSamples(), 0.1) ) {
                    final VariantContextBuilder vcb = new VariantContextBuilder(vc);
                    final List<Genotype> genotypes = new ArrayList<Genotype>(vc.getGenotypes());
                    Collections.rotate(genotypes, position);
                    vcb.genotypes(genotypes);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vcb.make(), HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
                    final long runtime = timer.getElapsedTimeNano();

                    final List<Object> columns = new LinkedList<Object>(coreValues);
                    columns.addAll(Arrays.asList(runtime, resultTracker.getnEvaluations(), nonTypePL, position));
                    report.addRowList(columns);
                }
View Full Code Here

        public AnalyzeByNonInformative(final List<String> columns) {
            super("AnalyzeByNonInformative", Utils.append(columns, "non.type.pls", "n.non.informative"));
        }

        public void run(final AFCalculatorTestBuilder testBuilder, final List<Object> coreValues) {
            final SimpleTimer timer = new SimpleTimer();

            for ( final int nonTypePL : Arrays.asList(100) ) {
                final AFCalculator calc = testBuilder.makeModel();
                final double[] priors = testBuilder.makePriors();

                final int[] ac = new int[testBuilder.numAltAlleles];
                ac[0] = 1;

                for ( int nNonInformative = 0; nNonInformative < testBuilder.nSamples; nNonInformative++ ) {
                    final VariantContext vc = testBuilder.makeACTest(ac, nNonInformative, nonTypePL);

                    timer.start();
                    final AFCalculationResult resultTracker = calc.getLog10PNonRef(vc, HomoSapiensConstants.DEFAULT_PLOIDY, testBuilder.numAltAlleles, priors);
                    final long runtime = timer.getElapsedTimeNano();

                    final List<Object> columns = new LinkedList<Object>(coreValues);
                    columns.addAll(Arrays.asList(runtime, resultTracker.getnEvaluations(), nonTypePL, nNonInformative));
                    report.addRowList(columns);
                }
View Full Code Here

        WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
                "-T PrintReads -R " + hg18Reference
                        + " -I " + validationDataLocation + "NA12878.WEx.downsampled20x.bam -o /dev/null"
                        + " -maxRuntime " + cfg.maxRuntime + " -maxRuntimeUnits " + cfg.unit, 0,
                Collections.<String>emptyList());
        final SimpleTimer timer = new SimpleTimer().start();
        executeTest("Max runtime " + cfg, spec);
        final long actualRuntimeNano = timer.getElapsedTimeNano();

        Assert.assertTrue(actualRuntimeNano < cfg.expectedMaxRuntimeNano(),
                "Actual runtime " + TimeUnit.SECONDS.convert(actualRuntimeNano, TimeUnit.NANOSECONDS)
                        + " exceeded max. tolerated runtime " + TimeUnit.SECONDS.convert(cfg.expectedMaxRuntimeNano(), TimeUnit.NANOSECONDS)
                        + " given requested runtime " + cfg.maxRuntime + " " + cfg.unit);
View Full Code Here

         * @param removeProgramRecords indicate whether to clear program records from the readers
         */
        public SAMReaders(Collection<SAMReaderID> readerIDs, ValidationStringency validationStringency, boolean removeProgramRecords) {
            final int totalNumberOfFiles = readerIDs.size();
            int readerNumber = 1;
            final SimpleTimer timer = new SimpleTimer().start();

            if ( totalNumberOfFiles > 0 ) logger.info("Initializing SAMRecords in serial");
            final int tickSize = 50;
            int nExecutedTotal = 0;
            long lastTick = timer.currentTime();
            for(final SAMReaderID readerID: readerIDs) {
                final ReaderInitializer init = new ReaderInitializer(readerID).call();

                checkForUnsupportedBamFile(init.reader.getFileHeader());

                if (removeProgramRecords) {
                    init.reader.getFileHeader().setProgramRecords(new ArrayList<SAMProgramRecord>());
                }

                if (threadAllocation.getNumIOThreads() > 0) {
                    inputStreams.put(init.readerID, init.blockInputStream); // get from initializer
                }

                logger.debug(String.format("Processing file (%d of %d) %s...", readerNumber++, totalNumberOfFiles,  readerID.samFile));
                readers.put(init.readerID,init.reader);
                if ( ++nExecutedTotal % tickSize == 0) {
                    double tickInSec = (timer.currentTime() - lastTick) / 1000.0;
                    printReaderPerformance(nExecutedTotal, tickSize, totalNumberOfFiles, timer, tickInSec);
                    lastTick = timer.currentTime();
                }
            }

            if ( totalNumberOfFiles > 0 ) logger.info(String.format("Done initializing BAM readers: total time %.2f", timer.getElapsedTime()));

            Collection<SAMFileHeader> headers = new LinkedList<SAMFileHeader>();

            // Examine the bam headers, perform any requested sample renaming on them, and add
            // them to the list of headers to pass to the Picard SamFileHeaderMerger:
View Full Code Here

        if ( test.nThreads >= 1 )
            testNanoScheduler(test);
    }

    private void testNanoScheduler(final NanoSchedulerBasicTest test) throws InterruptedException {
        final SimpleTimer timer = new SimpleTimer().start();
        final NanoScheduler<Integer, Integer, Integer> nanoScheduler = test.makeScheduler();

        final ProgressCallback callback = new ProgressCallback();
        nanoScheduler.setProgressFunction(callback);
View Full Code Here

TOP

Related Classes of org.broadinstitute.gatk.utils.SimpleTimer

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.