howto plot a figure like UCSC genome browser by Gviz
2
0
Entering edit mode
Ou, Jianhong ★ 1.3k
@ou-jianhong-4539
Last seen 18 hours ago
United States
Dear all, I want to plot a track via Gviz in mountain type. However, it looks like that fill.mountain does not work. How do I fill the area under the curve in black? Thanks. > library(Gviz) Loading required package: grid > from <- 65921878 > to <- 65980988 > gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", + track = "GC Percent", table = "gc5Base", from = from, + to = to, trackType = "DataTrack", start = "start", + end = "end", data = "score", type = "mountain", window = -1, + windowSize = 1500, fill.mountain = "black", + col.mountain = "black", name = "GC Percent") > plotTracks(list(gcContent), from=from, to=to, showTitle=F) > sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] Gviz_1.4.5 loaded via a namespace (and not attached): [1] AnnotationDbi_1.22.6 Biobase_2.20.1 BiocGenerics_0.6.0 biomaRt_2.16.0 Biostrings_2.28.0 [6] biovizBase_1.8.1 bitops_1.0-6 BSgenome_1.28.0 cluster_1.14.4 colorspace_1.2-2 [11] DBI_0.2-7 dichromat_2.0-0 GenomicFeatures_1.12.3 GenomicRanges_1.12.5 Hmisc_3.12-2 [16] IRanges_1.18.3 labeling_0.2 lattice_0.20-23 munsell_0.4.2 parallel_3.0.1 [21] plyr_1.8 RColorBrewer_1.0-5 RCurl_1.95-4.1 rpart_4.1-3 Rsamtools_1.12.4 [26] RSQLite_0.11.4 rtracklayer_1.20.4 scales_0.2.3 stats4_3.0.1 stringr_0.6.2 [31] tools_3.0.1 XML_3.95-0.2 zlibbioc_1.6.0 Yours sincerely, Jianhong Ou LRB 670A Program in Gene Function and Expression 364 Plantation Street Worcester, MA 01605 [[alternative HTML version deleted]]
Gviz Gviz • 2.4k views
ADD COMMENT
0
Entering edit mode
Robert Ivanek ▴ 750
@robert-ivanek-5892
Last seen 12 months ago
Switzerland
Dear Jianhong, The parameter fill.mountain has to be a vector with 2 elements - colors. First one is used for negative values and second one for positive ones. Following piece of code should fill in the area in "black": gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", track = "GC Percent", table = "gc5Base", from = from, to = to, trackType = "DataTrack", start = "start", end = "end", data = "score", type = "mountain", window = -1, windowSize = 1500, fill.mountain = c("black", "black"), col.mountain = "black", name = "GC Percent") Best Robert On 09/09/13 18:30, Ou, Jianhong wrote: > Dear all, > > I want to plot a track via Gviz in mountain type. However, it looks like that fill.mountain does not work. How do I fill the area under the curve in black? Thanks. > >> library(Gviz) > Loading required package: grid >> from <- 65921878 >> to <- 65980988 >> gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", > + track = "GC Percent", table = "gc5Base", from = from, > + to = to, trackType = "DataTrack", start = "start", > + end = "end", data = "score", type = "mountain", window = -1, > + windowSize = 1500, fill.mountain = "black", > + col.mountain = "black", name = "GC Percent") >> plotTracks(list(gcContent), from=from, to=to, showTitle=F) >> sessionInfo() > R version 3.0.1 (2013-05-16) > Platform: x86_64-apple-darwin10.8.0 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] grid stats graphics grDevices utils datasets methods base > > other attached packages: > [1] Gviz_1.4.5 > > loaded via a namespace (and not attached): > [1] AnnotationDbi_1.22.6 Biobase_2.20.1 BiocGenerics_0.6.0 biomaRt_2.16.0 Biostrings_2.28.0 > [6] biovizBase_1.8.1 bitops_1.0-6 BSgenome_1.28.0 cluster_1.14.4 colorspace_1.2-2 > [11] DBI_0.2-7 dichromat_2.0-0 GenomicFeatures_1.12.3 GenomicRanges_1.12.5 Hmisc_3.12-2 > [16] IRanges_1.18.3 labeling_0.2 lattice_0.20-23 munsell_0.4.2 parallel_3.0.1 > [21] plyr_1.8 RColorBrewer_1.0-5 RCurl_1.95-4.1 rpart_4.1-3 Rsamtools_1.12.4 > [26] RSQLite_0.11.4 rtracklayer_1.20.4 scales_0.2.3 stats4_3.0.1 stringr_0.6.2 > [31] tools_3.0.1 XML_3.95-0.2 zlibbioc_1.6.0 > > > Yours sincerely, > > Jianhong Ou > > LRB 670A > Program in Gene Function and Expression > 364 Plantation Street Worcester, > MA 01605 > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD COMMENT
0
Entering edit mode
Dear Robert, Thanks a lot. It works great. Yours sincerely, Jianhong Ou LRB 670A Program in Gene Function and Expression 364 Plantation Street Worcester, MA 01605 On 9/10/13 11:22 AM, "Robert Ivanek" <robert.ivanek at="" unibas.ch=""> wrote: >Dear Jianhong, > >The parameter fill.mountain has to be a vector with 2 elements - colors. >First one is used for negative values and second one for positive ones. > >Following piece of code should fill in the area in "black": > > >gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", > track = "GC Percent", table = "gc5Base", from = from, > to = to, trackType = "DataTrack", start = "start", > end = "end", data = "score", type = "mountain", window = -1, > windowSize = 1500, fill.mountain = c("black", "black"), > col.mountain = "black", name = "GC Percent") > > >Best >Robert > >On 09/09/13 18:30, Ou, Jianhong wrote: >> Dear all, >> >> I want to plot a track via Gviz in mountain type. However, it looks >>like that fill.mountain does not work. How do I fill the area under the >>curve in black? Thanks. >> >>> library(Gviz) >> Loading required package: grid >>> from <- 65921878 >>> to <- 65980988 >>> gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", >> + track = "GC Percent", table = "gc5Base", from = from, >> + to = to, trackType = "DataTrack", start = "start", >> + end = "end", data = "score", type = "mountain", window = -1, >> + windowSize = 1500, fill.mountain = "black", >> + col.mountain = "black", name = "GC Percent") >>> plotTracks(list(gcContent), from=from, to=to, showTitle=F) >>> sessionInfo() >> R version 3.0.1 (2013-05-16) >> Platform: x86_64-apple-darwin10.8.0 (64-bit) >> >> locale: >> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] grid stats graphics grDevices utils datasets methods >> base >> >> other attached packages: >> [1] Gviz_1.4.5 >> >> loaded via a namespace (and not attached): >> [1] AnnotationDbi_1.22.6 Biobase_2.20.1 BiocGenerics_0.6.0 >> biomaRt_2.16.0 Biostrings_2.28.0 >> [6] biovizBase_1.8.1 bitops_1.0-6 BSgenome_1.28.0 >> cluster_1.14.4 colorspace_1.2-2 >> [11] DBI_0.2-7 dichromat_2.0-0 >>GenomicFeatures_1.12.3 GenomicRanges_1.12.5 Hmisc_3.12-2 >> [16] IRanges_1.18.3 labeling_0.2 lattice_0.20-23 >> munsell_0.4.2 parallel_3.0.1 >> [21] plyr_1.8 RColorBrewer_1.0-5 RCurl_1.95-4.1 >> rpart_4.1-3 Rsamtools_1.12.4 >> [26] RSQLite_0.11.4 rtracklayer_1.20.4 scales_0.2.3 >> stats4_3.0.1 stringr_0.6.2 >> [31] tools_3.0.1 XML_3.95-0.2 zlibbioc_1.6.0 >> >> >> Yours sincerely, >> >> Jianhong Ou >> >> LRB 670A >> Program in Gene Function and Expression >> 364 Plantation Street Worcester, >> MA 01605 >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >>http://news.gmane.org/gmane.science.biology.informatics.conductor >> > >_______________________________________________ >Bioconductor mailing list >Bioconductor at r-project.org >https://stat.ethz.ch/mailman/listinfo/bioconductor >Search the archives: >http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.2 years ago
Switzerland
Hi Jianhong, the mountain type plot is supposed to emphasise differences in a profile relative to a baseline. Thus you need to define two colors for the fill. One is the color above that baseline and one the color below. Using your example this should illustrate what I mean: plotTracks(list(gcContent), from=from, to=to, showTitle=F, baseline=36) If you really want to force the plot type to give you a smoothed filled profile of your data you could do this: plotTracks(list(gcContent), from=from, to=to, showTitle=F, fill.mountain=rep("black",2)) By default the mountain plot computes a loess smoothing for your data, but I see that you are already creating the object using a running window smoother. Not sure whether this is intentional or not, but you may want to consider just using one of the two smoothing options. If all you want is a filled profile, the 'histogram' type may be a lot more flexible: plotTracks(list(gcContent), from=from, to=to, showTitle=F, type="histogram") Hope that helps, Florian From: <ou>, Jianhong <jianhong.ou@umassmed.edu<mailto:jianhong.ou@umassmed.edu>> Date: Monday, September 9, 2013 6:30 PM To: "bioconductor@r-project.org<mailto:bioconductor@r-project.org>" <bioconductor@r-project.org<mailto:bioconductor@r-project.org>> Cc: Florian Hahne <florian.hahne@novartis.com<mailto:florian.hahne@novartis.com>> Subject: howto plot a figure like UCSC genome browser by Gviz Dear all, I want to plot a track via Gviz in mountain type. However, it looks like that fill.mountain does not work. How do I fill the area under the curve in black? Thanks. > library(Gviz) Loading required package: grid > from <- 65921878 > to <- 65980988 > gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX", + track = "GC Percent", table = "gc5Base", from = from, + to = to, trackType = "DataTrack", start = "start", + end = "end", data = "score", type = "mountain", window = -1, + windowSize = 1500, fill.mountain = "black", + col.mountain = "black", name = "GC Percent") > plotTracks(list(gcContent), from=from, to=to, showTitle=F) > sessionInfo() R version 3.0.1 (2013-05-16) Platform: x86_64-apple-darwin10.8.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] Gviz_1.4.5 loaded via a namespace (and not attached): [1] AnnotationDbi_1.22.6 Biobase_2.20.1 BiocGenerics_0.6.0 biomaRt_2.16.0 Biostrings_2.28.0 [6] biovizBase_1.8.1 bitops_1.0-6 BSgenome_1.28.0 cluster_1.14.4 colorspace_1.2-2 [11] DBI_0.2-7 dichromat_2.0-0 GenomicFeatures_1.12.3 GenomicRanges_1.12.5 Hmisc_3.12-2 [16] IRanges_1.18.3 labeling_0.2 lattice_0.20-23 munsell_0.4.2 parallel_3.0.1 [21] plyr_1.8 RColorBrewer_1.0-5 RCurl_1.95-4.1 rpart_4.1-3 Rsamtools_1.12.4 [26] RSQLite_0.11.4 rtracklayer_1.20.4 scales_0.2.3 stats4_3.0.1 stringr_0.6.2 [31] tools_3.0.1 XML_3.95-0.2 zlibbioc_1.6.0 Yours sincerely, Jianhong Ou LRB 670A Program in Gene Function and Expression 364 Plantation Street Worcester, MA 01605 [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

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