-
Notifications
You must be signed in to change notification settings - Fork 173
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
Can ML Tags be zero length arrays? #728
Comments
The exception encountered (Empty array passed to setUnsignedArrayAttribute for tag [tagname]) is not specific to ML but would be triggered for any tagged field. Zero-length arrays are explicitly valid in general since 2018 (see #135 and #326), and HTSJDK (and hence Picard and GATK) was adjusted accordingly in samtools/htsjdk#1194. Unfortunately So much for the proximate cause. However there may be HTSJDK base modification code that would have been run for ML in particular but did not execute as this exception was thrown first, that might not handle a zero-length array; i.e., there may be additional reasons why HTSJDK might not handle a zero-length ML field — so we still need an answer to whether an empty ML array is intended to be valid. In my opinion, such an ML value is very much valid and HTSJDK ought to accept it without issue. SAMtags.pdf §1.7 also says
This is quite explicit that for a record that contains Practically speaking, it would be silly to require methylation calling software to include code to check whether their MM tag being emitted lists no modifications and suppress emitting an ML field accordingly. Far better to regularise the corner case of a correspondingly empty ML value. So the correct interpretation is your (1), and this is simply an HTSJDK bug. One commenter on the GATK discussion considered that it is unclear whether the SAM spec allows an empty ML value or not. We could add explicit text noting that an empty |
PR samtools/htsjdk#1669 addresses the immediate issue, namely the incorrectly raised exception that has been encountered when using HTSJDK. |
Fully agree with @jmarshall's comment. I don't really see the need to be explicit here. Zero length arrays are legal, and we don't need to mention it for ML as it may lead people to the wrong conclusion that permitting zero-length here is an exception rather than the norm. |
We are closing this as we do not think there is merit in singling out ML tags for additional clarification in the specification, but thank you for raising the issue. This is an bug in a specific implementation, for which a fix has already been provided and will be merged in due course. |
The HTSJDK fix has now been released in HTSJDK 4.0.0. |
Currently, htsjdk will throw an exception if the ML record is present but empty. This post on the GATK forum documents an example of this exception in the wild. However, after reading section 1.7 on Modified Bases in the SAMtags spec, it is unclear to me if htsjdk is correctly interpreting this constraint. For example, is this arrangement of records out of spec?
< ... snip ...> MM:Z:C+m?; ML:B:C < ... snip ...>
To quote section 1.7:
and
If I understand this correctly, the expected count of ML entries is driven by the number of list of modifications mentioned by MM.
However, since
MM:Z:C+m;
explicitly indicates no modifications occurred, there are no events for ML to annotate.I think there are two possible but mutually exclusive interpretations to this use case, but the question is which one?
The text was updated successfully, but these errors were encountered: