Question: sorted bam file
0
gravatar for evelyn
11 months ago by
evelyn90
evelyn90 wrote:

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 • 282 views
ADD COMMENTlink modified 11 months ago by ATpoint35k • written 11 months ago by evelyn90

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 REPLYlink written 11 months ago by WouterDeCoster43k
1
gravatar for ATpoint
11 months ago by
ATpoint35k
Germany
ATpoint35k wrote:
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 COMMENTlink modified 11 months ago • written 11 months ago by ATpoint35k

I want to calculate the sequencing depth.

ADD REPLYlink modified 10 months ago • written 10 months ago by evelyn90
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1291 users visited in the last hour