This is a test version of Biostars. For the public version, visit https://www.biostars.org.
samtools mpileup: how to output qname (read id) along with other information

Dear All,

I use samtools mpileup as following

samtools mpileup -O -r chr1:10915996-10915996 E13VA.clip.bam

[mpileup] 1 samples in 1 input files
<mpileup> Set max per-file depth to 8000
chr1    10915996    N    4    CCCt    BFFF    95,95,86,79

I want the qname (read id) in the output too as the below example. Are there any options which can tell samtools mpileup to output the qname (read id) as well? for example


[mpileup] 1 samples in 1 input files
<mpileup> Set max per-file depth to 8000
chr1    10915996    N    4    CCCt    BFFF      95,95,86,79    **read01,read02,read03,read04**

In the case, there is no option to do like that. Could anyone please can help me figure out what is the flag (filter out some reads) which samtools mpileup uses to extract these reads? I need the flag for samtools view to extract the same qname (read id) at the same genome position then plug them in with samtools mpileup output with the hope they are in the same order.

samtools view E13VA.clip.bam chr1:10915996-10915996| cut -d$"\t" -f1

Thank you so much for your help.

Any suggestions are more than welcome!

samtools rna-seq snp mpileup

1 answer

instead of mpileup you could use my tool sam2tsv : https://github.com/lindenb/jvarkit/wiki/SAM2Tsv

Many thanks! I will try and return with feedback.

Log in to answer this question.