[BioC] affyPLM - cant plot chip pseudo image
James W. MacDonald
jmacdon at med.umich.edu
Tue Jul 17 15:20:48 CEST 2007
Hi Rebecca,
I think your problem arises because of the fact that the code in the
Rprofile.site is loaded into the base package. From the 'Startup' help page:
Then R searches for the site-wide startup profile unless the
command line option '--no-site-file' was given. The name of this
file is taken from the value of the 'R_PROFILE' environment
variable. If this variable is unset, the default is
'$R_HOME/etc/Rprofile.site', which is used if it exists (it
contains settings from the installer in a "factory-fresh"
installation). This code is loaded into package 'base'. Users
need to be careful not to unintentionally overwrite objects in
base, and it is normally advisable to use 'local' if code needs to
be executed: see the examples.
I personally use an .Rprofile file in my home directory to automatically
load things I think I will be needing (e.g.,
source("http://www.bioconductor.org/biocLite.R"), which can get pretty
tedious to type). This is probably a much safer way to go, although you
could try wrapping your source() call in local() as shown in the
examples. Anyway, Rprofile.site is designed to be a site-wide
initialization of R, which isn't nearly as useful for Windows as
compared to something like a Linux server that multiple people may be
using at one time.
As an aside, you can figure out what your home directory is using
Sys.getenv("R_USER")
Best,
Jim
Rebecca wrote:
> Hello, thanks for your response.
>
>
>
> -----Message d'origine-----
> De : James W. MacDonald [mailto:jmacdon at med.umich.edu]
> Envoyé : lundi 16 juillet 2007 19:00
> À : Rebecca
> Cc : bioconductor at stat.math.ethz.ch
> Objet : Re: [BioC] affyPLM - cant plot chip pseudo image
>
> Rebecca wrote:
>
>> Thank you James,
>> Yes, I did use BiocLite to install and got the same results as you for the
>> "showMethods".
>> However, after carefully retracing my steps, I now know what I did that
>> caused the error, but no idea why, or how to fix it.
>>
>> What I did that caused the error was that I put the following line at the
>> end of the file "Rprofile.site" in the "~\R-2.5.1\etc" directory
>>
>> source(file.path(R.home(), "etc", "myRcode.R"))
>>
>>
>
> What is in myRcode.R? Specifically, is there anything in there that
> might affect the class of the PLMset you are producing? What do you get
> from class(Pset)?
>
>
> I have whittled down the code in "myRcode.R" to one line :
> "library(affyPLM)".
>
> If I source "myRcode.R" by hand, with no changes to "Rprofile.site", I have
> no trouble making a pseudo image from my saved PLM set.
>
> If I add the line
> source(file.path(R.home(), "etc", "myRcode.R")))
> to the bottom of "Rprofile.site", and open the R GUI from the desktop,
> pseudo image no longer works.
>
> I include gory details of the tests (1,2, and 3) that show this down below.
>
> Maybe the key is in the fact that the two different ways of sourcing
> "myRcode.R" print different traces to the GUI.
>
> #------------------------------------------
> ### WHEN I SOURCE BY HAND, I GET THE FOLLOWING
> # AND PSEUDO IMAGE CREATION WORKS
>
>> source("myRcode.R")
>>
> Le chargement a nécessité le package : affy
> Le chargement a nécessité le package : Biobase
> Le chargement a nécessité le package : tools
>
> Welcome to Bioconductor
>
> Vignettes contain introductory material. To view, type
> 'openVignette()'. To cite Bioconductor, see
> 'citation("Biobase")' and for packages 'citation(pkgname)'.
>
> Le chargement a nécessité le package : affyio
> Le chargement a nécessité le package : affydata
> Le chargement a nécessité le package : gcrma
> Le chargement a nécessité le package : matchprobes
> Le chargement a nécessité le package : splines
>
>
>
>
> #-----------------------------------
> # WHEN OPENING R FROM THE DESKTOP, WITH "myRcode.R" SOURCED INSIDE
> # "Rprofile.site", THE FOLLOWING MESSAGES APPEAR IN THE GUI.
> # AND PSEUDO IMAGE CREATION DOES NOT WORK
>
> Le chargement a nécessité le package : Biobase
> Le chargement a nécessité le package : tools
> Le chargement a nécessité le package : utils
>
> Welcome to Bioconductor
>
> Vignettes contain introductory material. To view, type
> 'openVignette()'. To cite Bioconductor, see
> 'citation("Biobase")' and for packages 'citation(pkgname)'.
>
> Le chargement a nécessité le package : affyio
> Le chargement a nécessité le package : affydata
> Le chargement a nécessité le package : gcrma
> Le chargement a nécessité le package : matchprobes
> Le chargement a nécessité le package : splines
> Le chargement a nécessité le package : stats
>
> Attachement du package : 'stats'
>
>
> The following object(s) are masked from package:affy :
>
> update
>
> #----------------------------------
> # If I add the line "library(stats)" above "library(afftPLM)"
> # in "myRcode.R", The introductory message is cleaner,
> # but the pseudo image creation still fails.
>
>
>
> Le chargement a nécessité le package : affy
> Le chargement a nécessité le package : Biobase
> Le chargement a nécessité le package : tools
> Le chargement a nécessité le package : utils
>
> Welcome to Bioconductor
>
> Vignettes contain introductory material. To view, type
> 'openVignette()'. To cite Bioconductor, see
> 'citation("Biobase")' and for packages 'citation(pkgname)'.
>
> Le chargement a nécessité le package : affyio
> Le chargement a nécessité le package : affydata
> Le chargement a nécessité le package : gcrma
> Le chargement a nécessité le package : matchprobes
> Le chargement a nécessité le package : splines
>
>
>> dir()
>>
> [1] "Makeconf" "myRcode.R" "Pset.Rdata" "Rconsole" "Rdevga"
> "repositories"
> [7] "rgb.txt" "Rprofile.site"
>
>
>> load("Pset.Rdata") # This is a saved PLMset which loads and
>>
> # makes pseudo images OK (see below)
>
>> image(Pset, which =2)
>>
> Erreur dans image.default(Pset, which = 2) : argument must be matrix-like
>
>
>> showMethods("image", class="PLMset")
>>
> Function: image (package graphics)
> x="PLMset"
>
>
>> class(Pset)
>>
> [1] "PLMset"
> attr(,"package")
> [1] "affyPLM"
>
> ####################### GORY DEBUG DETAILS ############################
> I created an affy batch with 2 CEL files (aBat <- ReadAffy()).
> Then I created a PLMset (Pset <- fitPLM(aBat)) and saved it for testing
> (file "Pset.Rdata").
> Moved the file "Pset.Rdata" to "\R-2.5.1\etc". NO CHANGES to original
> "Rprofile.site".
>
> 1- Open R 2.5.1 by double clicking desk top icon, go to "\R-2.5.1\etc". Load
> "Pset.Rdata".
> Verify that the pseudo image works.
>
> > dir()
> [1] "Makeconf" "myRcode.R" "Pset.Rdata" "Rconsole"
> [5] "Rdevga" "repositories" "rgb.txt" "Rprofile.site"
> > library(affyPLM)
> > load("Pset.Rdata")
> > class(Pset)
> [1] "PLMset"
> attr(,"package")
> [1] "affyPLM"
> > image(Pset, which =2) # THIS WORKS
> >q("no")
>
>
> 2- Put command for loading library affyPLM in "myRcode.R", located in
> "\R-2.5.1\etc". Still no changes to "Rprofile.site".
> --------------------------
> ### "myRcode.R" contains this line only:
>
> library(affyPLM)
>
> ---------------------------
> Open R 2.5.1 by double clicking desk top icon, go to "\R-2.5.1\etc".
> Source the little script and verify that the pseudo image works.
> > dir()
> [1] "Makeconf" "myRcode.R" "Pset.Rdata" "Rconsole"
> [5] "Rdevga" "repositories" "rgb.txt" "Rprofile.site"
> > source("myRcode.R")
>
> > load("Pset.Rdata")
> > image(Pset, which =2) # THIS WORKS
> >q("no")
>
>
> 3- Make changes to "Rprofile.site".
> ---------------------------
> ### "Rprofile.site" was edited to include these lines at the end
> source(file.path(R.home(), "etc", "myRcode.R"))
> ---------------------------
> Open R 2.5.1 by double clicking desk top icon, go to "\R-2.5.1\etc".
>
> > dir()
> [1] "Makeconf" "myRcode.R" "Pset.Rdata" "Rconsole"
> [5] "Rdevga" "repositories" "rgb.txt" "Rprofile.site"
> > load("Pset.Rdata")
> > image(Pset, which =2)
> Erreur dans image.default(Pset, which = 2) : argument must be
> matrix-like
>
>
>
>
>
>
>
--
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
More information about the Bioconductor
mailing list