[BioC] problem with getGOOntology

Robert Gentleman rgentlem at fhcrc.org
Fri Apr 8 00:17:45 CEST 2005


Yes, it probably requires a slightly better handling of missing values  
(although that is a bit of a can of worms). I will try to see what can  
be done in time for the next release.

If you are interested you might try defining the following method -  
largely untested as I am travelling -

setMethod("Ontology", signature="ANY", function(object) if(  
is.na(object) ) NA else    callNextMethod())

with that in place I get:
 > getGOOntology("GO:11111")
GO:11111
       NA

which seems like what is wanted, but I am sure there will be  
consequences. Let me know if that triggers more downstream nastiness -  
as I am not just sure of where you are going (note also we don't seem  
to have either sessionInfo for the  original report nor a workable  
example of what is wanted - these are kind of important)

On Apr 7, 2005, at 2:59 PM, Francois Pepin wrote:

> On Thu, 2005-04-07 at 17:58, Sean Davis wrote:
>
>>>> getGOOntology
>>> function (x)
>>> {
>>>     if (!is.character(x))
>>>         stop("need a character argument")
>>>     if (length(x) == 0)
>>>         return(character(0))
>>>     wh <- mget(x, env = GOTERM, ifnotfound = NA)
>>>     return(sapply(wh, Ontology))
>>> }
>>>
>>
>> My bad.  The lowercase 'o' got me.
>>
>> If you haven't already done it, looks like a line:
>>
>> wh <- wh[!is.na(wh)]
>>
>> right before the return line might do the trick.
>
> Not quite, as it would mess the indices up if you were to load a list  
> of
> terms.
>
> Instead of having c('MF', NA, NA, 'CC', 'BP') as a result you'd end up
> having c('MA','CC','BP') and think that the 3rd one is a biological
> process term rather than not being a GO term (and have no clue for the
> last 2).
>
> Francois
>
>
>> Sean
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>
>
+----------------------------------------------------------------------- 
----------------+
| Robert Gentleman              phone: (206) 667-7700                    
          |
| Head, Program in Computational Biology   fax:  (206) 667-1319   |
| Division of Public Health Sciences       office: M2-B865               
       |
| Fred Hutchinson Cancer Research Center                                 
          |
| email: rgentlem at fhcrc.org                                              
                          |
+----------------------------------------------------------------------- 
----------------+



More information about the Bioconductor mailing list