[R] [BioC] objects masked from packages

James W. MacDonald jmacdon at med.umich.edu
Mon Feb 8 17:01:57 CET 2010


Hi Assa,

First off, please don't cross-post. This is really an R-help question, 
as it is about the R language rather than a specific BioC package.

Assa Yeroslaviz wrote:
> dear all,
> 
> I have a problem with a masked object in a package we created here.
> 
> we make a package for a workflow of internal analysis of microarray data.
> to create the package we used:
> 
>> install.packages(pkgs="affyAnalysis", repos=NULL)
>>  R CMD INSTALL affyAnalysis
> Erzeuge Verzeichnisse ...
> Erzeuge DESCRIPTION ...
> Erzeuge NAMESPACE ...
> Erzeuge Read-and-delete-me ...
> Kopiere Code-Dateien ...
> Erzeuge Hilfedateien ...
> Fertig.
> 
> one of the classes in the package is a S3 packge and has the name
> "preprocess".
> using the package require various packages. one of them is affyPLM, which
> also have a S3 class named preprocess.
> Each time I'm using the program i get the message:
> 
>> library(affyPLM)
> Lade nötiges Paket: affy
> Lade nötiges Paket: Biobase
> 
> Welcome to Bioconductor
> 
>   Vignettes contain introductory material. To view, type
>   'openVignette()'. To cite Bioconductor, see
>   'citation("Biobase")' and for packages 'citation(pkgname)'.
> 
> Lade nötiges Paket: gcrma
> Lade nötiges Paket: preprocessCore
> 
> Attache Paket: 'affyPLM'
> 
> 
>     The following object(s) are masked from package:affyAnalysis :
> 
>      preprocess
> 
> 
>     The following object(s) are masked from package:stats :
> 
>      resid,
>      residuals,
>      weights
> 
> 
> The preprocess command in the affyPLM package needs an affybatch object to
> work with.
> our preprocess is as such definiert:
> 
> preprocess <- function(x,...) UseMethod("preprocessExpData")
> preprocessExpData.expData <- function(data){
>     require("vsn")
>     data <- list(ExpressionSet=vsnrma(data$AffyBatch),
> baseDir=data$baseDir,experimentName=data$experimentName,
> pData=pData(data$AffyBatch))
>     class(data) <- c("expSet","list")
>     return(data)
> }
> 
> when using the workflow we have and coming to the point of preprocesswe get
> the following error message:
> 
>> ex <- preprocess(ed)
> Fehler in preprocess(ed) :
>   argument is expData threestep requires AffyBatch argument is list
> threestep requires AffyBatch
> 
> I would like to know if there is a way of using both preprocess commands
> without the need to rename ours. They both use different object structure as
> an input  and as far I understand the adventages of OOP in R it should be
> able to recognize this differences, but how?

You need to take advantage of the namespace mechanisms available to you. 
The affyPLM package has a NAMESPACE file, and your package should as 
well. If you need preprocess from affyPLM, you can simply call it as

affyPLM::preprocess

which will ensure that you get the function you want. You can do the 
same with the function from your package (affyAnalysis::preprocess).

Best,

Jim


> 
> Thans in advance for your help
> 
> Assa
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
**********************************************************
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 R-help mailing list