[Bioc-sig-seq] mget with case-insensitive keys

Laurent Gautier lgautier at gmail.com
Wed Apr 7 06:16:13 CEST 2010


Xiang,

This has to do with the fact that the underlying structure mapping keys 
(that is here gene symbols) to values (here EG) is a hash table, 
designed for a fast lookup, that considers upper-case and lower-case for 
the same letter as different symbols.
The cost for an exhaustive search for all upper-case / lower-case 
combinations would be prohibitively high.

You can transform the environment org.Mm.egSYMBOL2EG into a list (with 
as.list() ) and use grep() on the names if this appears better to you.


Laurent




On 4/7/10 5:48 AM, xuxiang086 wrote:
> Hi Martin,
>
> Thanks for your help. It works. But why mget doesn't have an argument
> of ignore.case like grep? I think it is necessary, especially when we
> retrieve information using gene symbols, which are from different
> databases and in different formats.
>
> Best regards, Xiang
>
>
> 2010-04-07
>
>
>
> xuxiang086
>
>
>
> 发件人: Martin Morgan 发送时间: 2010-04-07  10:47:13 收件人: xuxiang086 抄送:
> bioc-sig-sequencing 主题: Re: [Bioc-sig-seq] mget with case-insensitive
> keys
>
> On 04/06/2010 06:20 PM, xuxiang086 wrote:
>> Hi all,
>>
>> I am using the mget function to retrieve some information from
>> org.eg.Mm.db, but the keys used by mget function are
>> case-sensitive. How can I make them case-insensitive? Thanks.
> Hi Xiang -- I don't know whether you can. Here is a hack that might
> work MGET<- function(x, envir, ..., mapWith=toupper) { keys<-
> ls(envir) names(keys)<- mapWith(keys) mget(keys[mapWith(x)], envir,
> ...) } and then
>> mget("WN", org.Mm.egSYMBOL2EG)
> Error in .checkKeys(value, Rkeys(x), x at ifnotfound) : value for "WN"
> not found
>> MGET("WN", org.Mm.egSYMBOL2EG)
> $wn [1] "22407" I haven't really tested it, and it recalculates the
> 'keys' map between upper and lower case each time so is not
> efficient. I wonder what your use case is? Martin
>>
>> Best regards,
>>
>> Xiang
>>
>> 2010-04-07
>>
>>
>>
>> xuxiang086
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-sig-sequencing mailing list Bioc-sig-sequencing at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>>
>>
>> _______________________________________________ Bioc-sig-sequencing
>> mailing list Bioc-sig-sequencing at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing



More information about the Bioc-sig-sequencing mailing list