This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Restriction in read name length

Hi all,

Does anybody know if there is a restriction for a read name length (say up to 10k characters)? Have you ever experienced that any software (like samtools, bwa, STAR, etc) complains about long read names?

Thanks

read name

Please define long. 100 characters, 10000 characters?

I am writing a pipeline, where there is a read simulation step, and I want to include some information in the read name, like chr name (which can be long in some cases), coordinates, strand etc.

1 answer

in htslib / sam.h https://github.com/samtools/htslib/blob/develop/htslib/sam.h

the read name is coded by

/* @field  l_qname length of the query name */
 uint8_t l_qname;

which is an unsigned byte. So the read name shouldn't be longer than 2^8=256.

it's even shorter in the read-sam method:

https://github.com/samtools/htslib/blob/f2150106bafda80ccd97970637091bb2799bc426/sam.c#L1305

 _parse_err(p - q > 252, "query name too long");

Log in to answer this question.