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

basemod API and hardclipped alignments #1566

Closed
jts opened this issue Feb 17, 2023 · 2 comments
Closed

basemod API and hardclipped alignments #1566

jts opened this issue Feb 17, 2023 · 2 comments

Comments

@jts
Copy link

jts commented Feb 17, 2023

The MM tag is intended to be with respect to the instrument's basecalled sequence and hence can be copied as-is so aligners (and other tools) do not need to be aware of base modifications. In the case where the aligner hard clips the sequence and copies the MM tag however, the coordinates may no longer be valid. The current implementation of the API will process the tag for hardclipped alignments returning (potentially) invalid coordinates. Here is a small example sam:

@SQ     SN:chr1 LN:248956422
@CO     Basemod reference to hardclipped base
test-read       0       chr1    19931836        60      20H36M  *       0       0       AGGATCTCTAGCGGATCGGCGGGGGATATGCCATAT    *       Mm:Z:C+m,1;     Ml:B:C,12

Using bam_parse_basemod followed by bam_next_mod will result in a single hts_base_mod at position 7 of SEQ. I think it is preferable in this case for bam_parse_basemod to return -1.

Thanks,
Jared

@jkbonfield
Copy link
Contributor

Agreed, I think this is a good point.

Note manufacturers can use N as a the fundamental base, to make counting achievable even when there are hard-clips. I suspect I also do the maths incorrectly here though too.

@jkbonfield
Copy link
Contributor

Fixed by #1590, but see also samtools/hts-specs#714.

It's possible the tag name may change, so maybe 1590 merge was premature, but it's not a problem until we do another main release anyway and obviously it's trivial to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants