Skip to content
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

Fix for incorrect output of dedup with --paired (#347) #363

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions umi_tools/sam_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def write(self, read, unique_id=None, umi=None, unmapped=False):
self.write_mates()
self.chrom = read.reference_name

key = read.query_name, read.next_reference_name, read.next_reference_start
key = read.query_name, read.next_reference_name, read.next_reference_start, read.reference_name, read.reference_start
self.read1s.add(key)

self.outfile.write(read)
Expand All @@ -605,7 +605,7 @@ def write_mates(self):
if any((read.is_unmapped, read.mate_is_unmapped, read.is_read1)):
continue

key = read.query_name, read.reference_name, read.reference_start
key = read.query_name, read.reference_name, read.reference_start, read.next_reference_name, read.next_reference_start
if key in self.read1s:
self.outfile.write(read)
self.read1s.remove(key)
Expand All @@ -623,10 +623,10 @@ def close(self):
found = 0
for read in self.infile.fetch(until_eof=True, multiple_iterators=True):

if read.is_unmapped:
if any((read.is_unmapped, read.mate_is_unmapped, read.is_read1)):
continue

key = read.query_name, read.reference_name, read.reference_start
key = read.query_name, read.reference_name, read.reference_start, read.next_reference_name, read.next_reference_start
if key in self.read1s:
self.outfile.write(read)
self.read1s.remove(key)
Expand Down