about XLIM() in ggbi
0
0
Entering edit mode
Bogdan ▴ 670
@bogdan-2367
Last seen 6 months ago
Palo Alto, CA, USA

Dear all, and Tengfei,
 

I would like to plot some interactions as ARCHES within SPECIFIC GENE AREAS (eg NRIP1 :chr21: 15238712 - 15437750) from a file that contains interactions on ALL the chromosomes in the human genome :

please could you advise on how to use the XLIM() function, as all the chromosomes are displayed in the output figure, and not only the NRIP1 area I am interested in. thanks,

-- bogdan

ps: the code I am using is : 

library("ggplot2")
library("GenomicFeatures")
library("ggbio")
library("Gviz")
library("rtracklayer")

#-----uploading GENES------------------------
library(TxDb.Hsapiens.UCSC.

hg18.knownGene)
txdb<-TxDb.Hsapiens.UCSC.hg18.knownGene


# --- To add a region -- namely region X ----

chr <- "chr21"
start <- 15238712 
end <- 15437750

gene_name <- "NRIP1"

region <- GRanges(chr, IRanges(start,end))
gene <- autoplot(txdb, which = region,  color = "blue", fill = "blue", names.expr="tx_name:gene_id")

# ------------ reading the interactions -----------------------

r<-read.delim("FILE_with_ALL_INTERACTIONS",header=TRUE)

rr<-GRanges(seqnames=r$chr,IRanges(r$start,r$end),strand="*",intensity=r$intensity,experiment=r$experiment)
 
rrr <- autoplot(rr,geom="arch",aes(col=experiment,height=intensity,alpha = abs(intensity))) + xlim(region)


# ----------------- plotting these tracks ---------------------------------------------

tracks("genes" = gene, "interactions" = rrr, heights=c(1,6)) + xlim(region) + theme(panel.background = element_rect(fill='transparent'))

ggbio • 1.1k views
ADD COMMENT

Login before adding your answer.

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