@Override public void onTraversalDone(Pair<Long, Long> result) { out.println(String.format("\tReads ending in indels : %d\n\tReads ending in soft-clips: %d\n", result.getFirst(), result.getSecond())); } }
/** * Checks whether there is a non-empty left flanking non-variant trimmed out region. * @return {@code true} if there is a non-trivial left flank region, {@code false} otherwise. */ public boolean hasLeftFlankingRegion() { return ! nonVariantFlanks.getFirst().isUnmapped(); }
/** * General interval reduce routine called after all of the traversals are done * @param results interval reduce results */ public void onTraversalDone(List<Pair<GenomeLoc, ReduceType>> results) { for ( Pair<GenomeLoc, ReduceType> result : results ) { logger.info(String.format("[INTERVAL REDUCE RESULT] at %s ", result.getFirst())); this.onTraversalDone(result.getSecond()); } }
public void onTraversalDone(List<Pair<GenomeLoc, Long>> results) { for (Pair<GenomeLoc, Long> result : results ) { GenomeLoc loc = result.getFirst(); Long gcCount = result.getSecond(); double gcContent = (double) gcCount / loc.size(); out.println(loc + "\t" + gcContent); } } }
public ConcordanceMetrics reduce(List<Pair<VariantContext,VariantContext>> evalCompList, ConcordanceMetrics metrics) { for ( Pair<VariantContext,VariantContext> evalComp : evalCompList){ metrics.update(evalComp.getFirst(),evalComp.getSecond()); } return metrics; }
/** * Gets or constructs a event-block through the cache. * @param borders the source and sink vertex pair for the requested event block. * @return never {@code null} */ @Requires("borders != null && border.getFirst() != null && border.getSecond() != null") private EventBlock resolveEventBlock(final Pair<MultiDeBruijnVertex,MultiDeBruijnVertex> borders) { EventBlock result = eventBlockCache.get(borders); if (result == null) eventBlockCache.put(borders,result = new EventBlock(graph, borders.getFirst(),borders.getSecond())); return result; }
public static String getBasesFromRUandNR(final String covariateValue) { Pair<String,Integer> pair = getRUandNRfromCovariate(covariateValue); return getBasesFromRUandNR(pair.getFirst(), pair.getSecond()); }
private void HCTest(String bam, String args, String md5) throws IOException { final String base = String.format("-T HaplotypeCaller --contamination_fraction_to_filter 0.05 --disableDithering --pcr_indel_model NONE --maxReadsInRegionPerSample 1000 --minReadsPerAlignmentStart 5 --maxProbPropagationDistance 50 --activeProbabilityThreshold 0.002 -R %s -I %s -L %s", REF, bam, INTERVALS_FILE) + " --no_cmdline_in_header -o %s -minPruning 3"; final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5)); final File outputVCF = executeTest("testHaplotypeCaller: args=" + args, spec).getFirst().get(0); Assert.assertFalse(FileUtils.readFileToString(outputVCF).contains(VCFConstants.MAPPING_QUALITY_ZERO_KEY)); }
@Test(enabled = true, dataProvider = "SubshardProvider", timeOut = 120 * 1000) public void testSubshardTimeout(final int sleepTime) throws Exception { final int maxRuntime = 5000; WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T SleepingWalker -R " + b37KGReference + " -I " + privateTestDir + "NA12878.100kb.BQSRv2.example.bam -o %s" + " -maxRuntime " + maxRuntime + " -maxRuntimeUnits MILLISECONDS -sleepTime " + sleepTime, 1, Collections.singletonList("")); final File result = executeTest("Subshard max runtime ", spec).getFirst().get(0); final int cycle = Integer.valueOf(new BufferedReader(new FileReader(result)).readLine()); final int maxCycles = (int)Math.ceil((maxRuntime * 5) / sleepTime); logger.warn(String.format("Max cycles %d saw %d in file %s with sleepTime %d and maxRuntime %d", maxCycles, cycle, result, sleepTime, maxRuntime)); Assert.assertTrue(cycle < maxCycles, "Too many cycles seen -- saw " + cycle + " in file " + result + " but max should have been " + maxCycles); } }
public void testClipper(String name, String args, String md51, String md52) { WalkerTestSpec spec = new WalkerTestSpec( "-R " + hg18Reference + " -T ClipReads " + "-I " + privateTestDir + "clippingReadsTest.withRG.bam " + "-os %s " + "-o %s " + args, 2, // just one output file Arrays.asList("tmp", "bam"), Arrays.asList(md51, md52)); List<File> result = executeTest(name, spec).getFirst(); }
@Test(enabled = true, dataProvider = "data") public void testDiffs(TestParams params) { WalkerTestSpec spec = new WalkerTestSpec( "-T DiffObjects -R " + publicTestDir + "exampleFASTA.fasta " + " -m " + params.master + " -t " + params.test + (params.doPairwise ? " -doPairwise " : "") + " -o %s", Arrays.asList(params.MD5)); executeTest("testDiffObjects:"+params, spec).getFirst(); } }
@Test(groups = "sra", dataProvider = "PRTest") public void testPrintReads(PRTest params) { WalkerTestSpec spec = new WalkerTestSpec( "-T PrintReads" + " -R " + params.accession + " -I " + params.accession + params.args + " --no_pg_tag" + " -o %s", Collections.singletonList(params.md5)); executeTest("testPrintReads-"+params.args, spec).getFirst(); }
public Pair<ExpandingArrayList<Long>, Long> reduce(Datum point, Pair<ExpandingArrayList<Long>, Long> sum) { ExpandingArrayList<Long> counts = sum.getFirst(); updateCounts(counts, point.nRodsAtThisLocation, 1); updateCounts(counts, 0, point.nSkippedBases); Pair<ExpandingArrayList<Long>, Long> r = new Pair<ExpandingArrayList<Long>, Long>(counts, point.nTotalBases + sum.getSecond()); //System.out.printf("Reduce: %s %s => %s%n", point, sum, r); return r; } }
@Test(timeOut = 20*1000*60) // this guy can take a long time because it's two steps, so give it 12 minutes public void testMultiSampleIndels1() { // since we're going to test the MD5s with GGA only do one here WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec( baseCommandIndels + " -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -o %s -L 1:10450700-10551000", 1, Arrays.asList("")); List<File> result = executeTest("test MultiSample Pilot1 CEU indels", spec1).getFirst(); WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec( baseCommandIndels + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles " + result.get(0).getAbsolutePath() + " -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -o %s -L " + result.get(0).getAbsolutePath(), 1, Arrays.asList("9d98079079d88346b6558dabdd109b21")); executeTest("test MultiSample Pilot1 CEU indels using GENOTYPE_GIVEN_ALLELES", spec2); }
@Test(enabled = true) public void testReadingAndWritingWitHNoChanges() { String md5ofInputVCF = "8c20749122424fe9590203bb72b352f8"; String testVCF = privateTestDir + "vcf4.1.example.vcf"; String baseCommand = "-R " + b37KGReference + " --no_cmdline_in_header -o %s "; String test1 = baseCommand + "-T VariantAnnotator --variant " + testVCF + " -L " + testVCF; WalkerTestSpec spec1 = new WalkerTestSpec(test1, 1, Arrays.asList(md5ofInputVCF)); List<File> result = executeTest("Test Variant Annotator with no changes", spec1).getFirst(); String test2 = baseCommand + "-T VariantsToVCF --variant " + result.get(0).getAbsolutePath(); WalkerTestSpec spec2 = new WalkerTestSpec(test2, 1, Arrays.asList(md5ofInputVCF)); executeTest("Test Variants To VCF from new output", spec2); }
@Test(dataProvider = "BQSRTest") public void testBQSR(BQSRTest params) { WalkerTestSpec spec = new WalkerTestSpec( params.getCommandLine(), Arrays.asList(params.md5)); executeTest("testBQSR-"+params.args, spec).getFirst(); }
@Test public void testAskingGCContent() throws IOException{ WalkerTestSpec spec = new WalkerTestSpec( baseTestString() + " --variant " + privateTestDir + "vcfexample2.vcf -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000 -A GCContent", 1, Arrays.asList("fcc42d7e0351efa7c3db0a114cbc17ed")); final File outputVCF = executeTest("test file has annotations, adding GCContent annotation", spec).getFirst().get(0); final VCFCodec codec = new VCFCodec(); final VCFHeader header = (VCFHeader) codec.readActualHeader(codec.makeSourceFromStream(new FileInputStream(outputVCF))); final VCFHeaderLine infoLineGC = header.getInfoHeaderLine(GATKVCFConstants.GC_CONTENT_KEY); // GC content must be a Float type Assert.assertTrue(infoLineGC.toString().contains("Type=Float")); }
public static void assertVCFandBCFFilesAreTheSame(final File vcfFile, final File bcfFile) throws IOException { final Pair<VCFHeader, VCIterable<LineIterator>> vcfData = VCIterable.readAllVCs(vcfFile, new VCFCodec()); final Pair<VCFHeader, VCIterable<PositionalBufferedStream>> bcfData = VCIterable.readAllVCs(bcfFile, new BCF2Codec()); assertVCFHeadersAreEqual(bcfData.getFirst(), vcfData.getFirst()); assertVariantContextStreamsAreEqual(bcfData.getSecond(), vcfData.getSecond()); }