-
Notifications
You must be signed in to change notification settings - Fork 291
Open
Description
Currently, to create an iterator over PileupColumns, we need to call AlignmentFile.pileup().
If instead we have a list of AlignedSegments and want to a pileup, we have write it to a file and return the pileup, which is pretty ugly and inefficient.
I wanted to inquire about the appetite for adding support for this into pysam via a PR.
Sketching this out quickly to prove to myself this is feasible, I was thinking the following:
- Create a htslib pileup struct (
bam_plp_t) usingbam_plp_init. - Push all the records (
bam1_t) onto the pileup usingbam_plp_push. - Call
bam_plp_nextto yield the next pileups (in thenextmethod of the iterator). - Use
bam_mplp_tto iterator over the range of possible positions (assumes the records are in coordinate sorted order when pushed on the underlying iterator) - Use the above to implement the
IteratorColumninterface.
If that sounds like a reasonable implementation sketch, I'd be glad to make a PR.
I made a draft PR for comments before I go any further (e.g. tests): #1353
Metadata
Metadata
Assignees
Labels
No labels