[BioC] passing in parameters to annotation packages (e.g hgu95av2)

Martin Morgan mtmorgan at fhcrc.org
Mon Mar 3 22:04:00 CET 2008


Tim et al.,

> library(annotate)
> map <- getAnnMap("SYMBOL", "hgu95av2")

might be a more robust solution, e.g., doing the paste, loading the
package if it is not already, choosing the '.db' version of the
annotation package in preference to the environment-based version,
etc. There's also a fun function 'revmap' which I find quite useful
and amazingly fast for reversing the map (e.g., from SYMBOL to probe,
instead of probe to SYMBOL).

> rmap <- revmap(map)
> mget(head(ls(rmap)), rmap)
$`15E1.2`
[1] "34083_at"

$`2'-PDE`
[1] "38144_at"

$`3.8-1`
[1] "34934_at"

$`76P`
[1] "40986_s_at" "40985_g_at" "40984_at"  

$AADAC
[1] "36512_at"

$AAK1
[1] "40628_at" "40572_at" "34949_at" "39456_at" "39463_at"

Martin

Tim Smith <tim_smith_666 at yahoo.com> writes:

> Thanks Sean & Marc. That did it!
>
>
>
> ----- Original Message ----
> From: Marc Carlson <mcarlson at fhcrc.org>
> To: Tim Smith <tim_smith_666 at yahoo.com>
> Cc: bioc <bioconductor at stat.math.ethz.ch>
> Sent: Monday, March 3, 2008 12:53:10 PM
> Subject: Re: [BioC] passing in parameters to annotation packages (e.g hgu95av2)
>
> Tim Smith wrote:
>> Hi,
>>
>> I was trying to pass in a parameter (on the fly), but am unable to figure out how to get what I want. Here is what I want:
>>
>> xx <- as.list(hgu95av2SYMBOL)
>>   
>>> length(xx)
>>>     
>> [1] 12625
>>
>> However, when I try to build the string on the fly and pass it as a parameter, for example:
>>
>>   
>>> var <- 'hgu95av2'
>>> tempVar <- paste(var,'SYMBOL',sep='')
>>> yy <- as.list(tempVar)
>>> length(yy)
>>>     
>> [1] 1
>>   
>>> tempVar
>>>     
>> [1] "hgu95av2SYMBOL"
>>
>>
>> I understand that in the second case, I have just created a string and the results are not surprising!. But how do I get it to do what I really want?
>>
>>
>>
>>
>>
>>
>>
>>       ____________________________________________________________________________________
>>
>>
>>     [[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
>>
>>   
> Hi Tim,
>
> I think that the function you want to use is get().
>
> So for your example:
>
> var <- 'hgu95av2'
> tempVar <- paste(var,'SYMBOL',sep='')
>
> #just add this function call into your flow to find the variable that
> you seek
> #(instead of the string which as you mentioned will NOT be what you want):
> foo = get(tempVar)
>
> yy = as.list(foo)
> length(yy)
>
> #Which gives the answer that I think you wanted:  [1] 12625
>
>
> Let me know if this doesn't help,
>
>
>     Marc
>
>
>
>
>
>
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
>
>
> 	[[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

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

Location: Arnold Building M2 B169
Phone: (206) 667-2793



More information about the Bioconductor mailing list