[BioC] Problem with exporting graph from plotPCA() in a DESeq2 function
Ugo Borello
ugo.borello at inserm.fr
Mon Feb 10 16:41:43 CET 2014
Thank you very much.
It will experiment with the code right away.
Ugo
> From: Wolfgang Huber <whuber at embl.de>
> Date: Mon, 10 Feb 2014 16:27:24 +0100
> To: Ugo Borello <ugo.borello at inserm.fr>
> Cc: Michael Love <michaelisaiahlove at gmail.com>, "Fabrice Chatonnet [guest]"
> <guest at bioconductor.org>, <fabrice.chatonnet at ens-lyon.org>,
> "bioconductor at r-project.org" <bioconductor at r-project.org>
> Subject: Re: [BioC] Problem with exporting graph from plotPCA() in a DESeq2
> function
>
> Ciao Ugo
>
> the function plotPCA is trivial so it is not difficult to replace it with one
> adapted to your tastes. (Just type plotPCA¹ without the ()¹ in the R command
> line.) Furthermore, as Mike mentioned, plotPCA returns the trellis object, and
> you can update it - see e.g.
> http://stackoverflow.com/questions/6606902/add-labels-on-lattice-xyplot A
> working example is:
>
> library("DESeq2")
> library("lattice")
> example(plotPCA)
>
> myplot = plotPCA(vsd)
> names = colData(vsd)$sample
>
> myplot = update(myplot, panel = function(x, y, ...) {
> panel.xyplot(x, y, ...);
> ltext(x=x, y=y, labels=names, pos=1, offset=1, cex=0.8)
> })
>
> There are various packages on CRAN to provide automated moving around of the
> labels to avoid overplotting, and there are also options for producing the
> plot as SVG/HTML5 with interactive tooltips . But then these things are
> general R and not specific to DESeq2, of course.
>
> best wishes
> Wolfgang
>
>
> On 10 Feb 2014, at 14:55, Ugo Borello <ugo.borello at inserm.fr> wrote:
>
>> Dear Mike,
>> Regarding the plotPCA() of DESeq2, is there a way to add the sample names on
>> the plot?
>> If not do you plan to modify the function, in the next DESeq2 release, in
>> order to see the sample names in the plot?
>>
>> Thank you
>>
>> Ugo
>>
>>
>>> From: Michael Love <michaelisaiahlove at gmail.com>
>>> Date: Mon, 10 Feb 2014 08:42:12 -0500
>>> To: "Fabrice Chatonnet [guest]" <guest at bioconductor.org>
>>> Cc: <fabrice.chatonnet at ens-lyon.org>, "bioconductor at r-project.org"
>>> <bioconductor at r-project.org>
>>> Subject: Re: [BioC] Problem with exporting graph from plotPCA() in a DESeq2
>>> function
>>>
>>> hi Fabrice,
>>>
>>> plotPCA() returns a call to xyplot() which is a function of the lattice
>>> package. I didn't try this yet, but typically the solution with lattice
>>> plots is a print call:
>>>
>>> plt <- plotPCA(...)
>>> print(plt)
>>>
>>> see
>>> http://stat.ethz.ch/R-manual/R-devel/library/lattice/html/print.trellis.html
>>>
>>> Mike
>>>
>>>
>>> On Mon, Feb 10, 2014 at 8:32 AM, Fabrice Chatonnet [guest] <
>>> guest at bioconductor.org> wrote:
>>>
>>>>
>>>> Hi!
>>>>
>>>> I am currently programming a function for easy use of DESeq2. I would like
>>>> to export my graphs with the pdf() command. It works fine for the
>>>> dispersion graph and other volcano plots that I programmed, but I
>>>> encountered some problems with the plotPCA() function. First I have to
>>>> execute it at the very end of the function to see the graph, and the if I
>>>> use pdf()... dev.off / graphics.off(), the pdf file contains all graphs but
>>>> the PCA graph.
>>>> I tried it line by line in the console, it works fine.
>>>> I usually work with RStudio, but under R it didn't work either. Any ideas?
>>>>
>>>> Thanks for your help,
>>>>
>>>> Fabrice.
>>>>
>>>> -- output of sessionInfo():
>>>>
>>>>> sessionInfo("DESeq2")
>>>> R version 3.0.2 (2013-09-25)
>>>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>>>>
>>>> locale:
>>>> [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
>>>> [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
>>>> [5] LC_TIME=French_France.1252
>>>>
>>>> attached base packages:
>>>> character(0)
>>>>
>>>> other attached packages:
>>>> [1] DESeq2_1.2.10
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] annotate_1.40.0 AnnotationDbi_1.24.0 base_3.0.2
>>>> [4] Biobase_2.22.0 BiocGenerics_0.8.0 BiocInstaller_1.12.0
>>>> [7] datasets_3.0.2 DBI_0.2-7 genefilter_1.44.0
>>>> [10] GenomicRanges_1.14.4 graphics_3.0.2 grDevices_3.0.2
>>>> [13] grid_3.0.2 IRanges_1.20.6 lattice_0.20-24
>>>> [16] locfit_1.5-9.1 methods_3.0.2 parallel_3.0.2
>>>> [19] RColorBrewer_1.0-5 Rcpp_0.11.0
>>>> RcppArmadillo_0.4.000.2
>>>> [22] rJava_0.9-6 RSQLite_0.11.4 splines_3.0.2
>>>> [25] stats_3.0.2 stats4_3.0.2 survival_2.37-7
>>>> [28] tools_3.0.2 utils_3.0.2 xlsx_0.5.5
>>>> [31] xlsxjars_0.5.0 XML_3.98-1.1 xtable_1.7-1
>>>> [34] XVector_0.2.0
>>>>
>>>>> packageDescription('DESeq2')$Maintainer
>>>> [1] "Michael Love <michaelisaiahlove at gmail.com>"
>>>>
>>>> --
>>>> Sent via the guest posting facility at bioconductor.org.
>>>>
>>>
>>> [[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
>
More information about the Bioconductor
mailing list