[BioC] Rkeys function from AnnotationDbi returns all Rkeys for a subset

James W. MacDonald jmacdon at med.umich.edu
Tue Dec 9 15:24:42 CET 2008


Hi Leon,

Leon Yee wrote:
> Dear all,
> 
>      I encountered a problem when I using Rkeys from AnnotationDbi
> package. Using [] I get a subset of a AnnDbBimap object, but when I
> using Rkeys for this subset, it returns all of the Rkeys from the
> original set.

I don't believe Rkeys() is intended to return a subset - it is intended 
to give you all the right keys of the object. But I am not sure why you 
want to use Rkeys() to do what you have already done using 
as.list(hgu95av2PATH[ids]). Perhaps I misunderstand?

Another way is to use mget() as always:

mget(ids[1:5], hgu95av2PATH)

Best,

Jim


> 
>> library("hgu95av2.db")
>> ids = ls(hgu95av2PATH)
>> as.list(hgu95av2PATH[ids[1:5]])
> $`1000_at`
>  [1] "04010" "04012" "04150" "04350" "04360" "04370" "04510" "04520" "04540"
> [10] "04620" "04650" "04664" "04720" "04730" "04810" "04910" "04912" "04916"
> [19] "04930" "05210" "05211" "05212" "05213" "05214" "05215" "05216" "05218"
> [28] "05219" "05220" "05221" "05223"
> 
> $`1001_at`
> [1] NA
> 
> $`1002_f_at`
> [1] "00590" "00591" "00830" "00902" "00903" "00980" "00982"
> 
> $`1003_s_at`
> [1] "04060"
> 
> $`1004_at`
> [1] "04060"
> 
>> Rkeys(hgu95av2PATH[ids[1:5]])
> # this is expected to output only the  PATH ids as outputed of the
> # previous command, but it outputed all the PATH ids.
> 
>   [1] "00010" "00020" "00030" "00031" "00040" "00051" "00052" "00053"
> "00061"
>  [10] "00062" "00071" "00072" "00100" "00120" "00130" "00140" "00150"
> "00190"
>  [19] "00220" "00230" "00232" "00240" "00251" "00252" "00260" "00271"
> "00272"
>  [28] "00280" "00281" "00290" "00300" "00310" "00330" "00340" "00350"
> "00360"
>  [37] "00361" "00363" "00380" "00400" "00401" "00410" "00430" "00440"
> "00450"
>  [46] "00460" "00471" "00472" "00480" "00500" "00510" "00511" "00512"
> "00520"
>  [55] "00521" "00530" "00531" "00532" "00533" "00534" "00550" "00561"
> "00562"
>  [64] "00563" "00564" "00565" "00590" "00591" "00592" "00600" "00601"
> "00602"
>  [73] "00603" "00604" "00620" "00624" "00625" "00630" "00632" "00640"
> "00641"
>  [82] "00643" "00650" "00660" "00670" "00680" "00710" "00720" "00730"
> "00740"
>  [91] "00750" "00760" "00770" "00780" "00785" "00790" "00791" "00830"
> "00860"
> [100] "00900" "00902" "00903" "00910" "00920" "00930" "00940" "00950"
> "00960"
> [109] "00970" "00980" "00982" "00983" "01030" "01031" "01032" "01040"
> "01430"
> [118] "01510" "02010" "03010" "03020" "03022" "03030" "03050" "03060"
> "03320"
> [127] "03410" "03420" "03430" "03440" "03450" "04010" "04012" "04020"
> "04060"
> [136] "04070" "04080" "04110" "04115" "04120" "04130" "04140" "04150"
> "04210"
> [145] "04310" "04330" "04340" "04350" "04360" "04370" "04510" "04512"
> "04514"
> [154] "04520" "04530" "04540" "04610" "04612" "04614" "04620" "04630"
> "04640"
> [163] "04650" "04660" "04662" "04664" "04670" "04710" "04720" "04730"
> "04740"
> [172] "04742" "04810" "04910" "04912" "04916" "04920" "04930" "04940"
> "04950"
> [181] "05010" "05020" "05030" "05040" "05050" "05060" "05110" "05120"
> "05130"
> [190] "05131" "05210" "05211" "05212" "05213" "05214" "05215" "05216"
> "05217"
> [199] "05218" "05219" "05220" "05221" "05222" "05223" "05310" "05320"
> "05322"
> [208] "05330" "05332" "05340"
> 
>> sessionInfo()
> R version 2.8.0 (2008-10-20)
> x86_64-unknown-linux-gnu
> 
> locale:
> LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=C;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] tools     stats     graphics  grDevices utils     datasets  methods
> [8] base
> 
> other attached packages:
> [1] hgu95av2.db_2.2.5   RSQLite_0.7-1       DBI_0.2-4
> [4] AnnotationDbi_1.4.1 Biobase_2.2.1
> 
> 
>   Can anybody help? Thanks a lot!
> 
> Leon
> 
> _______________________________________________
> 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

-- 
James W. MacDonald, M.S.
Biostatistician
Hildebrandt Lab
8220D MSRB III
1150 W. Medical Center Drive
Ann Arbor MI 48109-0646
734-936-8662



More information about the Bioconductor mailing list