samtools / htslib

C library for high-throughput sequencing data formats
Other
804 stars 446 forks source link

base mod API clarification #1635

Closed jts closed 1 year ago

jts commented 1 year ago

I've been working to add support for the basemod API to rust-htslib (https://github.com/rust-bio/rust-htslib/pull/385) and am a bit confused about the base_mod_query_type function. I currently use it to retrieve metadata (strand, canonical base, implicit/explicit flag) for each modification code but when writing a test around MM-double.sam I realized that it will always return metadata for the first m mod (C+m, never G-m) in the record. Is it intended that user-level code uses base_mod_query_type, or should we only use the data returned during iteration (like in the test_mod.c driver code)?

jts commented 1 year ago

@cjw85 just pointed out to me this is essentially the same as https://github.com/samtools/htslib/issues/1550. Feel free to close to keep the discussion in one place but it might be good to add a new API call base_mod_queryi (or something) that returns metadata for the i-th modification in the record, to be used with bam_mods_recorded.

jkbonfield commented 1 year ago

Closing and will start on #1550 then