-
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
Fixed a missing special case in MarkDuplicates ReadsKey code #4899
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,21 +55,39 @@ public Pair(final GATKRead read1, final GATKRead read2, final SAMFileHeader head | |
final int read1UnclippedStart = ReadUtils.getStrandedUnclippedStart(read1); | ||
final int read2UnclippedStart = ReadUtils.getStrandedUnclippedStart(read2); | ||
|
||
if( read1UnclippedStart < read2UnclippedStart ){ | ||
int read1ReferenceIndex = ReadUtils.getReferenceIndex(read1,header); | ||
int read2ReferenceIndex = ReadUtils.getReferenceIndex(read2,header); | ||
|
||
if( read1ReferenceIndex != read2ReferenceIndex ? read1ReferenceIndex < read2ReferenceIndex : read1UnclippedStart <= read2UnclippedStart ){ | ||
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. There should be a test for this edge case that we were missing. |
||
first = read1; | ||
second = read2; | ||
} else { | ||
first = read2; | ||
second = read1; | ||
} | ||
// Keep track of the orientation of read1 and read2 as it is important for optical duplicate marking | ||
wasFlipped = second.isFirstOfPair(); | ||
|
||
firstStartPosition = first.getAssignedStart(); | ||
|
||
// if the two read ends are in the same position, pointing in opposite directions, | ||
// the orientation is undefined and the procedure above | ||
// will depend on the order of the reads in the file. | ||
// To avoid this, and match picard's behavior in this case, we ensure the orientation will be FR: | ||
if (read1ReferenceIndex == read2ReferenceIndex && | ||
read1UnclippedStart == read2UnclippedStart && | ||
first.isReverseStrand() && !second.isReverseStrand()) { | ||
// setting to FR for consistencies sake. (which involves flipping) if both reads had the same unclipped start | ||
GATKRead tmp = first; | ||
first = second; | ||
second = tmp; | ||
} | ||
|
||
this.key = ReadsKey.getKeyForPair(header, first, second, headerLibraryMap); | ||
|
||
isRead1ReverseStrand = first.isReverseStrand(); | ||
isRead2ReverseStrand = second.isReverseStrand(); | ||
|
||
// Keep track of the orientation of read1 and read2 as it is important for optical duplicate marking | ||
wasFlipped = second.isFirstOfPair(); | ||
|
||
this.key = ReadsKey.getKeyForPair(header, first, second, headerLibraryMap); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wouldn't this would be easier to read as
unless I missed something there that makes them not equivalent
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.
No actually that is not equivalent, if read2RefIndex > read1RefIndex BUT it starts earlier on its contig that statement would be false when it should not be
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.
Oh, heh, you're write. I didn't think that through.