簡體   English   中英

如何使用rpy2的bioconductor?

[英]How to use bioconductor from rpy2?

我正在嘗試從rpy2使用bioconductor(特別是seqLogo)。 我找到了有用的包:

http://pythonhosted.org/rpy2-bioconductor-extensions/index.html

但是當我從包的文檔中嘗試這個時:

import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
base = importr('base')

# evaluate locally a remote R script
base.source("http://www.bioconductor.org/biocLite.R")
base.require("biocLite")
bioclite = robjects.globalenv['biocLite']

我收到了錯誤

  File "/usr/local/lib/python2.7/dist-packages/rpy2-2.3.6-py2.7-linux-x86_64.egg/rpy2/robjects/environments.py", line 17, in __getitem__
    res = super(Environment, self).__getitem__(item)
LookupError: 'biocLite' not found

在我的系統的R環境中,以下工作完美:

> require(seqLogo)

我想從rpy2使用這個已安裝的seqLogo軟件包。 如何才能做到這一點? 因為我安裝了rpy2,我可以這樣做:

>>> import bioc

但不確定如何從bioc安裝新的bioconductor包,如bioc

如果我嘗試:

importr("seqLogo")

我收到錯誤:

rpy2.rinterface.RRuntimeError: Error in loadNamespace(name) : there is no package called ‘seqLogo’

謝謝。

Bioconductor項目改變了其軟件包安裝程序的內部結構。 以下應該有效:

from rpy2.robjects.packages import importr

# do the following _only the first time_, to install the package seqLogo
base = importr('base')
base.source("http://www.bioconductor.org/biocLite.R")
biocinstaller = importr("BiocInstaller")
biocinstaller.biocLite("seqLogo")

# load the installed package "seqLogo"
seqlogo = importr("seqLogo")

否則rpy2的bioconductor擴展已經有一段時間沒有更新了。 可能還有其他事情需要修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM