Skip to content

Commit 3c01a88

Browse files
fix: Add QNAME in pair identification
1 parent 7843453 commit 3c01a88

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/main/java/htsjdk/samtools/SAMRecord.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ private boolean hasReferenceName() {
338338
*/
339339
public boolean isPair(final SAMRecord record) {
340340
return record != null
341+
&& Objects.equals(this.getReadName(), record.getReadName())
341342
&& this.getMateAlignmentStart() == record.getAlignmentStart()
342343
&& record.getMateAlignmentStart() == this.getAlignmentStart()
343344
&& !NO_ALIGNMENT_REFERENCE_NAME.equals(this.getMateReferenceName())

src/test/java/htsjdk/samtools/SAMRecordUnitTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,9 +1124,11 @@ public void testRecordsArePairIfTheyLinkEachOtherInMateFields() {
11241124
@Test
11251125
public void testRecordsArePairIfTheyHaveNoMateFields() {
11261126
final SAMRecord first = new SAMRecord(new SAMFileHeader(new SAMSequenceDictionary()));
1127+
first.setReadName("example1");
11271128
first.setAlignmentStart(42);
11281129
first.setReferenceName("chrm1");
11291130
final SAMRecord second = new SAMRecord(new SAMFileHeader(new SAMSequenceDictionary()));
1131+
first.setReadName("example1");
11301132
second.setAlignmentStart(142);
11311133
second.setReferenceName("chrm2");
11321134

0 commit comments

Comments
 (0)