Question: about XLIM() in ggbi
0
gravatar for Bogdan
4.7 years ago by
Bogdan560
Palo Alto, CA, USA
Bogdan560 wrote:

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 • 705 views
ADD COMMENTlink written 4.7 years ago by Bogdan560
Please log in to add an answer.

Help
Access

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