Trying to calculate the average depth of a .bam file: Any ideas?
Essentialy I just want to get the ....X coverage.
Thank you .
EDIT: I also tried the below to calculate the genome of the .bam for 'NR', but it says samtools command not found.
= 3095693981
Essentialy I just want to get the ....X coverage.
Code:
samtools depth IonXpress_001.bam | awk '{sum+=$3} END { print "Average = ",sum/NR}' > output.txt -bash: samtools: command not found awk: cmd. line:1: fatal: division by zero attempted
EDIT: I also tried the below to calculate the genome of the .bam for 'NR', but it says samtools command not found.
Code:
./samtools view -H IonXpress_001.bam | grep -P '^@SQ' | cut -f 3 -d ':' | awk '{sum+=$1} END {print sum}'
Comment