Question: sorted bam file
0
gravatar for evelyn
11 days ago by
evelyn30
evelyn30 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 • 128 views
ADD COMMENTlink modified 11 days ago by ATpoint19k • written 11 days ago by evelyn30

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 days ago by WouterDeCoster40k
1
gravatar for ATpoint
11 days ago by
ATpoint19k
Germany
ATpoint19k 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 days ago • written 11 days ago by ATpoint19k

I want to calculate the sequencing depth.

ADD REPLYlink modified 2 days ago • written 10 days ago by evelyn30
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: 933 users visited in the last hour