Entering edit mode
4.8 years ago
evelyn
▴
230
Can samtools depth
be used for finding out sequence depths for individual sorted bam
files? I am not trying to get one value for all the files altogether.
samtools depth ls sorted.bam | awk '{sum+=$3} END { print "Average = ",sum/NR}' > log.txt
I want output (log.txt)
as:
File name Average
1sorted.bam --
2sorted.bam --
Thanks @Pierre! However, option
-H
does not work for me. When I tried running without-H
, it gives the output asIt does not show file names instead it shows 0 and 1.
you version of samtools is too old. http://www.htslib.org/doc/samtools.html
I am using
samtools/1.9
which version of samtools has
-H
for depth? I am still gettingdepth: invalid option -- 'H'
https://github.com/samtools/samtools/blob/develop/bam2depth.c#L84
Thanks, I am new to bioinformatics and I am having some trouble installing this code. I am using mac.
Use conda https://anaconda.org/bioconda/samtools