-
Notifications
You must be signed in to change notification settings - Fork 589
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
the long awaited FastaAlternateReferenceMaker #5549
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5549 +/- ##
==============================================
- Coverage 87.09% 87.018% -0.072%
- Complexity 31524 31706 +182
==============================================
Files 1930 1943 +13
Lines 145231 146064 +833
Branches 16095 16137 +42
==============================================
+ Hits 126482 127102 +620
- Misses 12900 13077 +177
- Partials 5849 5885 +36
|
4ec7a34
to
f98fa90
Compare
* new walker type ReferenceWalker * changes to close behavior in FastaWriter and adding additional buffering * new walkers: CountBasesInReference FastaReferenceMaker FastaAlternateReferenceMaker
f98fa90
to
4e60787
Compare
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.
Minor comments only -- back to @lbergelson. Merge once these are addressed.
import org.broadinstitute.hellbender.utils.iterators.IntervalLocusIterator; | ||
|
||
/** | ||
* A reference walker is a tool which process each position in a given reference. |
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.
process -> processes
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.
each position -> each base that overlaps a set of intervals? (ie., describe the traversal more precisely 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
* A reference walker is a tool which process each position in a given reference. | ||
* | ||
* ReferenceWalker authors must implement the apply() method to process each position, and may optionally implement | ||
* {@link #onTraversalStart()} and/or {@link #onTraversalSuccess()}. See the {@link ExampleReferenceWalker} walker for an example. |
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.
Mention getReferenceWindow()
here as an additional method that tool authors might want to override.
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
|
||
/** | ||
* Determine the window to use when creating the ReferenceContext in apply. This determines which reference bases are | ||
* see at each position, as well as which reads / features are considered to overlap the reference site. |
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.
see -> seen
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
final CountingReadFilter readFilter = makeReadFilter(); | ||
|
||
for(SimpleInterval locus : getIntervalIterator()){ | ||
SimpleInterval referenceWindow = getReferenceWindow(locus); |
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.
locus
and referenceWindow
should both be final
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.
huh, I wonder why intellij didn't remind me of that.
@@ -0,0 +1,78 @@ | |||
package org.broadinstitute.hellbender.tools.examples; | |||
|
|||
import com.netflix.servo.util.VisibleForTesting; |
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.
Wrong VisibleForTesting
annotation...
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.
changed to com.hulu.util.VisibleForTesting
public class CountBasesInReferenceIntegrationTest extends CommandLineProgramTest { | ||
|
||
@Test | ||
public void testExampleReferenceWalker(){ |
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.
testExampleReferenceWalker()
-> testCountBasesInReferenceWithInterval()
} | ||
|
||
@Test | ||
public void testExampleReferenceWalkerFull(){ |
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.
testExampleReferenceWalkerFull()
-> testCountBasesInReferenceFull()
Assert.assertEquals(BaseUtils.basesToIUPAC((byte)'A', (byte)'T'), 'W', "testing A/T=W"); | ||
Assert.assertEquals(BaseUtils.basesToIUPAC((byte)'T', (byte)'A'), 'W', "testing T/A=W"); | ||
Assert.assertEquals(BaseUtils.basesToIUPAC((byte) 'G', (byte) 'T'), 'K', "testing G/T=K"); | ||
Assert.assertEquals(BaseUtils.basesToIUPAC((byte) 'T', (byte) 'G'), 'K', "testing T/G=K"); |
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.
This test doesn't cover all the possibilities -- could you add the missing cases? (should be pretty easy)
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
import java.util.Arrays; | ||
import java.util.Map; | ||
|
||
public class FastaTestUtils { |
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.
final
(and make the default constructor private)
|
||
public class FastaTestUtils { | ||
|
||
public static void assertOutput(final Path path, final boolean mustHaveIndex, final boolean mustHaveDictionary, |
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.
Add docs for these methods (and give assertOutput()
a more descriptive name)
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.
I moved most of these back to the unit test they originally came from. I had intended to use them in my tests but they ended up being to brittle to adapt. I documented what was left.
CountBasesInReference
FastaReferenceMaker
FastaAlternateReferenceMaker