This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Meaning of the column of sam file

Hello! Referring to this columns in sam file:

  1. QNAME
  2. FLAG
  3. RNAME
  4. POS
  5. MAPQ
  6. CIGAR
  7. RNEXT
  8. PNEXT
  9. TLEN
  10. SEQ
  11. QUAL

I wanted to ask how to extract the information about end position of the read? Morover if I want to know which strand it is, it will be depend on FLAG? If the FLAG is 16 that mean it is reverse and in the other cases it will be forward?

reads position sam

1 answer

I wanted to ask how to extract the information about end position of the read?

you have to 'walk' over the CIGAR string. C Api For Bam: Iterating Over A Cigar String. https://stackoverflow.com/questions/39710796 , or you can use a tool like "bedtools bamtobed"

If the FLAG is 16 that mean it is reverse and in the other cases it will be forward?

if it's mapped, yes

Thanks for the answer! Why is not enought just to POS add length of SEQ?

Because alignment may contain soft-clipped sequence.

Log in to answer this question.