Source:
<code><START> public void testPoorQualityBases(final String useFastAlgorithm) throws IOException { <END> final File reference = new File("testdata/picard/quality/chrM.reference.fasta"); final File testSamFile = File.createTempFile("CollectWgsMetrics", ".bam", TEST_DIR); testSamFile.deleteOnExit(); final SAMRecordSetBuilder setBuilder = CollectWgsMetricsTestUtils.createTestSAMBuilder(reference, READ_GROUP_ID, SAMPLE, PLATFORM, LIBRARY); setBuilder.setReadLength(10); for (int i = 0; i < 3; i++){ setBuilder.addPair("GreatBQRead:" + i, 0, 1, 30, false, false, "10M", "10M", false, true, 40); } for (int i = 0; i < 3; i++){ setBuilder.addPair("PoorBQRead:" + i, 0, 1, 30, false, false, "10M", "10M", false, true, 10); } final SAMFileWriter writer = new SAMFileWriterFactory().setCreateIndex(true).makeBAMWriter(setBuilder.getHeader(), false, testSamFile); for (final SAMRecord record : setBuilder) { writer.addAlignment(record); } writer.close(); final File outfile = File.createTempFile("testExcludedBases-metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + testSamFile.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "REFERENCE_SEQUENCE=" + reference.getAbsolutePath(), "INCLUDE_BQ_HISTOGRAM=true", "COVERAGE_CAP=3" }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetrics.WgsMetrics, Integer> output = new MetricsFile<>(); output.read(new FileReader(outfile)); final CollectWgsMetrics.WgsMetrics metrics = output.getMetrics().get(0); Assert.assertEquals(metrics.PCT_EXC_BASEQ, 0.5); Assert.assertEquals(metrics.PCT_EXC_CAPPED, 0.0); }</code><technical_language>do input function here</technical_language>

Target:
public void testPoorQualityBases(final String useFastAlgorithm) throws IOException { final File reference = new File("testdata/picard/quality/chrM.reference.fasta"); final File testSamFile = File.createTempFile("CollectWgsMetrics", ".bam", TEST_DIR); testSamFile.deleteOnExit(); final SAMRecordSetBuilder setBuilder = CollectWgsMetricsTestUtils.createTestSAMBuilder(reference, READ_GROUP_ID, SAMPLE, PLATFORM, LIBRARY); setBuilder.setReadLength(10); for (int i = 0; i < 3; i++){ setBuilder.addPair("GreatBQRead:" + i, 0, 1, 30, false, false, "10M", "10M", false, true, 40); } for (int i = 0; i < 3; i++){ setBuilder.addPair("PoorBQRead:" + i, 0, 1, 30, false, false, "10M", "10M", false, true, 10); } final SAMFileWriter writer = new SAMFileWriterFactory().setCreateIndex(true).makeBAMWriter(setBuilder.getHeader(), false, testSamFile); for (final SAMRecord record : setBuilder) { writer.addAlignment(record); } writer.close(); final File outfile = File.createTempFile("testExcludedBases-metrics", ".txt"); outfile.deleteOnExit(); final String[] args = new String[] { "INPUT=" + testSamFile.getAbsolutePath(), "OUTPUT=" + outfile.getAbsolutePath(), "REFERENCE_SEQUENCE=" + reference.getAbsolutePath(), "INCLUDE_BQ_HISTOGRAM=true", "COVERAGE_CAP=3", "USE_FAST_ALGORITHM=" + useFastAlgorithm }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<CollectWgsMetrics.WgsMetrics, Integer> output = new MetricsFile<>(); output.read(new FileReader(outfile)); final CollectWgsMetrics.WgsMetrics metrics = output.getMetrics().get(0); Assert.assertEquals(metrics.PCT_EXC_BASEQ, 0.5); Assert.assertEquals(metrics.PCT_EXC_CAPPED, 0.0); }