Samtools Depth Can Only Have Stdout?
3
0
Entering edit mode
12.4 years ago
Chris ▴ 40

Hi, everyone! I want to have a look at the depth of each position in my .bam file, so, the samtools used,samtools depth my.bam, but I find I can't get the output parameter, it only output in my Terminal screen. I want a file with whole positions' depth. How can I do it? Thx!

samtools depth-of-coverage output • 5.8k views
ADD COMMENT
2
Entering edit mode
12.4 years ago
Leszek 4.2k

In unix you can redirect stdout to file:

samtools mpileup bam > out.txt
ADD COMMENT
0
Entering edit mode

Thx a lot. So simple, I am really a Novice!!

ADD REPLY
0
Entering edit mode

if you like the answer, accept it with a tick.

ADD REPLY
0
Entering edit mode

Does mpileup and depth have any difference?

ADD REPLY
1
Entering edit mode
12.4 years ago

I suppose you just want to redirect the output of your command into a file. This is not a bioinformatics question, but a UNIX question.

Anyway, you should use the redirection character (>) and your syntax should look like:

samtools_command -andoptions inputfile > outputfile
ADD COMMENT
0
Entering edit mode

Thanks a lot!!!!

ADD REPLY
1
Entering edit mode
12.4 years ago

try to use the pipeline redirection: http://www.codecoffee.com/tipsforlinux/articles2/042.html

samtools depth file.bam > result.txt
ADD COMMENT
0
Entering edit mode

Warm-hearted person!

ADD REPLY

Login before adding your answer.

Traffic: 1039 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6