This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Generating Consensus File With Samtools

Hi!

I tried to create a fastq consensus file out of my bam file generated with Mosaik (MosaikText). I used the Samtools pileup command, as followed:

$ samtools pileup -cf reference_genome.fa alignement.bam ! samtools.pl pileup2fq -D100 > consensus_sequence.fastq

I was expecting to get this :

@chrX
nnnnnnnatgtttgcctgtacacacacactgtaaannnnnnnnnnnnnnnnnn
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
agttctatgtcatgtactagtagggtactatatatnnnnnnnnnnnnnnnnnn
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
@chr1
nnnnnnnatgtttgcctgtacacacacactgtaaannnnnnnnnnnnnnnnnn
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
agttctatgtcatgtactagtagggtactatatatnnnnnnnnnnnnnnnnnn
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
@chr2 etc.

But I get this :

@chrX
nnngtnnnnnnctnnnnnnnannnnnnnnnnngnnnnnnncngnnnnnnnnan
nnnnnnnntgnnnnnnnnnnnnnnnnnnnnnnnnnnnnnannnnnnnnnnnnn
nannnnnnctnnnnnnnnnnnnngnnnnnnnnnnntnnnnnnnnnnnnnnnnn
@chr1
nnngtnnnnnnctnnnnnnnannnnnnnnnnngnnnnnnncngnnnnnnnnan
nnnnnnnntgnnnnnnnnnnnnnnnnnnnnnnnnnnnnnannnnnnnnnnnnn
nannnnnnctnnnnnnnnnnnnngnnnnnnnnnnntnnnnnnnnnnnnnnnnn
@chr2 etc.

I really don't know what happened! Any suggestions? Do somebody has maybe another solution to generate such a consensus file?

Thanks à lot! Lena

consensus samtools pileup fastq

Generate the intermediate raw pileup file and see how it looks....based on that you can see the read coverage and then you can expect the consensus sequence.

can you show the the pileup file for the same to look in to it...

1 answer

You seem to be using a bang (!) instead of a pipe (|) in your command. In most shells, ! executes a previous command from the history, so ! samtools ... will execute the last command that started with the string samtools.

However, as written, your command should give you no result at all (plus some other error messages), so I'm not sure how you got your output.

Hi!

Actually, I used a pipe (|) but could not write this character in my question because I was using a mac keyboard this morning (not all character available), which is why I used the closest one I found : ! ... sorry!!

Do you have another idea?

Thanks already a lot for your answer!

Lena

Log in to answer this question.