-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing a bug in parsing of T0 tag #8185
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,12 @@ | |
|
||
public class FlowBasedReadUnitTest extends GATKBaseTest { | ||
|
||
// If true, update the expected outputs in tests that assert an exact match vs. prior output, | ||
// instead of actually running the tests. Can be used with "./gradlew test -Dtest.single=HaplotypeCallerIntegrationTest" | ||
// to update all of the exact-match tests at once. After you do this, you should look at the | ||
// diffs in the new expected outputs in git to confirm that they are consistent with expectations. | ||
public static final boolean UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good to add. |
||
|
||
@Test | ||
void testBAMFormatParsing() throws Exception{ | ||
final String testResourceDir = publicTestDir + "org/broadinstitute/hellbender/utils/read/flow/reads/"; | ||
|
@@ -38,23 +44,35 @@ void testBAMFormatParsing() throws Exception{ | |
for ( sr = reader.iterator(), curRead = 0 ; sr.hasNext(); curRead++) { | ||
final FlowBasedRead fbr = new FlowBasedRead(sr.next(),flowOrder, 12, fbargs); | ||
fbr.applyAlignment(); | ||
Assert.assertEquals(fbr.totalKeyBases(), fbr.seqLength()); | ||
|
||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".key.txt")) { | ||
fbr.writeKey(fos); | ||
} | ||
|
||
|
||
String expectedFile = outputDir + "sample." + curRead + ".key.txt"; | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".key.txt"), new File(expectedFile)); | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".matrix.txt")){ | ||
fbr.writeMatrix(fos); | ||
if (!UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS) { | ||
Assert.assertEquals(fbr.totalKeyBases(), fbr.seqLength()); | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".key.txt")) { | ||
fbr.writeKey(fos); | ||
} | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".key.txt"), new File(expectedFile)); | ||
} else { | ||
try (FileWriter fos = new FileWriter(expectedFile)) { | ||
fbr.writeKey(fos); | ||
} | ||
} | ||
expectedFile = outputDir + "sample." + curRead + ".matrix.txt"; | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".matrix.txt"), new File(expectedFile)); | ||
|
||
if (!UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS) { | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".matrix.txt")) { | ||
fbr.writeMatrix(fos); | ||
} | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".matrix.txt"), new File(expectedFile)); | ||
} else { | ||
try (FileWriter fos = new FileWriter(expectedFile)) { | ||
fbr.writeMatrix(fos); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@Test | ||
void testBAMFormatParsingWithT0() throws Exception{ | ||
final String testResourceDir = publicTestDir + "org/broadinstitute/hellbender/utils/read/flow/reads/"; | ||
|
@@ -73,20 +91,33 @@ void testBAMFormatParsingWithT0() throws Exception{ | |
for ( sr = reader.iterator(), curRead = 0 ; sr.hasNext(); curRead++) { | ||
final FlowBasedRead fbr = new FlowBasedRead(sr.next(),flowOrder, 12, fbargs); | ||
fbr.applyAlignment(); | ||
Assert.assertEquals(fbr.totalKeyBases(), fbr.seqLength()); | ||
String expectedFile = outputDir + "sample.t0." + curRead + ".key.txt"; | ||
|
||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".key.txt")) { | ||
fbr.writeKey(fos); | ||
if ( !UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS ) { | ||
Assert.assertEquals(fbr.totalKeyBases(), fbr.seqLength()); | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".key.txt")) { | ||
fbr.writeKey(fos); | ||
} | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".key.txt"), new File(expectedFile)); | ||
} else { | ||
try (FileWriter fos = new FileWriter( expectedFile )) { | ||
fbr.writeKey(fos); | ||
} | ||
} | ||
|
||
expectedFile = outputDir + "sample.t0." + curRead + ".matrix.txt"; | ||
|
||
if (!UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS) { | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".matrix.txt")) { | ||
fbr.writeMatrix(fos); | ||
} | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".matrix.txt"), new File(expectedFile)); | ||
} else { | ||
try (FileWriter fos = new FileWriter(expectedFile)) { | ||
fbr.writeMatrix(fos); | ||
} | ||
|
||
String expectedFile = outputDir + "sample.t0." + curRead + ".key.txt"; | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".key.txt"), new File(expectedFile)); | ||
try (FileWriter fos = new FileWriter(tempOutputDir + "/" + curRead + ".matrix.txt")){ | ||
fbr.writeMatrix(fos); | ||
} | ||
expectedFile = outputDir + "sample.t0." + curRead + ".matrix.txt"; | ||
IntegrationTestSpec.assertEqualTextFiles(new File(tempOutputDir + "/" + curRead + ".matrix.txt"), new File(expectedFile)); | ||
} | ||
} | ||
|
||
|
@@ -165,5 +196,9 @@ public void testArtificialFlowBasedReadConstruction() { | |
new FlowBasedRead(read, FlowBasedRead.DEFAULT_FLOW_ORDER, FlowBasedRead.MAX_CLASS, new FlowBasedArgumentCollection()); | ||
} | ||
|
||
@Test | ||
public void assertThatExpectedOutputUpdateToggleIsDisabled() { | ||
Assert.assertFalse(UPDATE_EXACT_MATCH_EXPECTED_OUTPUTS, "The toggle to update expected outputs should not be left enabled"); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4829,8 +4829,8 @@ C,R,F,B,Bi,Q,ti | |
321,12,1,G,234,40,0,. 0.0010 | ||
|
||
C,R,F,B,Bi,Q,ti | ||
322,0,0,.,.,.,.,. 0.9880 | ||
322,1,0,.,.,.,.,. 0.0010 | ||
322,0,0,.,.,.,.,. 0.8890 | ||
322,1,0,.,.,.,.,. 0.1000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seem like fairly small effects... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. And from the beginning the effect is small. But the fix does seem to improve SNPs a tiny bit |
||
322,2,0,.,.,.,.,. 0.0010 | ||
322,3,0,.,.,.,.,. 0.0010 | ||
322,4,0,.,.,.,.,. 0.0010 | ||
|
@@ -4844,8 +4844,8 @@ C,R,F,B,Bi,Q,ti | |
322,12,0,.,.,.,.,. 0.0010 | ||
|
||
C,R,F,B,Bi,Q,ti | ||
323,0,0,.,.,.,.,. 0.9880 | ||
323,1,0,.,.,.,.,. 0.0010 | ||
323,0,0,.,.,.,.,. 0.8890 | ||
323,1,0,.,.,.,.,. 0.1000 | ||
323,2,0,.,.,.,.,. 0.0010 | ||
323,3,0,.,.,.,.,. 0.0010 | ||
323,4,0,.,.,.,.,. 0.0010 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide a bit of context as to what the expectation is/was here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done