[BioC] mget plus regular expression

Marc Carlson mcarlson at fhcrc.org
Mon Jul 19 21:06:08 CEST 2010


Hi Marco,

Vince is correct to point out that the problem is being caused by
name-mangling that happens when you use the unlist() method.  This
occurs because the authors of the unlist() method wanted to guarantee
that the names returned by unlist() remained unique.  However, as you
have discovered, this becomes a problem when the names have a meaning
and the name-mangling ends up changing that.  :(

There is a work around though.  If you just want to do something like
unlist() with this, you have the option to use the unlist2() method in
the AnnotationDbi package which will allow you to skip the troublesome
name-mangling.


  Marc


On 07/19/2010 10:30 AM, Vincent Carey wrote:
>> unlist(mget('NM_016951', revmap(hgug4112aREFSEQ)))
>>     
>     NM_0169511     NM_0169512     NM_0169513
> "A_23_P118061" "A_23_P206396" "A_24_P215804"
>
> This has nothing to do with regular expressions.  It has to do with
> name mangling and an odd application of
> mget.
>
>   
>> mget('NM_016951', revmap(hgug4112aREFSEQ))
>>     
> $NM_016951
> [1] "A_23_P118061" "A_23_P206396" "A_24_P215804"
>
> you don't need mget for this application.  if you use it and unlist()
> the results, unlist will add distinguishing tokens
> to the names of the list elements as their names are pushed onto the
> unlisted data.
>
>   
>> unlist(list(a=c(2,3)))
>>     
> a1 a2
>  2  3
>
>   
>> unlist(list(a=c(b=2,d=3)))
>>     
> a.b a.d
>   2   3
>
>
>
>
> On Mon, Jul 19, 2010 at 12:28 PM, Marco Fabbri <fabbri.marco at gmail.com> wrote:
>   
>> I am looking for refseq NM_016951 but mget returns me three results,
>> how can I get only for NM_016951 (the first one):
>>
>> unlist(mget('NM_016951', revmap(hgug4112aREFSEQ))
>>    NM_016951     NM_0169512     NM_0169513
>> "A_23_P118061" "A_23_P206396" "A_24_P215804"
>>
>> thank you
>>
>> Marco
>>
>> _______________________________________________
>> 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
>>
>>     
> _______________________________________________
> 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
>



More information about the Bioconductor mailing list