[BioC] FW: function error for "hyperGTest" in Category package

Martin Morgan mtmorgan at fhcrc.org
Wed Nov 4 14:55:20 CET 2009


Hi Yun --

LIYUN wrote:
> 
> -----Original Message-----
> From: Vincent Carey [mailto:stvjc at channing.harvard.edu] 
> Sent: 2009年11月4日 14:34
> To: LIYUN
> Cc: bioconductor
> Subject: Re: [BioC] function error for "hyperGTest" in Category package
> 
> Please keep the dialogue on the mailing list.  The maintainers of the
> package may comment on this phenomenon.
> 
> On Tue, Nov 3, 2009 at 11:46 PM, LIYUN <yli01 at sibs.ac.cn> wrote:
>> Thank you very much for your help, the problem has been solved. It turns out that the problem is arise because of some sequence difference of loading these packages, but I'm not sure where the problem is. You may try load the package and run the functions in the following sequence:
>> ###########
>>        library( GO.db)
>>        library(Category)
>>        library(hgu133a.db)
>>        library(GOstats)
>>        params <- new("GOHyperGParams", geneIds = c('1000','100'),universeGeneIds = NULL, annotation ='hgu133a.db',ontology='MF')
>>        hyperGTest(params)
>> ############
>> It will return a correct result.

This is the practical solution -- library(GOStats), and then
hyperGTest(<etc>). The reason is below, but it is technical and probably
unhelpful for you...

>>
>> Now you close the R ,and restart an new R, and if this time you miss to load (GOstats) at the first time:
>> ########
>>        library( GO.db)
>>        library(Category)
>>        library(hgu133a.db)
>>        params <- new("GOHyperGParams", geneIds = c('1000','100'),universeGeneIds = NULL, annotation ='hgu133a.db',ontology='MF')
>>        hyperGTest(params)
>> ########
>> It will report the following error:
>> ########
>>        error: getClass(Class, where = topenv(parent.frame())) :
>>        c("\"GOHyperGResult\" is not a defined class", "\"MFHyperGResult\" is not a defined class")
>> ########
>> But when you load GOstats after seeing this error messages:
>> ########
>>        library(GOstats)
>>        params <- new("GOHyperGParams", geneIds = c('1000','100'),universeGeneIds = NULL, annotation ='hgu133a.db',ontology='MF')
>>        hyperGTest(params)

Category defines the class GOHyperGParams, which extends HyperGParams.
It also defines a hyperGTest,HyperGParams-method, which is where your
code hyperGTest(params) ends up. But hyperGTest,HyperGParams-method does
not know how to deal with GOHyperGParams, and issues an error.

This first 'bug' might be that hyperGTest,HyperGParams-method should be
more selective about arguments that it accepts. A second 'bug' might be
that GOHyperGParams should not be defined in Category.

GOstats contains the hyperGTest,GOHyperGParams-method that is
appropriate for performing the analysis. So by loading GOstats the
method now becomes available. Unfortunately...

The third 'bug' is that the methods package does not refresh the
'methods dispatch table' to reflect the new method

> showMethods(hyperGTest)
Function: hyperGTest (package Category)
p="ChrMapHyperGParams"
p="GOHyperGParams"
    (inherited from: p="HyperGParams")
p="HyperGParams"

> library(GOstats)
Loading required package: graph
> showMethods(hyperGTest)
Function: hyperGTest (package Category)
p="ChrMapHyperGParams"
p="GOHyperGParams"
    (inherited from: p="HyperGParams")
p="HyperGParams"

so that hyperGTest(params) still ends up in the same incorrect
hyperGTest,HyperGParams-method. Now this methods finds the class, but is
trying to fill the class with incorrect data.

This is in contrast to a new R session

> library(GOstats)
> showMethods(hyperGTest)
Function: hyperGTest (package Category)
p="ChrMapHyperGParams"
p="GOHyperGParams"
p="HyperGParams"

where all the components are in place for the method to work -- the
GOHyperGParams class, the hyperGTest,GOHyperGParms-method, and the
GOHyperGResult class.

Probably the right solution is to move the GOHyperGParams class from
Category, but it is tricky to know what the consequences of this would
be for other parts of the code. It also represents a substantial amount
of work.

Martin

>> ########
>> It still report an error like this:
>> ########
>>        Error: initialize(value, ...) :
>>         invalid names for slots of class "GOHyperGResult": pvalues, oddsRatios, expectedCounts, catToGeneId, organism
>> ########
>>
>> I'm confused about this problem. SessionInfo for both is the same.
>>
>> R version 2.10.0 (2009-10-26)
>> i386-pc-mingw32
>>
>> locale:
>> [1] LC_COLLATE=Chinese_People's Republic of China.936  LC_CTYPE=Chinese_People's Republic of China.936
>> [3] LC_MONETARY=Chinese_People's Republic of China.936 LC_NUMERIC=C
>> [5] LC_TIME=Chinese_People's Republic of China.936
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>>  [1] GOstats_2.12.0      graph_1.22.2        hgu133a.db_2.3.5    org.Hs.eg.db_2.3.6  Category_2.12.0     GO.db_2.3.5
>>  [7] RSQLite_0.7-3       DBI_0.2-4           AnnotationDbi_1.8.0 Biobase_2.6.0
>>
>> loaded via a namespace (and not attached):
>> [1] annotate_1.24.0   genefilter_1.28.0 GSEABase_1.8.0    RBGL_1.20.0       splines_2.10.0    survival_2.35-7
>> [7] tools_2.10.0      XML_2.6-0         xtable_1.5-5
>>
>>
>>
>> ----Original Message-----
>> From: Vincent Carey [mailto:stvjc at channing.harvard.edu]
>> Sent: 2009年11月3日 18:27
>> To: LIYUN
>> Cc: bioconductor at stat.math.ethz.ch
>> Subject: Re: [BioC] function error for "hyperGTest" in Category package
>>
>> please read the posting guide.  you do not provide sessionInfo()
>> result nor a reproducible example.  if we take
>>
>> entrezGeneIds = c("1000", "100")
>>
>> we can find
>>
>>> hyperGTest(params)
>> Gene to GO MF  test for over-representation
>> 19 GO MF ids tested (6 have p < 0.01)
>> Selected gene set size: 2
>>    Gene universe size: 10785
>>    Annotation package: hgu133a
>>
>> with sessionInfo:
>>
>>> sessionInfo()
>> R version 2.10.0 Patched (2009-10-31 r50269)
>> i386-apple-darwin9.8.0
>>
>> locale:
>> [1] C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices datasets  tools     utils     methods
>> [8] base
>>
>> other attached packages:
>>  [1] GO.db_2.3.5          GOstats_2.11.3       graph_1.23.7
>>  [4] Category_2.11.5      hgu133a.db_2.3.5     org.Hs.eg.db_2.3.6
>>  [7] RSQLite_0.7-3        DBI_0.2-4            AnnotationDbi_1.7.20
>> [10] Biobase_2.5.8        weaver_1.11.1        codetools_0.2-2
>> [13] digest_0.4.1
>>
>> loaded via a namespace (and not attached):
>> [1] GSEABase_1.7.4    RBGL_1.21.14      XML_2.6-0         annotate_1.23.4
>> [5] genefilter_1.25.9 splines_2.10.0    survival_2.35-7   xtable_1.5-5
>>
>>
>> On Tue, Nov 3, 2009 at 4:43 AM, LIYUN <yli01 at sibs.ac.cn> wrote:
>>> Hi,
>>>
>>> I’m using the hypetGTest function to do gene enrichment analysis, but there
>>> shows errors like this:
>>>
>>> ”  invalid names for slots of class "GOHyperGResult": pvalues, oddsRatios,
>>> expectedCounts, catToGeneId”
>>>
>>>
>>>
>>> The code I’m using is :
>>>
>>> Ø   params <- new("GOHyperGParams", geneIds = entrezGeneIds,universeGeneIds
>>> = NULL, annotation ='hgu133a.db',ontology='MF')  #where entrezGeneIds is a
>>> vector of gene probe names.
>>>
>>> Ø  hyperGTest(params)
>>>
>>>
>>>
>>> all the packages and R version is updated to the latest version. I used to
>>> used this function in R 2.4.X and the low version of category , and it
>>> works. But when I used the updated version, it goes wrong.
>>>
>>>
>>>
>>> Any advise?
>>>
>>>
>>>
>>> Yun
>>>
>>>
>>>        [[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
>>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4522 (20091019) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4522 (20091019) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>>
>>
> 
> 
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4522 (20091019) __________
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
>  
> 
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4522 (20091019) __________
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
>  
> 
> _______________________________________________
> 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


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioconductor mailing list