添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
憨厚的大脸猫  ·  python ...·  1 周前    · 
霸气的花卷  ·  python list 错位相减 ...·  1 周前    · 
帅气的领带  ·  【Pyspark ...·  1 周前    · 
近视的橙子  ·  python ...·  1 周前    · 
正直的小蝌蚪  ·  DNS 与 Pdns OpenWrt ...·  1 月前    · 
活泼的松鼠  ·  Outlook 2013 sync ...·  3 月前    · 
重感情的围巾  ·  【AI金融】Can ChatGPT ...·  7 月前    · 
豪情万千的楼梯  ·  [Solved] ...·  7 月前    · 

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

Hi @melancholy12 ,

We previously tried to implement a python wrapper around the R functions for Seurat v3 and LIGER in scIB . However, we found that they didn't always work exactly the same way as when run in a pure R environment. You can however do this yourself using rpy2 and anndata2ri .

That would look something like

from rpy2 import robjects as ro
import anndata2ri
anndata2ri.activate()
adata = sc.datasets.pbmc68k_reduced()
ro.globalenv["data"] = adata
ro.r('library(Seurat)')
ro.r('seurat_obj <- as.Seurat(adata)')
# Do your R integration in Seurat within ro.r('')
ro.r('...')
output = ro.r('as.SingleCellExperiment(seurat_obj)')

By going via SingleCellExperiment objects and anndata2ri.activate() you should be able to easily transfer the data between R and python from a python framework.

Hi @melancholy12,

We previously tried to implement a python wrapper around the R functions for Seurat v3 and LIGER in scIB. However, we found that they didn't always work exactly the same way as when run in a pure R environment. You can however do this yourself using rpy2 and anndata2ri .

That would look something like

from rpy2 import robjects as ro
import anndata2ri
anndata2ri.activate()
adata = sc.datasets.pbmc68k_reduced()
ro.globalenv["data"] = adata
ro.r('library(Seurat)')
ro.r('seurat_obj <- as.Seurat(adata)')
# Do your R integration in Seurat within ro.r('')
ro.r('...')
output = ro.r('as.SingleCellExperiment(seurat_obj)')

By going via SingleCellExperiment objects and anndata2ri.activate() you should be able to easily transfer the data between R and python from a python framework.

Hi LuckMD,
Thanks for your reply. Could we simply run it in python instead of using R language?
Just something like scanpy.external.harmony?
Because we are familiar with scanpy, and not want to change the coding style.

Hi @melancholy12,

No, there is currently no python implementation of these methods specifically. You would have to wrap the R function calls with rpy2 to make this work from python. The syntax would still be quite some R. There are basic implementations of these methods in the scib-pipeline repo here though. Maybe that helps to become familiar with how to call them.

Hi @melancholy12,

No, there is currently no python implementation of these methods specifically. You would have to wrap the R function calls with rpy2 to make this work from python. The syntax would still be quite some R. There are basic implementations of these methods in the scib-pipeline repo here though. Maybe that helps to become familiar with how to call them.

There is a new package called pyliger. Here is the link: https://github.com/welch-lab/pyliger
It should be better if it can integrate into scanpy.