This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to extract per base information (in coverage track of IGV) from .bam file

I would like to get coverage information per bases from the .bam file. But I don't know how to do it. I use IGV to visualize "sorted. Bam" file. When I put the mouse on any base at coverage track, I can see, for example, "Chr 10:150669 Total count:7 A:0 C:6 G:0 T:1 N:0 " through the example, I can know how many counts per base and what are they. But I don't know how I can export this data? I have tried Igvtools(count) with GUI, and then I got a .wig file which has two columns, one is the base position(like, chr1:112234), another is total counts. However, it 's not enough; I still need the details about how many A, G, T, C respectively. Would you kindly tell me how to do it? I will appreciate it.

rna-seq igvtools

2 answers

  1. Download IGVtools from here: https://software.broadinstitute.org/software/igv/download
  2. Extract IGVtools in folder of your choice
  3. sh /<path to="" igvtools="">/igvtools count -w 1 --bases input.bam output.wig hg38

wig file is tsv file.

reference: https://digibio.blogspot.com/2014/07/calculate-coverage-from-bam-files-using.html

Thank you very much for your help. It did work. I had tried the command above "sh igv count -w --bases myinput.file." In the beginning, everything is going well. "loading genome: home/igv/genome.hg38.genome; -> Genome loaded. id = hg38; -> Listen on port 60151" But It didn't change anymore. The progress stops at "listen on port 60151". I am trying to figure it out. Thanks again.

You could maybe do this with samtools mpileup

The mpileup command gets you most of the way there and then a small script can count number of "A","G","T","C" at each position Coverage In Bam File - Bases And Overall Count

Log in to answer this question.