ggbio : misplaced tracks in a test case
1
0
Entering edit mode
@abhishek-pratap-5083
Last seen 9.6 years ago
I am trying to run a test case in ggbio(based on example in a vignette) and seem to be running into an odd case where a feature is misplaced on the graph. working Example below In the plot I see the variation(rectangle) is misplaced. I see it on chr3 whereas it should be on chr1. plot also attached library(ggbio) data(hg19Ideogram, package = "biovizBase") ## subset_chr chr.sub <- paste("chr", 1:3, sep = "") new.names <- as.character(1:3) names(new.names) <- paste("chr",new.names,sep="") hg19Ideo <- hg19Ideogram hg19Ideo <- keepSeqlevels(hg19Ideogram,chr.sub) hg19Ideo <- renameSeqlevels(hg19Ideo,new.names) p <- ggplot() + layout_circle(hg19Ideo,geom="ideo",fill="gray70",radius=30,trackWidth= 4) #adding the scale track p <- p + layout_circle(hg19Ideo,geom="scale",fill="gray70",size=4,radius=35,tra ckWidth=2) #adding the text track p <- p + layout_circle(hg19Ideo,geom="text",aes(label=seqnames),vjust=0,radius= 39,trackWidth=7,size=6) #testing : placing a rect for a dummy variation test_gr <- GRanges('1',IRanges(start=3000,width=1)) #adding the mutant track p <- p + layout_circle(test_gr,geom="rect",color="steelblue",radius=23,trackWid th=6) p Thanks! -Abhi > sessionInfo()R version 2.15.2 (2012-10-26) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] biovizBase_1.6.2 rtracklayer_1.18.2 ggbio_1.6.4 ggplot2_0.9.3 [5] GenomicRanges_1.10.5 IRanges_1.16.3 BiocGenerics_0.4.0 -------------- next part -------------- A non-text attachment was scrubbed... Name: test_ggbio_case.png Type: image/png Size: 44462 bytes Desc: not available URL: <https: stat.ethz.ch="" pipermail="" bioconductor="" attachments="" 20130110="" 03b43013="" attachment.png="">
• 1.2k views
ADD COMMENT
0
Entering edit mode
Tengfei Yin ▴ 420
@tengfei-yin-4323
Last seen 7.9 years ago
Hi Abhi, You raised an important point that users need to pay attention to when they construct circular view: 1. All the data you added on the same circular view, have to have exactly the same seqlevels and seqlengths. 2. They have to have lengths information for each chromosome, otherwise, length is estimated from the data, and it's not accurate in most cases. it's easy to check when you print the data hg19ideo test_gr So in your case, your test_gr's seqlevels is just 1 with seqlengths NA, which is not consistency with hg19ideo. So you have to do something similar to this seqlevels(test_gr) <- seqlevels(hg19Ideo) seqlengths(test_gr) <- seqlengths(hg19Ideo) or do it when you construct the test_gr object. this will solve the misalignment problem. HTH Tengfei On Thu, Jan 10, 2013 at 4:01 PM, Abhishek Pratap <apratap@lbl.gov> wrote: > I am trying to run a test case in ggbio(based on example in a vignette) and > seem to be running into an odd case where a feature is misplaced on the > graph. working Example below > > In the plot I see the variation(rectangle) is misplaced. I see it on chr3 > whereas it should be on chr1. plot also attached > > > library(ggbio) > data(hg19Ideogram, package = "biovizBase") > ## subset_chr > chr.sub <- paste("chr", 1:3, sep = "") > new.names <- as.character(1:3) > names(new.names) <- paste("chr",new.names,sep="") > hg19Ideo <- hg19Ideogram > hg19Ideo <- keepSeqlevels(hg19Ideogram,chr.sub) > hg19Ideo <- renameSeqlevels(hg19Ideo,new.names) > > > p <- ggplot() + > layout_circle(hg19Ideo,geom="ideo",fill="gray70",radius=30,trackWidt h=4) > #adding the scale track > p <- p + > > layout_circle(hg19Ideo,geom="scale",fill="gray70",size=4,radius=35,t rackWidth=2) > #adding the text track > p <- p + > > layout_circle(hg19Ideo,geom="text",aes(label=seqnames),vjust=0,radiu s=39,trackWidth=7,size=6) > > > #testing : placing a rect for a dummy variation > test_gr <- GRanges('1',IRanges(start=3000,width=1)) > > #adding the mutant track > p <- p + > layout_circle(test_gr,geom="rect",color="steelblue",radius=23,trackW idth=6) > p > > > > > Thanks! > -Abhi > > > > > > sessionInfo()R version 2.15.2 (2012-10-26) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > LC_TIME=en_US.UTF-8 > [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 > LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=C LC_NAME=C > LC_ADDRESS=C > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 > LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] biovizBase_1.6.2 rtracklayer_1.18.2 ggbio_1.6.4 > ggplot2_0.9.3 > [5] GenomicRanges_1.10.5 IRanges_1.16.3 BiocGenerics_0.4.0 > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Tengfei Yin MCDB PhD student 1620 Howe Hall, 2274, Iowa State University Ames, IA,50011-2274 [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
On Thu, Jan 10, 2013 at 2:13 PM, Tengfei Yin <yintengfei@gmail.com> wrote: > Hi Abhi, > > You raised an important point that users need to pay attention to when they > construct circular view: > > 1. All the data you added on the same circular view, have to have exactly > the same seqlevels and seqlengths. > 2. They have to have lengths information for each chromosome, otherwise, > length is estimated from the data, and it's not accurate in most cases. > > it's easy to check when you print the data > hg19ideo > test_gr > > So in your case, your test_gr's seqlevels is just 1 with seqlengths NA, > which is not consistency with hg19ideo. So you have to do something similar > to this > > seqlevels(test_gr) <- seqlevels(hg19Ideo) > seqlengths(test_gr) <- seqlengths(hg19Ideo) > > probably easier to do this all at once with seqinfo<-. > or do it when you construct the test_gr object. > > this will solve the misalignment problem. > > HTH > > Tengfei > > On Thu, Jan 10, 2013 at 4:01 PM, Abhishek Pratap <apratap@lbl.gov> wrote: > > > I am trying to run a test case in ggbio(based on example in a vignette) > and > > seem to be running into an odd case where a feature is misplaced on the > > graph. working Example below > > > > In the plot I see the variation(rectangle) is misplaced. I see it on chr3 > > whereas it should be on chr1. plot also attached > > > > > > library(ggbio) > > data(hg19Ideogram, package = "biovizBase") > > ## subset_chr > > chr.sub <- paste("chr", 1:3, sep = "") > > new.names <- as.character(1:3) > > names(new.names) <- paste("chr",new.names,sep="") > > hg19Ideo <- hg19Ideogram > > hg19Ideo <- keepSeqlevels(hg19Ideogram,chr.sub) > > hg19Ideo <- renameSeqlevels(hg19Ideo,new.names) > > > > > > p <- ggplot() + > > layout_circle(hg19Ideo,geom="ideo",fill="gray70",radius=30,trackWi dth=4) > > #adding the scale track > > p <- p + > > > > > layout_circle(hg19Ideo,geom="scale",fill="gray70",size=4,radius=35,t rackWidth=2) > > #adding the text track > > p <- p + > > > > > layout_circle(hg19Ideo,geom="text",aes(label=seqnames),vjust=0,radiu s=39,trackWidth=7,size=6) > > > > > > #testing : placing a rect for a dummy variation > > test_gr <- GRanges('1',IRanges(start=3000,width=1)) > > > > #adding the mutant track > > p <- p + > > > layout_circle(test_gr,geom="rect",color="steelblue",radius=23,trackW idth=6) > > p > > > > > > > > > > Thanks! > > -Abhi > > > > > > > > > > > sessionInfo()R version 2.15.2 (2012-10-26) > > Platform: x86_64-pc-linux-gnu (64-bit) > > > > locale: > > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > > LC_TIME=en_US.UTF-8 > > [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 > > LC_MESSAGES=en_US.UTF-8 > > [7] LC_PAPER=C LC_NAME=C > > LC_ADDRESS=C > > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 > > LC_IDENTIFICATION=C > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] biovizBase_1.6.2 rtracklayer_1.18.2 ggbio_1.6.4 > > ggplot2_0.9.3 > > [5] GenomicRanges_1.10.5 IRanges_1.16.3 BiocGenerics_0.4.0 > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor@r-project.org > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: > > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > > > -- > Tengfei Yin > MCDB PhD student > 1620 Howe Hall, 2274, > Iowa State University > Ames, IA,50011-2274 > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
thanks guys. that worked fine. In future may be this check could be implicit in the layout_circle method which could complain if the seqinfo doesnt match. I guess it would avoid some clueless moments for new users of ggbio like me :). Cheers! -Abhi On Thu, Jan 10, 2013 at 4:41 PM, Michael Lawrence <lawrence.michael@gene.com> wrote: > > > > On Thu, Jan 10, 2013 at 2:13 PM, Tengfei Yin <yintengfei@gmail.com> wrote: > >> Hi Abhi, >> >> You raised an important point that users need to pay attention to when >> they >> construct circular view: >> >> 1. All the data you added on the same circular view, have to have exactly >> the same seqlevels and seqlengths. >> 2. They have to have lengths information for each chromosome, otherwise, >> length is estimated from the data, and it's not accurate in most cases. >> >> it's easy to check when you print the data >> hg19ideo >> test_gr >> >> So in your case, your test_gr's seqlevels is just 1 with seqlengths NA, >> which is not consistency with hg19ideo. So you have to do something >> similar >> to this >> >> seqlevels(test_gr) <- seqlevels(hg19Ideo) >> seqlengths(test_gr) <- seqlengths(hg19Ideo) >> >> > probably easier to do this all at once with seqinfo<-. > > >> or do it when you construct the test_gr object. >> >> this will solve the misalignment problem. >> >> HTH >> >> Tengfei >> >> On Thu, Jan 10, 2013 at 4:01 PM, Abhishek Pratap <apratap@lbl.gov> wrote: >> >> > I am trying to run a test case in ggbio(based on example in a vignette) >> and >> > seem to be running into an odd case where a feature is misplaced on the >> > graph. working Example below >> > >> > In the plot I see the variation(rectangle) is misplaced. I see it on >> chr3 >> > whereas it should be on chr1. plot also attached >> > >> > >> > library(ggbio) >> > data(hg19Ideogram, package = "biovizBase") >> > ## subset_chr >> > chr.sub <- paste("chr", 1:3, sep = "") >> > new.names <- as.character(1:3) >> > names(new.names) <- paste("chr",new.names,sep="") >> > hg19Ideo <- hg19Ideogram >> > hg19Ideo <- keepSeqlevels(hg19Ideogram,chr.sub) >> > hg19Ideo <- renameSeqlevels(hg19Ideo,new.names) >> > >> > >> > p <- ggplot() + >> > layout_circle(hg19Ideo,geom="ideo",fill="gray70",radius=30,trackW idth=4) >> > #adding the scale track >> > p <- p + >> > >> > >> layout_circle(hg19Ideo,geom="scale",fill="gray70",size=4,radius=35, trackWidth=2) >> > #adding the text track >> > p <- p + >> > >> > >> layout_circle(hg19Ideo,geom="text",aes(label=seqnames),vjust=0,radi us=39,trackWidth=7,size=6) >> > >> > >> > #testing : placing a rect for a dummy variation >> > test_gr <- GRanges('1',IRanges(start=3000,width=1)) >> > >> > #adding the mutant track >> > p <- p + >> > >> layout_circle(test_gr,geom="rect",color="steelblue",radius=23,track Width=6) >> > p >> > >> > >> > >> > >> > Thanks! >> > -Abhi >> > >> > >> > >> > >> > > sessionInfo()R version 2.15.2 (2012-10-26) >> > Platform: x86_64-pc-linux-gnu (64-bit) >> > >> > locale: >> > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >> > LC_TIME=en_US.UTF-8 >> > [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 >> > LC_MESSAGES=en_US.UTF-8 >> > [7] LC_PAPER=C LC_NAME=C >> > LC_ADDRESS=C >> > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 >> > LC_IDENTIFICATION=C >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] biovizBase_1.6.2 rtracklayer_1.18.2 ggbio_1.6.4 >> > ggplot2_0.9.3 >> > [5] GenomicRanges_1.10.5 IRanges_1.16.3 BiocGenerics_0.4.0 >> > >> > _______________________________________________ >> > Bioconductor mailing list >> > Bioconductor@r-project.org >> > https://stat.ethz.ch/mailman/listinfo/bioconductor >> > Search the archives: >> > http://news.gmane.org/gmane.science.biology.informatics.conductor >> > >> >> >> >> -- >> Tengfei Yin >> MCDB PhD student >> 1620 Howe Hall, 2274, >> Iowa State University >> Ames, IA,50011-2274 >> >> [[alternative HTML version deleted]] >> >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor@r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
On Thu, Jan 10, 2013 at 6:59 PM, Abhishek Pratap <apratap@lbl.gov> wrote: > thanks guys. that worked fine. > > In future may be this check could be implicit in the layout_circle method > which could complain if the seqinfo doesnt match. I guess it would avoid > some clueless moments for new users of ggbio like me :). > right, I have been thinking about an better way for automatic checking of seqinfo or doing something like you suggested, and will probably implemented that feature in next release. Thanks for your suggestions. Tengfei > > Cheers! > -Abhi > > > > > On Thu, Jan 10, 2013 at 4:41 PM, Michael Lawrence < > lawrence.michael@gene.com> wrote: > >> >> >> >> On Thu, Jan 10, 2013 at 2:13 PM, Tengfei Yin <yintengfei@gmail.com>wrote: >> >>> Hi Abhi, >>> >>> You raised an important point that users need to pay attention to when >>> they >>> construct circular view: >>> >>> 1. All the data you added on the same circular view, have to have exactly >>> the same seqlevels and seqlengths. >>> 2. They have to have lengths information for each chromosome, otherwise, >>> length is estimated from the data, and it's not accurate in most cases. >>> >>> it's easy to check when you print the data >>> hg19ideo >>> test_gr >>> >>> So in your case, your test_gr's seqlevels is just 1 with seqlengths NA, >>> which is not consistency with hg19ideo. So you have to do something >>> similar >>> to this >>> >>> seqlevels(test_gr) <- seqlevels(hg19Ideo) >>> seqlengths(test_gr) <- seqlengths(hg19Ideo) >>> >>> >> probably easier to do this all at once with seqinfo<-. >> >> >>> or do it when you construct the test_gr object. >>> >>> this will solve the misalignment problem. >>> >>> HTH >>> >>> Tengfei >>> >>> On Thu, Jan 10, 2013 at 4:01 PM, Abhishek Pratap <apratap@lbl.gov> >>> wrote: >>> >>> > I am trying to run a test case in ggbio(based on example in a >>> vignette) and >>> > seem to be running into an odd case where a feature is misplaced on the >>> > graph. working Example below >>> > >>> > In the plot I see the variation(rectangle) is misplaced. I see it on >>> chr3 >>> > whereas it should be on chr1. plot also attached >>> > >>> > >>> > library(ggbio) >>> > data(hg19Ideogram, package = "biovizBase") >>> > ## subset_chr >>> > chr.sub <- paste("chr", 1:3, sep = "") >>> > new.names <- as.character(1:3) >>> > names(new.names) <- paste("chr",new.names,sep="") >>> > hg19Ideo <- hg19Ideogram >>> > hg19Ideo <- keepSeqlevels(hg19Ideogram,chr.sub) >>> > hg19Ideo <- renameSeqlevels(hg19Ideo,new.names) >>> > >>> > >>> > p <- ggplot() + >>> > >>> layout_circle(hg19Ideo,geom="ideo",fill="gray70",radius=30,trackWi dth=4) >>> > #adding the scale track >>> > p <- p + >>> > >>> > >>> layout_circle(hg19Ideo,geom="scale",fill="gray70",size=4,radius=35 ,trackWidth=2) >>> > #adding the text track >>> > p <- p + >>> > >>> > >>> layout_circle(hg19Ideo,geom="text",aes(label=seqnames),vjust=0,rad ius=39,trackWidth=7,size=6) >>> > >>> > >>> > #testing : placing a rect for a dummy variation >>> > test_gr <- GRanges('1',IRanges(start=3000,width=1)) >>> > >>> > #adding the mutant track >>> > p <- p + >>> > >>> layout_circle(test_gr,geom="rect",color="steelblue",radius=23,trac kWidth=6) >>> > p >>> > >>> > >>> > >>> > >>> > Thanks! >>> > -Abhi >>> > >>> > >>> > >>> > >>> > > sessionInfo()R version 2.15.2 (2012-10-26) >>> > Platform: x86_64-pc-linux-gnu (64-bit) >>> > >>> > locale: >>> > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >>> > LC_TIME=en_US.UTF-8 >>> > [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 >>> > LC_MESSAGES=en_US.UTF-8 >>> > [7] LC_PAPER=C LC_NAME=C >>> > LC_ADDRESS=C >>> > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 >>> > LC_IDENTIFICATION=C >>> > >>> > attached base packages: >>> > [1] stats graphics grDevices utils datasets methods base >>> > >>> > other attached packages: >>> > [1] biovizBase_1.6.2 rtracklayer_1.18.2 ggbio_1.6.4 >>> > ggplot2_0.9.3 >>> > [5] GenomicRanges_1.10.5 IRanges_1.16.3 BiocGenerics_0.4.0 >>> > >>> > _______________________________________________ >>> > Bioconductor mailing list >>> > Bioconductor@r-project.org >>> > https://stat.ethz.ch/mailman/listinfo/bioconductor >>> > Search the archives: >>> > http://news.gmane.org/gmane.science.biology.informatics.conductor >>> > >>> >>> >>> >>> -- >>> Tengfei Yin >>> MCDB PhD student >>> 1620 Howe Hall, 2274, >>> Iowa State University >>> Ames, IA,50011-2274 >>> >>> [[alternative HTML version deleted]] >>> >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor@r-project.org >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: >>> http://news.gmane.org/gmane.science.biology.informatics.conductor >>> >> >> > -- Tengfei Yin MCDB PhD student 1620 Howe Hall, 2274, Iowa State University Ames, IA,50011-2274 [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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