This is a test version of Biostars. For the public version, visit https://www.biostars.org.
sam file header, how is @SQ LN calculated?

I would like to understand how the LN values found in the header are calculated. The sam specification says that it is the reference sequence length, but it doesn't seem to match. I have the following in a sam file:

@SQ     SN:I    LN:15072434

but that doesn't match the nucleotide count of the reference sequence:

gunzip -c Caenorhabditis_elegans.WBcel235.dna_rm.chromosome.I.fa.gz | grep -e ^[^\>] | wc -c

returns 15323642

sam

1 answer

found why, I was counting newline characters too

gunzip -c Caenorhabditis_elegans.WBcel235.dna_rm.chromosome.I.fa.gz | grep -e ^[^\>] | tr -d '\n' | wc -c

returns the expected value 15072434

Log in to answer this question.