Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running in pure python env: in a .py file #83

Open
DUAN-GAO opened this issue Nov 23, 2021 · 1 comment
Open

Running in pure python env: in a .py file #83

DUAN-GAO opened this issue Nov 23, 2021 · 1 comment

Comments

@DUAN-GAO
Copy link

Hello Malte,I m running in a .py file, when I tried to use scran function computeSumFactors,
that I need to convert anndata to SingleCellExperiment object,I tried following but not worked:
a = robjects.r'list'
b = robjects.r'SingleCellExperiment'
size_factors = computeSumFactors(b, clusters=input_groups)

could you help, many thanks.

@LuckyMD
Copy link
Contributor

LuckyMD commented Nov 24, 2021

Hi @Iweirdo,

You can take the command for how to run the calculateSumFactors function (as it's now called) from #77. This function is from scran, which is an R package. So you'd need to run it in r. Try something like:

import rpy2.robjects as ro

ro.r('data') = data
adata.obs['size_factors'] = ro.r('calculateSumFactors(...)')

I haven't tested the above. This is just to give you an idea of what needs to be run in R and what in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants