This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Circos Histogram Bam File

I've a BAM that I'd like to show its coverage off in a circos plot

Is there a standardised way of going from a BAM file towards such a histogram in circos?

bam

I checked galaxy for circos , but not getting respective link ... pls share it ..

2 answers

Start by generating a .pileup file with:

samtools mpileup -f your_reference.fa your_bamfile.bam > your_pileup.pileup

Then extract the chromosome , coordinates, and coverage fields with:

cut -f 1,2,4 your_pileup.pileup > coverage_file.txt

Then I'd imagine you will need to do some sort of downsampling before you load this in circos, because you likely won't have the resolution to show coverage for every base in your dataset. Someone else will have to help out with that step. Maybe take an average of every 100kb? That would take 3 billion points down to a reasonable 30,000 points.

The input for circos needs to be of the form:

chromosome start end coverage

So something like

chr1 1 100000 200
chr1 100001 200000 350
chr1 200001 300000 485
...

Then import into circos by adding something like this to your circos.conf:

(plot)
file = data/coverage_file.txt
type = histogram
r0 = ?r
r1 = ?r
min= 0
max= ?
orientation = out
...
(rules)
(/rules)
(/plot)

Great, thanks a lot this is exactly what I was looking for!

You're welcome, sorry I couldn't give more specific instructions for that middle section, but hopefully you'll find some way to automate it.

Note that samtools mpileup has a default coverage cap at 800 (I think)

If I heard correctly, I believe Jeremy Goecks announced at ISMB that circos visualizations have been/are being added as a new feature of Galaxy/Trackster. I haven't checked it out but it sounds like a good option compared to doing it directly through circos. I've used circos a bit and it is not easy.

Log in to answer this question.