Circos plots - DR-genomics/Genomics-pipelines GitHub Wiki
Create windows - genome file
bedtools makewindows -g ../M.vimineum.hirise.unmasked.sizes -w 1000000 -s 200000 > ../M.vimineum.hirise.unmasked.1MBwindow.step
Obtain gene/TE densities across the genome using bedtools coverage
bedtools coverage -a ../M.vimineum.hirise.unmasked.1MBwindow.step -b M.vim.gene.sorted.bed > M.vim.gene.dens.1mb
bedtools coverage -a ../M.vimineum.hirise.unmasked.1MBwindow.step -b ../../EDTA_default/M.vimineum.hirise.unmasked.fasta.mod.EDTA.final/TE_dist/M.vim.Gypsy.coord > M.vim.gyp.dens.1mb
bedtools coverage -a ../M.vimineum.hirise.unmasked.1MBwindow.step -b ../../EDTA_default/M.vimineum.hirise.unmasked.fasta.mod.EDTA.final/TE_dist/M.vim.Copia.coord > M.vim.cop.dens.1mb
To plot the gene densities using circos, tweak the above file in a required format. To plot a histogram of gene densities in circos, the input format requires 4 columns: Chr#, start, end, a value. Extract the first four column from the above output file (gene density) using awk
awk '{print $1"\t"$2"\t"$3"\t"$4}' M.vim.gene.dens.1mb > /usr/local/src/circos-0.69-9/csb2017/circos/exercise/M.vim.gene.dens.counts.1mb # I am copying the output to a folder (which I am currently using) within the circos package.
Now, to plot anything in circos, we need to create a chromosome file in a specific circos format ( a tab separated file => chr - ID LABEL START END COLOR). Within the working directory(see above) of circos, create a chromosome file as below
cd /usr/local/src/circos-0.69-9/csb2017/circos/exercise/
vi karyotype.js.new.txt
On the blank page of the document opened above, type the following,
chr - Scaffold_1 chr1 0 58957999 black
chr - Scaffold_2 chr2 0 58618279 black
chr - Scaffold_3 chr3 0 47925818 black
chr - Scaffold_4 chr4 0 67717565 black
chr - Scaffold_5 chr5 0 46230532 black
chr - Scaffold_6 chr6 0 68321696 black
chr - Scaffold_7 chr7 0 50536500 black
chr - Scaffold_8 chr8 0 53487048 black
chr - Scaffold_9 chr9 0 53635049 black
chr - Scaffold_10 chr10 0 43887252 black
chr - Scaffold_11 chr11 0 43392746 black
chr - Scaffold_12 chr12 0 41498648 black
chr - Scaffold_13 chr13 0 62378202 black
chr - Scaffold_14 chr14 0 59284269 black
chr - Scaffold_15 chr15 0 53488752 black
chr - Scaffold_16 chr16 0 53044242 black
chr - Scaffold_17 chr17 0 47139981 black
chr - Scaffold_18 chr18 0 46824051 black
chr - Scaffold_19 chr19 0 34755682 black
chr - Scaffold_20 chr20 0 33011866 black
chr - Scaffold_21 chr21 0 32181152 black
chr - Scaffold_22 chr22 0 31503307 black
chr - Scaffold_23 chr23 0 20982032 black
Create a configuration file as below - to display gene and LTR-RT densities along each chromosome in histogram
karyotype = karyotype.js.new.txt
<ideogram>
<spacing>
default = 0.005r
</spacing>
radius = 0.8r
thickness = 20p
fill = yes
show_label = yes
label_font = default
label_radius = dims(ideogram,radius) + 0.150r
label_size = 30
label_parallel = yes
fill_color = dgrey
stroke_thickness = 2p
</ideogram>
track_width = 0.09
track_pad = 0.02
track_start = 0.95
chromosomes_units = 1000000
chromosomes_display_default = yes
<plots>
<plot>
# The type sets the format of the track.
type = histogram
file = M.vim.gene.dens.counts.1mb
# The track is confined within r0/r1 radius limits. When using the
# relative "r" suffix, the values are relative to the position of the
# ideogram.
r1 = 0.99r
r0 = 0.92r
fill_color = dgreen
extend_bin = no
<background>
color = vlgreen
</background>
<axes>
<axis>
spacing = 0.1r
color = lgrey
thickness = 2
</axis>
</axes>
</plot>
<plot>
type = histogram
file = M.vim.gyp.dens.counts.1mb
r1 = 0.88r
r0 = 0.81r
fill_color = red
extend_bin =no
<background>
color = vlred
</background>
<axes>
<axis>
spacing = 0.1r
color = lgrey
thickness = 2
</axis>
</axes>
</plot>
<plot>
type = histogram
file = M.vim.cop.dens.counts.1mb
r1 = 0.77r
r0 = 0.70r
fill_color = blue
extend_bin = no
<background>
color = vlblue
</background>
<axes>
<axis>
spacing = 0.1r
color = lgrey
thickness = 2
</axis>
</axes>
</plot>
</plots>
################################################################
# The remaining content is standard and required. It is imported
# from default files in the Circos distribution.
#
# These should be present in every Circos configuration file and
# overridden as required. To see the content of these files,
# look in etc/ in the Circos distribution.
<image>
# Included from Circos distribution.
<<include etc/image.conf>>
</image>
# RGB/HSV color definitions, color lists, location of fonts, fill patterns.
# Included from Circos distribution.
<<include etc/colors_fonts_patterns.conf>>
#<<include etc/colors.brewer.conf>>
# Debugging, I/O an dother system parameters
# Included from Circos distribution.
<<include etc/housekeeping.conf>>
<<include etc/ticks1.conf>>