BAM file read stats (A/T/C/G/ins/del) for each base position
2
1
Entering edit mode
7 months ago
herrenc ▴ 20

Hi all,

I have a bunch of Oxford Nanopore reads with a reference fasta. Wondering if anyone knows of any software / packages that would create some kind of csv or txt file that takes each base position in the reference sequence and determines how many A/T/G/C/del/ins etc for each read that covers the base. Looking for something like what JBrowse / IGV provides when you hover over a base, but for every base in the reference sequence and compiled in a txt or csv file that could be used to plot on a graph.

enter image description here

Already looked into samtools / vcftools / bbmap / alfred etc. but could be missing something in those. Appreciate any guidance!

SAM BAM Nanopore JBrowse • 661 views
ADD COMMENT
4
Entering edit mode
7 months ago
Dave Carlson ★ 1.7k

I've used perbase for this in the past:

https://github.com/sstadick/perbase

ADD COMMENT
1
Entering edit mode

Dave - thank you so much!!! This is exactly what I was looking for. You rock!!

ADD REPLY
0
Entering edit mode

I had to spend a while searching for this excellent tool some time ago, so I'm happy to share that information!

ADD REPLY
1
Entering edit mode
7 months ago
samtools mpileup in.bam --fasta-ref ref.fa  |\
awk '{gsub(/[,\.]/,$3,$5);$5=toupper($5);A=$5;T=$5;C=$5;T=$5;print $1,$2,gsub(/[A]/,"",A),gsub(/[C]/,"",C),gsub(/[G]/,"",G),gsub(/[T]/,"",T);}' 
ADD COMMENT

Login before adding your answer.

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