determining read depth for every position in a sequence
2
0
Entering edit mode
8.1 years ago
blur ▴ 280

I am trying to create a table for a specific sequence, about 1900bp long and have for each nucleotide the read depth achieved by sequencing. I saw you can check read depth by:

samtools view file.bam chr 1:100-500 | wc

but that would require 1900 commands (not good...) I am sure that there is a smarter way to do this - can anyone offer any help? Thanks!

RNA samtools read depth • 3.7k views
ADD COMMENT
2
Entering edit mode
8.1 years ago
Medhat 9.8k

you should use genomeCoverageBed from bedtools

bedtools genomecov computes histograms (default), per-base reports (-d) and BEDGRAPH (-bg) summaries of feature coverage (e.g., aligned sequences) for a given genome.

that is I think exactly what you need

ADD COMMENT
2
Entering edit mode
8.1 years ago
Ron ★ 1.2k

From samtools:

samtools depth input.bam >input.coverage

Refer to this post:

How to plot coverage and depth statistics of a bam file

ADD COMMENT
0
Entering edit mode

super! worked like a charm!

ADD REPLY

Login before adding your answer.

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