How to specifiy colors for polygon links when using circos function of OmicCircos package
1
0
Entering edit mode
wei.shen • 0
@weishen-7396
Last seen 9.2 years ago
United States

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, mapping=link.pg.v, type="link.pg", lwd=2, col=colors)

Thank you very much. 

graph omiccircos • 1.9k views
ADD COMMENT
0
Entering edit mode
@hu-ying-nihnci-e-6375
Last seen 8.1 years ago
United States

The issue is fixed in the updated package. 

rm(list=ls());

library(OmicCircos);
options(stringsAsFactors = FALSE);

set.seed(1234);
## 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 link.pg
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="link.pg",  lwd=2, col=col2[c(1,7,9)]);

dev.off();

ADD COMMENT
0
Entering edit mode

In your code above 

circos(R=150, cir="hg19", W=10, mapping=fus.d, type="link.pg",  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. 

Thanks!

ADD REPLY

Login before adding your answer.

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