pairtools
pairtools copied to clipboard
Fixing API incomplete functionality for read side detection
What was wrong?
- Detection of the read side was not functional with some aligners after API refactoring https://github.com/open2c/pairtools/commit/9d99660ce8ffda66486c2b0cc296a6bb814576bf
Technical description of the issue:
- Detection of the read side was moved from
push_pysamtogroup_alignments_by_side, which relied onsam.is_read1attribute of pysam entry. It simply does not always work as intended in pysam, and detection of the read side shall be done bysam.flaginstead, like was done in https://github.com/open2c/pairtools/blob/6303de6d9e992e426285840bfd10e7d5dbbc1c84/pairtools/lib/parse.py#L220-L227 - Inappropriate detection of the read side probably resulted in sometimes reporting the read side, potentially depending on the aligner. It did not work for single-end reads reported in issue https://github.com/open2c/pairtools/issues/247.
Solution:
group_alignments_by_sidewas refactored and fully merged with the oldpush_pysamfunction.
I did not design any specific test, as existing tests cover parse and parse2 read side detection; they just cannot cover all possible aligners that can report read side differently.