Skip to content

Commit

Permalink
--include-qc-failed-reads option
Browse files Browse the repository at this point in the history
  • Loading branch information
dror27 committed Jun 19, 2023
1 parent cd415bd commit 90e1932
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public final class FlowFeatureMapper extends ReadWalker {
private static final String VCF_SMQ_RIGHT_MEAN = "X_SMQ_RIGHT_MEAN";

private static final Double LOWEST_PROB = 0.0001;
private static final int VENDOR_QUALITY_CHECK_FLAG = 0x200;

private static final String INCLUDE_QC_FAILED_READS_FULL_NAME = "include-qc-failed-reads";

@Argument(fullName = StandardArgumentDefinitions.OUTPUT_LONG_NAME,
shortName = StandardArgumentDefinitions.OUTPUT_SHORT_NAME,
Expand Down Expand Up @@ -131,6 +134,10 @@ public final class FlowFeatureMapper extends ReadWalker {
@Argument(fullName=HaplotypeCallerArgumentCollection.OUTPUT_BLOCK_LOWER_BOUNDS, doc = "Output the band lower bound for each GQ block regardless of the data it represents", optional = true)
public boolean floorBlocks = false;

@Advanced
@Argument(fullName=INCLUDE_QC_FAILED_READS_FULL_NAME, doc = "include reads with QC failed flag", optional = true)
public boolean includeQcFailedReads = false;

@ArgumentCollection
public FlowBasedArgumentCollection fbargs = new FlowBasedArgumentCollection();

Expand Down Expand Up @@ -337,6 +344,11 @@ public void apply(final GATKRead read, final ReferenceContext referenceContext,
return;
}

// include qc-failed reads?
if ( ((read.getFlags() & VENDOR_QUALITY_CHECK_FLAG) != 0) && !includeQcFailedReads ) {
return;

Check warning on line 349 in src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/broadinstitute/hellbender/tools/walkers/featuremapping/FlowFeatureMapper.java#L349

Added line #L349 was not covered by tests
}

// flush qeues up to this read
flushQueue(read, referenceContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,35 @@ public void testSurroundingAllQuality() throws IOException {
}
}

@Test
public void testQCFailed() throws IOException {

final File outputDir = createTempDir("testFlowFeatureMapperTest");
final File expectedFile = new File(testDir + "/snv_feature_mapper_qc_failed_output.vcf");
final File outputFile = UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS ? expectedFile : new File(outputDir + "/snv_feature_mapper_qc_failed_output.vcf");

final String[] args = new String[] {
"-R", largeFileTestDir + "/Homo_sapiens_assembly38.fasta.gz",
"-O", outputFile.getAbsolutePath(),
"-I", testDir + "/snv_feature_mapper_input.bam",
"--copy-attr", "tr",
"--limit-score", "100",
"--min-score", "0",
"--snv-identical-bases", "10",
"--debug-negatives", "false",
"--debug-read-name", "150451-BC94-0645901755",
"--include-qc-failed-reads", "true"
};

// run the tool
runCommandLine(args); // no assert, just make sure we don't throw

// make sure we've generated the otuput file
Assert.assertTrue(outputFile.exists());

// walk the output and expected files, compare non-comment lines
if ( !UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS ) {
IntegrationTestSpec.assertEqualTextFiles(outputFile, expectedFile, "#");
}
}
}
Git LFS file not shown
Git LFS file not shown

0 comments on commit 90e1932

Please sign in to comment.