This is a test version of Biostars. For the public version, visit https://www.biostars.org.
calculate per base depth and q30 reads from bam using a bed

Using samtools 1.9 to calculate overall read depth per base of targets in a bed then reads at q30 in a bam. Is there a way to combine these or a tool/script that will do this more optimally to produce the final output? Thank you :).

samtools depth -a -b <bed> -aa <bam>
samtools depth -q 30 -a -b <bed> <bam>

bed

chr10   8097600 80976   xxx_AGRN.1_1    0   +   AGRN
chr10   8097580 8097680 xxx_AGRN_1  0   +   AGRN
chr10   8097580 8097700 xxx_AGRN_2  0   +   AGRN

current out command one

chr10   8097609 247
chr10   8097610 256
chr10   8097611 258

current out command two

chr10   8097609 196
chr10   8097610 228
chr10   8097611 245

then I merge the two with awk to get the overall reads per base in target matched with the q30, and gene (final output)

chr10   8097609 247 196 AGRN
chr10   8097610 256 228 AGRN
chr10   8097611 258 245 AGRN
samtools depth and q30

0 answers

No answers yet.

Log in to answer this question.