-
Notifications
You must be signed in to change notification settings - Fork 593
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
give BWA-spark better default read filters #4286
Conversation
…e default set of read filters.
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.
Review complete, back to @lbergelson for changes. Merge after addressing comments.
@@ -45,6 +48,12 @@ public boolean requiresReads() { | |||
return true; | |||
} | |||
|
|||
@Override | |||
public List<ReadFilter> getDefaultReadFilters() { | |||
// 1) unmapped or neither secondary nor supplementary and 2) has some sequence |
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.
Comment seems a little off here -- shouldn't this say "primary" rather than "unmapped"?
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.
clarified
@@ -121,6 +122,9 @@ public void close() { | |||
this.bwaMemIndex = BwaMemIndexCache.getInstance(indexFileName); | |||
this.readsHeader = readsHeader; | |||
this.alignsPairs = alignsPairs; | |||
if ( alignsPairs && readsHeader.getSortOrder() != SAMFileHeader.SortOrder.queryname ) { | |||
throw new UserException("Input must be queryname sorted unless you use single-ended alignment mode."); |
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 add a test that exercises this case?
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.
What if it is "unsorted" but with group order "queryname"?
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.
@magicDGS That's a very good point. That should allowed as well. I'll update it.
if (alignsPairs && (nReads & 1) != 0 ) { | ||
throw new GATKException("We're supposed to be aligning paired reads, but there are an odd number of them."); | ||
if ( alignsPairs ) { | ||
if ( (nReads & 1) != 0 ) { |
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.
Why are you using bitwise-AND instead of the mod operator to check whether the number is odd? Mod is more straightforward I think.
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.
Because Ted Sharpe. Changed.
final String readName1 = inputReads.get(idx).getName(); | ||
final String readName2 = inputReads.get(idx+1).getName(); | ||
if ( !Objects.equals(readName1,readName2) ) { | ||
throw new GATKException("Read pair has varying template name: "+readName1+" .vs "+readName2); |
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.
Should this one be a UserException
, since it's a problem with the input?
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.
fixed
throw new GATKException("We're supposed to be aligning paired reads, but there are an odd number of them."); | ||
if ( alignsPairs ) { | ||
if ( (nReads & 1) != 0 ) { | ||
throw new GATKException("We're supposed to be aligning paired reads, but there are an odd number of them."); |
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.
Should this be a UserException
?
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.
yes it should, fixed
@@ -88,6 +88,7 @@ else if ( alwaysGenerateASandXS ) { | |||
samRecord.setReadBases(SAMRecord.NULL_SEQUENCE); | |||
samRecord.setBaseQualities(SAMRecord.NULL_QUALS); | |||
} | |||
//TODO: there ought to be a way to indicate a set of tag names that ought to be copied -- we're just doing RG | |||
if ( readGroup != null ) samRecord.setAttribute(SAMTag.RG.name(), readGroup); |
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 curly braces around if statement body.
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, although I didn't hit the rest of the file
@@ -60,5 +61,4 @@ public void testSingleEnd() throws Exception { | |||
|
|||
SamAssertionUtils.assertSamsEqual(new File(output, "part-r-00000.bam"), expectedSam); | |||
} | |||
|
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.
Aren't there any additional tests for BwaSpark
that pass with this fix and failed without it? If not, can you add one?
@lbergelson Please address the code review comments in a separate PR, since they mainly have to do with comments and testing -- I'm merging this as-is for now. |
…e default set of read filters. (#4286)
Wellformed is too strict for BWA since it asserts things about the alignment. It also doesn't correctly remove secondary and supplementary alignments like we should we performing a new alignment.