jupyter r python r conda r一起使用jupyterhub taotao scvelo velocyto python中使用r2py2rpy2 联用 python2r

安装 python2r环境 并激活

conda create -n python2r -y
conda activate python2r

conda install pip -y

conda install mamba -c conda-forge -c bioconda -y

conda install python -y

conda install ipykernel -y

python -m ipykernel install --user --name python2r --display-name "python2r" 

相关包的安装  How to program with Python and R in Jupyter Notebook - Ander Fernández (anderfernandez.com)Getting started with Python and the IPython notebook — Computational Statistics in Python 0.1 documentation (duke.edu)

conda install -c r r-essentials -y
pip install rpy2[all]
pip install rpy2 -i https://pypi.douban.com/simple/ #rpy2/rpy2: Interface to use R from Python (github.com)

或者使用conda 安装rpy2

 conda install -c "conda-forge/label/cf202003" rpy2 -y

##############正式使用

Clustering Genes by Pseudotemporal Expression Pattern Getting started with Monocle - Dave Tang's blog

Monocle provides functionality for clustering genes according to their pseudotime value. The clustering analysis and plotting are done in one step using the plot_pseudotime_heatmap() function; to save the clustering results, use return_heatmap = TRUE.

1

2

3

4

5

6

7

8

9

# cluster the top 50 genes that vary as a function of pseudotime

my_pseudotime_de %>% arrange(qval) %>% head(50) %>% select(id) -> gene_to_cluster

gene_to_cluster <- gene_to_cluster$id

my_pseudotime_cluster <- plot_pseudotime_heatmap(my_cds_subset[gene_to_cluster,],

                                                 num_clusters = 3,

                                                 cores = 8,

                                                 show_rownames = TRUE,

                                                 return_heatmap = TRUE)

my_branched_heatmap <- plot_genes_branched_heatmap(my_cds_subset[row.names(subset(BEAM_res, qval < 1e-4)),],
                                                   branch_point = 1,
                                                   num_clusters = 4,
                                                   cores = 8,
                                                   use_gene_short_name = TRUE,
                                                   show_rownames = TRUE,
                                                   return_heatmap = TRUE)

猜你喜欢

转载自blog.csdn.net/qq_52813185/article/details/130939712