Skip to content

Commit

Permalink
Return --readid-transform functionality broken after latest release.
Browse files Browse the repository at this point in the history
  • Loading branch information
agalitsyna committed Oct 4, 2024
1 parent a9652f8 commit 3d93ea1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pairtools/lib/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ def streaming_classify(

### Iterate over input pysam:
instream = iter(instream)
for (readID, (sams1, sams2)) in read_alignment_block(instream, sort=True, group_by_side=True, return_readID=True):
if readID_transform is not None:
readID = eval(readID_transform)
for (readID, (sams1, sams2)) in read_alignment_block(instream, sort=True, group_by_side=True, return_readID=True, readID_transform=readID_transform):

### Parse
if not parse2: # regular parser:
Expand Down Expand Up @@ -224,13 +222,15 @@ def group_alignments_by_side(sams):
return sams1, sams2


def read_alignment_block(instream, sort=True, group_by_side=True, return_readID=True):
def read_alignment_block(instream, sort=True, group_by_side=True, return_readID=True, readID_transform=None):
sams = []

prev_readID = None
while True:
sam_entry = next(instream, None)
readID = sam_entry.query_name if sam_entry else None
if readID_transform is not None and readID is not None:
readID = eval(readID_transform)

# Read is fully populated, then parse and write:
if not (sam_entry) or ((readID != prev_readID) and prev_readID):
Expand Down

0 comments on commit 3d93ea1

Please sign in to comment.