sorted bam file
1
0
Entering edit mode
4.8 years ago
evelyn ▴ 230

Hi,

I am trying to calculate the sequencing depth for sorted bam files made using bowtie. I am using:

samtools depth bowtie_sorted.bam |  awk '{sum+=$3} END { print "Average = ",sum/NR}'

I have many sorted bam files and I want to calculate the depth for all using one array job rather than calculating for all files individually. Can anyone help writing such an array? Thanks!

next-gen • 727 views
ADD COMMENT
0
Entering edit mode

Your thread is about calculating the depth of bam files. But your title is sorted bam file? Please select a more descriptive title, and use sensible tags.

ADD REPLY
1
Entering edit mode
4.8 years ago
ATpoint 82k
ls *.bam | parallel -j <NumberOfParallelJobs> "samtools flagstat {} > {.}.flagstat"

This gives a complete overview over the number of mapped/unmapped reads etc. Alternatively, index the files and use samtools idxstats followed by summing up the reads of all chromosomes.

ADD COMMENT
0
Entering edit mode

I want to calculate the sequencing depth.

ADD REPLY

Login before adding your answer.

Traffic: 1813 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