26
Circos: Circos Plot with R Henry Zhang, Ph.D. [email protected] Genetics Branch Center for Cancer Research National Cancer Institute

Circos: Circos Plot with R

  • Upload
    lamis

  • View
    396

  • Download
    1

Embed Size (px)

DESCRIPTION

Circos: Circos Plot with R. Henry Zhang, Ph.D. [email protected] Genetics Branch Center for Cancer Research National Cancer Institute. http://Circos.ca. Circos has been used and referenced in many scientific publications (501 as of October 2013). - PowerPoint PPT Presentation

Citation preview

Page 1: Circos:  Circos Plot with R

Circos: Circos Plot with R

Henry Zhang, [email protected]

Genetics Branch Center for Cancer ResearchNational Cancer Institute

Page 2: Circos:  Circos Plot with R

http://Circos.ca

Circos has been used and referenced in many scientific publications (501 as of October 2013).

Page 3: Circos:  Circos Plot with R

Circos plot of somatic mutations, copy number variations, transcriptome expression, and structural variations. From inside to out, structural variations (purple and orange), copy number variations (gain in dark red, loss in dark blue, mRNA expression (up in gold, down in olive), differentially expressed microRNAs (up in red, down in green), DNA methylation with sky-blue background (up in dark orange, down inchartreuse), somatic mutations with a gene symbols, and chromosomal cytobands.

Kim SC, Jung Y, Park J et al.2013 A high-dimensional, deep-sequencing study of lung adenocarcinoma in female never-smokers PLoS One 8:e55596.

Page 4: Circos:  Circos Plot with R

<<include ideogram.conf>><image><<include etc/image.conf>></image>..

<plots><plot>file = data/6/snp.density.50kb.txtcolor = blackr0 = 1.075rr1 = 1.15r..</plot><plot>file = data/6/snp.number.50kb.txtcolor = blackr0 = 0.85rr1 = 0.95r..</plot></plots>...

hsY 0 49999 0.00804hsY 50000 99999 0.0033hsY 100000 149999 0.0084hsY 150000 199999 0.00316hsY 200000 249999 0.007hsY 250000 299999 0.00466hsY 300000 349999 0.00636hsY 350000 399999 0.00576hsY 400000 449999 0.00678hsY 450000 499999 0.00688

hsY 0 49999 402hsY 50000 99999 165hsY 100000 149999 420hsY 150000 199999 158hsY 200000 249999 350hsY 250000 299999 233hsY 300000 349999 318hsY 350000 399999 288hsY 400000 449999 339hsY 450000 499999 344

> /usr//bin/CIRCOS/circos-0.60/bin/circos -conf mycircos.conf

Circos plot: extra procedures are needed to prepare data files and configure file from dataset(s)

Page 5: Circos:  Circos Plot with R

R Bioconductor package: ggbio

• Requires ggplot2, biovizBase, and GenomicRanges packages• All data are held with GRange object• All plots are wrapped into one function.• Plots are arranged in layers• Parameters must be correctly selected

(Yin, T. et al: Genome Biology 2012, 13:R77)

Page 6: Circos:  Circos Plot with R

layout_circle(data, ..., geom = c("point", "line", "link", "ribbon", "rect", "bar", "segment", "hist", "scale", "heatmap", "ideogram", "text"), linked.to, radius = 10, trackWidth = 5, space.skip = 0.015, direction = c("clockwise", "anticlockwise"), link.fun = function(x, y, n = 30) bezier(x, y, evaluation = n), rect.inter.n = 60, rank, ylim = NULL, scale.n = 60, scale.unit = NULL, scale.type = c("M", "B", "sci"), grid.n = 5, grid.background = "gray70", grid.line = "white", grid = FALSE, chr.weight = NULL)

layout_circle() in ggbio package: a complicated function with some unimplemented plot functionalities

Page 7: Circos:  Circos Plot with R

Availability: http://www.r-project.org

An R package implementing Circos 2D track plot

Implemented in pure R and relies on only R packages that came with R base installation.

Provides a set of graphic functions and each plot type, such as scatter, line, histogram, heatmap, tile, connectors, links (lines and ribbons ), and text (gene) labels, has its own function .

Use R low level R graphics functions only.

Reference: Hongen Zhang, Paul Meltzer and Sean Davis (2013): RCircos: an R package for Circos 2D track plots. BMC Bioinformatics 14:244

Page 8: Circos:  Circos Plot with R

easy to use

Page 9: Circos:  Circos Plot with R

Basic steps to generate an RCircos plot image: 1.Load RCircos library2.Load chromosome cytoband data3.Setup RCircos core components4.Load input data5.Open graphic device6.Call specific plot function to plot each data track (chromosome ideogram, gene names, heatmap, scatter plot, ….)7.Close the graphic device if it is image file

(Graphic device could be R GUI, Tiff, PNG, and PDF files).

easy to use

Page 10: Circos:  Circos Plot with R

supports multiple ideogram data

Page 11: Circos:  Circos Plot with R

Input data format for heatmap, histogram, scatterplot, line plot, gene label, connector, and tile:

Input data format for links:

use data frame for input data

Page 12: Circos:  Circos Plot with R

use data frame for input data

Page 13: Circos:  Circos Plot with R

Mouse and rat chromosome ideograms, heatmaps, and link lines are drawn with RCircos with two input datasets. Title, legend, and color key are added with function

calls of R graphics package.

easy to integrate with other R graphic functions

Page 14: Circos:  Circos Plot with R

RCircos follows the layout paradigm set forth by Circos and arranges data plots by tracks.

The core track is the chromosome ideogram track with highlighting and labels.

Data plot tracks can be placed inside or outside of chromosome ideogram track.

Step 1: decide how many data tracks and where you will plot them

Page 15: Circos:  Circos Plot with R

Plot with all chromosomes:

If plot only some chromosomes:

Step 2: Load cytoband data and setup RCircos core components

Page 16: Circos:  Circos Plot with R

Step 3: modify plot parameter if necessary

Page 17: Circos:  Circos Plot with R

Step 4: load input datasets

Step 5: open graphic device

Types of graphic devices than Rcircos supports: R GUI, files of png, pdf, tiff

png(file="RCircos.Demo.Human.png", height=8, width=8, unit="in", type=“windows", res=300);tiff(file="RCircos.Demo.Human.tif", height=8, width=8, unit="in", type=" windows ", res=300);pdf(file="RCircos.Demo.Human.pdf", height=8, width=8);

(If using image files, graphic device must be closed after plot is done).

RCircos.Set.Plot.Area();

or if you want control the size of plot area

par(mai=c(0.25, 0.25, 0.25, 0.25));plot.new();plot.window(c(-1.5, 1.5), c(-1.5, 1.5));

Page 18: Circos:  Circos Plot with R

Step 6: plot chromosome ideogram and data tracks

RCircos.Gene.Connector.Plot(gene.data, track.num=1, side="in")

RCircos.Chromosome.Ideogram.Plot()

RCircos.Gene.Name.Plot(gene.data, Name.col=4, track.num=2, side="in")

RCircos.Heatmap.Plot(heatmap.data, data.col=6, track.num=5, side="in")

RCircos.Histogram.Plot(hist.data, data.col=4, track.num=6, side="in")

RCircos.Line.Plot(line.data, data.col= 4, track.num=7, side="in")

RCircos.Scatter.Plot(scatter.data, data.col=5, Track.num=8, side="in", by.fold=1)

RCircos.Tile.Plot(tile.data, track.num=9, side="in")

RCircos.Link.Plot(link.data, track.num=11, by.chromosome=FALSE);

RCircos.Ribbon.Plot(ribbon.data, track.num =10, by.chromosome=FALSE, twist =FALSE)

Page 19: Circos:  Circos Plot with R

chr.ideog.pos

highlight.pos

chr.name.postrack.in.start

track.out.start

chrom.width

track.padding

track.height

RCircos core component: RCircos plot parameters

chrom.paddings

Page 20: Circos:  Circos Plot with R

RCircos core component: RCircos plot positions

Page 21: Circos:  Circos Plot with R

RCircos core component: RCircos plot ideograms

Page 22: Circos:  Circos Plot with R

Customizing heatmap plot colors

Page 23: Circos:  Circos Plot with R

Customizing other plot colors by appendingA column of color names to input dataset

Page 24: Circos:  Circos Plot with R

Add more decorations

Page 25: Circos:  Circos Plot with R

Adjust plot range

Page 26: Circos:  Circos Plot with R