Has anyone used bioconductor from Python? Is there any reason I would choose to use it from R instead of Python? It seems like there is a Python extension for it. Also, is there any reason to use bioconductor over Biopython?
-
$\begingroup$ don't quite get your question.. is there something you need to use one or the other for? The link you have uses rpy2, basically calling R from inside python.. not so easy for you to pass objects from rpy2 back into python $\endgroup$– StupidWolfCommented May 10, 2020 at 17:49
3 Answers
Bioconductor packages are R packages that can only be used directly from python via rpy2 or similar. If you've ever had reason to use rpy2 you'd probably realize quickly that while it works, it's no where near as easy as doing the same thing directly in R.
Biopython is a package for doing a number of useful things, but it can in no way come remotely close to performing even a percent of what Bioconductor packages do. That would be an impossible feat for a single python package.
-
$\begingroup$ Thanks for replying. So is there a way to work around not using R (and use Python instead) while still being able to do what Bioconductor can do? Is there an ecosystem of Python packages along with Biopython that can emulate what can be done with Bioconductor to a certain extent? $\endgroup$ Commented May 10, 2020 at 20:13
-
2$\begingroup$ There is no python equivalent to Bioconductor. If you need to perform a statistical analysis you need to learn R. $\endgroup$ Commented May 10, 2020 at 20:15
Recently I have done something similar for my work, I am using sangerseqR which is s Bioconductor package in Python Environment using rpy2
import rpy2.robjects as r
from rpy2.robjects.packages import importr
utils = importr('utils')
utils.install_packages('sangerseqR', repos="https://git.bioconductor.org/packages/sangerseqR")
utils.chooseBioCmirror(ind=1) # select the first mirror in the list
utils.install_packages('sangerseqR')
sangerseqR = importr('sangerseqR')
#now using the sangerseqR package to the read the sequcence
Trace = sangerseqR.readsangerseq( file="1I1_F_P1815443_047.scf")
I had some trouble installing rpy2 because of binary incompatibility issues. To solve this problem, I took the following steps:
First, I wrote the necessary functions in R. Then, I created a straightforward REST-API using library(plumber)
and started the server on my local machine. On the Python side, I utilized requests
to call the functions and receive responses.
I know that this solution is somewhat ugly, but it has works for me