Circos Histogram Bam File
2
6
Entering edit mode
12.3 years ago
Sander Timmer ▴ 710

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 • 13k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
7
Entering edit mode
12.3 years ago
dfornika ★ 1.1k

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)
ADD COMMENT
2
Entering edit mode

For the middle section, you can use bedmap module from bedops suite (https://bedops.readthedocs.org/en/latest/content/reference/statistics/bedmap.html) with --sum flag. You will need to make a bed file defining your windows in downsampling step as your mapfile, though. Hope this helps.

ADD REPLY
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
1
Entering edit mode

for the middle portion, one can use -bg option from bedtools genomecov program

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
12.3 years ago
kristen.dang ▴ 10

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.

ADD COMMENT

Login before adding your answer.

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