python - Annotation DB has no 'select' method in rpy2 -


i have following code in r:

require(hgu133a.db)  entrezids <- select(hgu133a.db, probenames, "entrezid") 

where probenames list of strings corresponding probes found in database.

i attempting translate python using rpy2:

from rpy2.robjects.packages import importr hgu133a_db = importr('hgu133a.db')  entrez_ids = hgu133a_db.select(hgu133a_db, probe_names, 'entrezid') 

but receive error:

attributeerror: module 'hgu133a.db' has no attribute 'select'

i've searched documentation (?select) , far can tell database hgu133a.db inherits select method annotationdbi class.

how resolve library select() coming from, can use in python?

[should have been comment @merv 's answer, exceeded number characters]

rpy2's importr() trying being specific package namespace r object coming from, while r's common usage less (and can lead annoyances such loading order of r packages having influence on 1 of functions same name executed).

the tradeoff importr 1 has know r symbol coming from. there less-known function in rpy2 can finding given r symbol defined(*): https://rpy2.readthedocs.io/en/version_2.8.x/robjects_rpackages.html#finding-where-an-r-symbol-is-coming-from .

otherwise, 1 can use r() retrieve object picked(*) in r session.

from rpy2.robjects import r r('select') 

(*: mentioned earlier, order in r packages loaded earlier in session can have influence on r object picked).


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -