Skip to content

Commit

Permalink
fix: Add QNAME in pair identification
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisVerkhoturov committed Sep 22, 2017
1 parent 7843453 commit 3c01a88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/htsjdk/samtools/SAMRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ private boolean hasReferenceName() {
*/
public boolean isPair(final SAMRecord record) {
return record != null
&& Objects.equals(this.getReadName(), record.getReadName())
&& this.getMateAlignmentStart() == record.getAlignmentStart()
&& record.getMateAlignmentStart() == this.getAlignmentStart()
&& !NO_ALIGNMENT_REFERENCE_NAME.equals(this.getMateReferenceName())
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/htsjdk/samtools/SAMRecordUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,11 @@ public void testRecordsArePairIfTheyLinkEachOtherInMateFields() {
@Test
public void testRecordsArePairIfTheyHaveNoMateFields() {
final SAMRecord first = new SAMRecord(new SAMFileHeader(new SAMSequenceDictionary()));
first.setReadName("example1");
first.setAlignmentStart(42);
first.setReferenceName("chrm1");
final SAMRecord second = new SAMRecord(new SAMFileHeader(new SAMSequenceDictionary()));
first.setReadName("example1");
second.setAlignmentStart(142);
second.setReferenceName("chrm2");

Expand Down

0 comments on commit 3c01a88

Please sign in to comment.