import rpy2.robjects as ro
from rpy2.robjects.packages import importr
import rpy2.robjects.packages as rpackages
from rpy2.robjects import pandas2ri
def parse_CrossTalkeR(path):
"""
Parameters
----------
path: Location to the RDS object generated by CrossTalkeR
Returns
-------
tbldata : DataFrame Containing all the Results from CrossTalkeR
Notes
-----
This algorithm was proposed in [1]_ and [2]_.
"""
d = {'package.dependencies': 'package_dot_dependencies',
'package_dependencies': 'package_uscore_dependencies'}
ctker = importr('CrossTalkeR',
robject_translations = d)
readRDS = ro.r['readRDS']
df = readRDS(path)
phdat = df.slots['tables']
tbldata = {}
for i in enumerate(phdat.names):
with (ro.default_converter + pandas2ri.converter).context():
tbldata[i[1]] = pandas2ri.conversion.get_conversion().rpy2py(phdat[i[0]])
return(tbldata)
import rpy2.robjects as ro from rpy2.robjects.packages import importr import rpy2.robjects.packages as rpackages from rpy2.robjects import pandas2ri