This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plotting the X chromosome using the zoom function

Using the zoom function in OmicCircos, I am trying to plot the gene expression for the X chromosome.

#insert chromosome X
zoom <- c(X, X, 939245.5, 154143883, 343.7, 376.7);
# insert circos
circos(R=350, cir="hg19", W=4,   type="chr", print.chr.lab=T, scale=T, zoom=zoom);
circos(R=120, cir="hg19", W=263, mapping=gene.sample,  col.v=4,  type="heatmap2", col.bar=F, lwd=1, zoom=zoom);
circos(R=370, cir="hg18", W=15,  mapping=gene.sample, type="label", side="out", col="black", zoom=zoom);

But I am getting the error:

Error in chr1:chr2 : argument of length 0

I would be grateful if someone could explain why this is only happening for the X chromosome and not for chromosomes 1-22.

Thanks.

omiccircos gene-set-enrichment gene-expression

1 answer

Please have a look at the code (The output file is at https://www.dropbox.com/s/qyo3oupjzwqs3ka/BioStars01.pdf?dl=0):

rm(list=ls());
library(OmicCircos);

data("UCSC.mm9.chr");
chrX.i <- which(UCSC.mm9.chr[,1]=="chrX");
chrX   <- UCSC.mm9.chr[chrX.i,];

## segment data of chromosome X
seg.c   <- segAnglePo(chrX, seg="chrX");

gene.n  <- 200; 
po      <- sample(1:max(chrX[,2]), gene.n)
val     <- rnorm(gene.n);
map.d   <- data.frame(chr=rep("chrX", gene.n), po=po, value=val);

cols    <- rainbow(10, alpha=0.8);

pdf("BioStars01.pdf", 8,8);
par(mar=c(2, 2, 2, 2))
plot(c(1,800), c(1,800), type="n", axes=FALSE, xlab="", ylab="");

circos(R=350, type="chr2", cir=seg.c, mapping=chrX, print.chr.lab=TRUE, W=4, scale=T);
circos(R=270, cir=seg.c, W=80, mapping=map.d, type="s", col.v=3, col=cols, B=T, cex=abs(map.d[,3])*1.5);
circos(R=190, cir=seg.c, W=80, mapping=map.d, type="b", col.v=3, col=cols, B=F, lwd=abs(map.d[,3])*1.5);
circos(R=110, cir=seg.c, W=80, mapping=map.d, type="b2", col.v=3, col=cols[c(1,7)], cutoff=0, B=T, lwd=2);

dev.off();

Log in to answer this question.