Question: How to specifiy colors for polygon links when using circos function of OmicCircos package
gravatar for wei.shen
2.6 years ago by
United States
wei.shen0 wrote:

Can one specify colors for each the polygon link using circos function in OmicCircos package? I tried to re-define the "col" argument in the circos function in the example provided in the section "4.1 basic plotting" of the vignette (please see the code line below), but it does not appear to do anything. Would you please offer any advice on this matter? 

> circos(R=150, cir=db, W=40,, type="", lwd=2, col=colors)

Thank you very much. 

ADD COMMENTlink modified 2.6 years ago by Hu, Ying NIH/NCI [E]50 • written 2.6 years ago by wei.shen0
gravatar for Hu, Ying NIH/NCI [E]
2.6 years ago by
United States
Hu, Ying NIH/NCI [E]50 wrote:

The issue is fixed in the updated package. 


options(stringsAsFactors = FALSE);

## get chromosome information
data("UCSC.hg19.chr", package="OmicCircos");
ref     <- UCSC.hg19.chr;
ref[,1] <- gsub("chr", "", ref[,1]);

## initial values
cols   <- rainbow(10, alpha=0.8);
lab.n  <- 50;
cnv.n  <- 200;
arc.n  <- 30;
fus.n  <- 10;

## make arc data
arc.d <- c();
for (i in 1:arc.n){
  chr     <- sample(1:19, 1);
  chr.i   <- which(ref[,1]==chr);
  chr.arc <- ref[chr.i,];
  arc.i   <- sample(1:nrow(chr.arc), 2);
  if (arc.i[1] > arc.i[2]){
    arc.i <- arc.i[c(2,1)];
  arc.d   <- rbind(arc.d, c(chr.arc[arc.i[1],c(1,2)], chr.arc[arc.i[2],c(2,4)]));
colnames(arc.d) <- c("chr", "start", "end", "value");

## make fusion for
fus.d <- c();
for (i in 1:fus.n){
  fus.i <- sample(1:nrow(arc.d), 2);
  fus.d <- rbind(fus.d, c(arc.d[fus.i[1],c(1:3)], arc.d[fus.i[2],c(1:3)]));
colnames(fus.d) <- c("chr1", "po1.1", "p1.2", "chr2", "po2.1", "po2.2");

cnv.i <- sample(1:nrow(ref), cnv.n);
vale  <- rnorm(cnv.n);
cnv.d <- data.frame(ref[cnv.i,c(1,2)], value=vale);

pdffile  <- "2015_02_24.pdf";
pdf(pdffile, 8, 8);
par(mar=c(2, 2, 2, 2));
plot(c(1,800), c(1,800), type="n", axes=F, xlab="", ylab="");

circos(R=400, type="chr", cir="hg19", print.chr.lab=T, W=4, scale=T);
circos(R=340, cir="hg19", W=60, mapping=cnv.d, type="b3", B=T, col=cols[7]);
circos(R=340, cir="hg19", W=60, mapping=cnv.d, type="s2", B=F, col=cols[1], cex=0.5);
circos(R=280, cir="hg19", W=60, mapping=arc.d, type="arc2", B=F, col=cols, lwd=10, cutoff=0);
circos(R=220, cir="hg19", W=60, mapping=cnv.d, col.v=3, type="b2", B=T, cutoff=-0.2, col=cols[c(7,9)], lwd=2);
circos(R=160, cir="hg19", W=60, mapping=arc.d, col.v=4, type="arc",  B=F, col=cols[c(1,7)], lwd=4, scale=T);

col2  <- rainbow(10, alpha=0.5);
circos(R=150, cir="hg19", W=10, mapping=fus.d, type="",  lwd=2, col=col2[c(1,7,9)]);;

ADD COMMENTlink written 2.6 years ago by Hu, Ying NIH/NCI [E]50

In your code above 

circos(R=150, cir="hg19", W=10, mapping=fus.d, type="",  lwd=2, col=col2[c(1,7,9)]);

If type is changed to "link", then the link lines are all colored the same color (aqua). Setting the col parameter doesn't do anything. 


ADD REPLYlink written 22 months ago by abmadrid0
Please log in to add an answer.


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