Question: Circos Histogram Bam File
6
gravatar for Sander Timmer
6.8 years ago by
Sander Timmer700
United Kingdom
Sander Timmer700 wrote:

I've a BAM that I'd like to show its coverage off in a circos plot (http://circos.ca/documentation/tutorials/2d_tracks/histograms/images)

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

bam • 7.6k views
ADD COMMENTlink modified 4.6 years ago by Biostar ♦♦ 20 • written 6.8 years ago by Sander Timmer700
7
gravatar for dfornika
6.8 years ago by
dfornika1000
Vancouver, British Columbia, Canada
dfornika1000 wrote:

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 COMMENTlink modified 6.8 years ago • written 6.8 years ago by dfornika1000
2

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 REPLYlink written 5.2 years ago by Noushin N550
1

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

ADD REPLYlink written 6.8 years ago by Sander Timmer700
1

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 REPLYlink written 6.8 years ago by dfornika1000
1

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

ADD REPLYlink written 3.7 years ago by Prakki Rama2.2k

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

ADD REPLYlink written 4.2 years ago by Andreas2.4k
0
gravatar for kristen.dang
6.8 years ago by
kristen.dang10
kristen.dang10 wrote:

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 COMMENTlink written 6.8 years ago by kristen.dang10
0
gravatar for archie
5.2 years ago by
archie70
India
archie70 wrote:

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

ADD COMMENTlink modified 5.2 years ago • written 5.2 years ago by archie70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1151 users visited in the last hour