about xlim() in ggbio and CIRCLE layout
1
0
Entering edit mode
9.3 years ago
Bogdan ★ 1.4k

Dear all,

I would appreciate your help with the CIRCULAR display in GGBIO, by setting up XLIM() :

In a few words, I do have a set of peaks (Granges) on a chromosome (chr21), that I want to display in CIRCULAR format ; however, when I set up xlim() function for a specific gene on chr21, it does not display.

any suggestion would be very appreciated; the R code is below; thank you very much, and happy new year !

-- bogdan

PS : the code that is working is :

library(ggbio)
library(Gviz)
library(BSgenome)
library(Homo.sapiens)

library(GenomicRanges)
library(GenomicFeatures)
library(biovizBase)
library(rtracklayer)

region <- GRanges ("chr21", IRanges(16000000,17000000))

er <- rtracklayer::import("file_BED_peaks", format = "bed")
er_chr <- keepSeqlevels(er,"chr21")

autoplot(er_chr, layout = "circle", aes(fill = seqnames), geom="rect", fill ="red", col = "red" )

ggplot(er_chr) + layout_circle(aes(fill = seqnames), geom = "rect", fill ="red", col = "red" )

PS2 : with XLIM() it does not work :

autoplot(er_chr, layout = "circle", aes(fill = seqnames), geom="rect", fill ="red", col = "red" ) + xlim(region)
ggplot(er_chr) + layout_circle(aes(fill = seqnames), geom = "rect", fill ="red", col = "red" ) + xlim(region)

PS3 : the file ""file_BED_peaks"" is the following (the coordinates are on hg19) :

chr21    16084558    16084790
chr21    16072888    16073120
chr21    16130100    16130332
chr21    16143898    16144130
chr21    16202516    16202748
chr21    16211961    16212193
chr21    16235726    16235958
chr21    16243278    16243510
chr21    16249995    16250227
chr21    16251805    16252037
chr21    16315930    16316162
chr21    16313116    16313348
chr21    16351616    16351848
chr21    16377671    16377903
chr21    16375721    16375953
chr21    16437867    16438099
chr21    16494214    16494446
chr21    16488575    16488807
chr21    16505100    16505332
chr21    16512566    16512798
chr21    16503819    16504051
chr21    16545432    16545664
chr21    16536004    16536236
chr21    16563263    16563495
chr21    16555148    16555380
chr21    16556333    16556565
chr21    16572345    16572577
chr21    16576144    16576376
chr21    16577294    16577526
chr21    16573010    16573242
chr21    16564549    16564781
chr21    16579733    16579965
chr21    16582503    16582735
chr21    16584010    16584242
chr21    16628310    16628542
chr21    16614322    16614554
chr21    16617304    16617536
chr21    16672724    16672956
chr21    16697560    16697792
chr21    16714841    16715073
chr21    16743316    16743548
chr21    16746538    16746770
chr21    16745138    16745370
chr21    16773737    16773969
chr21    16805387    16805619
chr21    16816580    16816812
chr21    16841515    16841747
chr21    16854793    16855025
chr21    16866335    16866567
chr21    16862527    16862759
chr21    16865642    16865874
chr21    16906031    16906263
chr21    16919879    16920111
chr21    16922224    16922456
chr21    16959180    16959412
chr21    16970871    16971103
chr21    16965452    16965684
chr21    16580394    16580626
ggbio • 2.8k views
ADD COMMENT
0
Entering edit mode
8.6 years ago

You need to add a length to the seqinfo object part of gRanges, e.g.

seqinfo(er_chr)=Seqinfo(seqnames= "chr21", seqlengths= 48129895)

The ggbio vignette has examples of how to pull this info from the hg19Ideogram object in biovizBase.

Here's your revised example

er <-  rtracklayer::import("file_BED_peaks", format = "bed")
er_chr <- keepSeqlevels(er,"chr21")
seqinfo(er_chr)=Seqinfo(seqnames=  "chr21", seqlengths= 48129895)
ggplot(er_chr) + layout_circle(aes(fill = seqnames), geom = "rect", fill ="red", col = "red")

I suggest also throwing in an ideogram for context, e.g.

ggplot(er_chr) + layout_circle(aes(fill = seqnames), geom = "rect", fill ="red", col = "red" )  + layout_circle(er_chr, geom = "ideo", fill = "gray70", radius = 7, trackWidth = 3)
ADD COMMENT

Login before adding your answer.

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