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

flag for first line in example should be 99 not 163 #26

Closed
arlin opened this issue Mar 21, 2014 · 3 comments
Closed

flag for first line in example should be 99 not 163 #26

arlin opened this issue Mar 21, 2014 · 3 comments

Comments

@arlin
Copy link

arlin commented Mar 21, 2014

Apologies if I've got this wrong, but I think the SAM/BAM format spec has a mistake. The first alignment line in the example SAM file (first page of the spec) assigns 163 to the mapping that is labeled "r001/1" in the alignment shown above the example. The problem is that 163 is the code for the second member of a pair, but the "/1" implies that "r001/1" is the first member of the pair and "r001/2" is the second member. The code for a first-member, forward-strand, both-mapped paired read is 99. So I think the paired reads should be 99 (first r001 line) and 147 (last r001 line) rather than 163 and 83 as given.

@arlin
Copy link
Author

arlin commented Mar 21, 2014

In the SAM/BAM format spec, it's confusing to describe "TLEN" as a "signed length", because lengths are non-negative quantities. TLEN could be described more clearly as an "offset". It is the observed offset from one end of the template to the other. For the leftmost segment, the offset is positive. For the rightmost, it is negative. In other cases it is undefined or 0.

@jmarshall
Copy link
Member

You are correct about the flags in the example, and I am in the process of fixing it.

IMHO it's barely reasonable to describe something as a signed length, to mean a length (which is of course unsigned) together with a sign attached to it denoting something related. However in any case, we've been reworking the description of TLEN to hopefully make it clearer -- please have a look at #23 and comment there on whether you think it's an improvement.

@arlin
Copy link
Author

arlin commented Apr 2, 2014

The same change to the flags needs to be made for the padded SAM version of the same example that is provided in section 3.2. That is, the flags 163 and 83 for the first and last reads of qname=r001 should be 99 and 147, respectively. Sorry for not mentioning this previously-- I hadn't finished working all the way through the spec.

jmarshall added a commit that referenced this issue Apr 3, 2014
Fix r001's flags (hat tip @arlin, further fixes #26), r003's flags,
and the header VN.  Add r001/2's sequence mismatch as introduced
in 80bc68f and c8c0a44.
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

No branches or pull requests

2 participants