你的位置:史杰服饰 > 新闻资讯 >

那时候是cellphonedb v3


发布日期:2024-06-25 09:55    点击次数:172

那时候是cellphonedb v3

1、《KS科研分享与服务》公众号有QQ交流群,但是进入门槛是20元,请考虑清楚。群里有推文的注释代码和示例数据,付费内容半价,还可以与大家交流。

2、需进群或者打包代码的小伙伴请添加作者微信了解,请备注目的,除此之外请勿添加,谢谢!

3、付费文章集合有打包价哦(公众号所有付费内容)!购买打包代码的小伙伴可加入微信VIP群,福利更多,微信群帖子提前发布,可获取更多内容!

点击:→ 加入微信vip群:《KS科研分享与服务》付费内容打包集合

建发电器制品(深圳)有限公司 "Hiragino Sans GB", 固原市伙新门窗有限公司 "Microsoft YaHei UI", 浙江圣雅达橡胶有限公司 "Microsoft YaHei", Arial, sans-serif;font-size: 17px;letter-spacing: normal;text-align: justify;widows: 2;visibility: visible;">详情请联系作者:

Cellphonedb是常用的细胞通讯分析工具:我们之前介绍过《CellPhoneDB单细胞互作分析(2):数据分析|人鼠基因同源转化|ERROR解决|详细注释版代码》。这还是一年前的内容,那时候是cellphonedb v3,当时我记得困扰大家的问题都是一些环境配置,软件安装之类的。但是近半年已经没有人再问类似的问题了,我想应该大多数人应该在这方面已经很娴熟了,不会再有问题了!

但是还是有小伙伴问道一些问题,史杰服饰“我网上的方法成功安装了cellphonedb,但是怎么终端找不到command得嘞”?首先你没有错,你软件也安装成功了,其次,cellphonedbv4之后,代码运行不再像v3一样终端的方式,而是仅支持python的运行方式。时间过得也是很快,上个月小伙伴说cellphonedb都到V5了,最近沸沸扬扬的各种更新,本来我们就有更新cellphonedb教程的意思了,那么这次刚好,就跳过cellphonedb4,直接看V5。不过在使用操作上差别倒是不大。

首先我们看看cellphonedb V5有哪些新的内容。以下内容贴自cellphonedb官网,可自行查看。此外,官网也提供了详细的示例教程。

Novel features in v5

https://github.com/ventolab/CellphoneDB

New python package that can be easily executed in Jupyter Notebook and Collabs.

A scoring methodology to rank interaction based on the expression specificity of the interacting partners.

A CellSign module to leverage interactions based on the activity of the transcription factor downstream the receptor. This module is accompanied by a collection of 211 well described receptor-transcription factor direct relationships.

A new method of querying of CellphoneDB results search_utils.search_analysis_results.

Improved computational efficiency of method 2 cpdb_statistical_analysis_method.

A new database (cellphonedb-data v5.0) with more manually curated interactions, making up to a total of ~3,000 interactions. This release of CellphoneDB database has three main changes:

Integrates new manually reviewed interactions with evidenced roles in cell-cell communication.

Includes non-protein molecules acting as ligands.

For interactions with a demonstrated signalling directionality, partners have been ordered according (ligand is partner A, receptor partner B).

Interactions have been classified within signaling pathways.

CellphoneDB no longer imports interactions from external resources. This is to avoid the inclusion of low-confidence interactions.

完整版内容已发布至微信VIP群,请自行查收!视频教程后续发布!我们这里的演示是在jupyter中进行的,如果你用的是服务器,如何使用jupyter可以查看官网手册(有Rstudio、有jupyter、具有root权限的服务器,你值得拥有 (注册领取200优惠券)!)。首先安装cellphonedb V5。
#安装cellphonedb v5pip install cellphonedb -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
接下来就是整理cellphonedbV5分析需要的文件了,类似于之前的V3。我们的教程里演示了从seurat或者h5ad获得input文件。主要有三个必须文件,matrix、metadata以及cellphonedb v5 database。cellphonedb v5 database可以自定义,按照官网要求即可。
from IPython.display import HTML, displayfrom cellphonedb.utils import db_releases_utilsdisplay(HTML(db_releases_utils.get_remote_database_versions_html()['db_releases_html_table']))#我们这里用最新的,定义cpdb的版本为5.0. 并下载database。cpdb_version = 'v5.0.0'cpdb_target_dir = os.path.join('./', cpdb_version)from cellphonedb.utils import db_utilsdb_utils.download_database(cpdb_target_dir, cpdb_version)
接下来分析即可:一般方法我们用statistical_analysis_method。
#一股脑的把能加载的都加载了,当然了,也都是有用的import numpy as npimport pandas as pdimport seaborn as snsimport scanpy as scfrom glob import iglobimport anndataimport os#import sklearnfrom sklearn.linear_model import LogisticRegressionimport matplotlib as mplimport scipyimport matplotlib.pyplot as pltimport pickle
sc.settings.verbosity = 3  # verbosity: errors (0), warnings (1), info (2), hints (3)sc.logging.print_versions()sc.settings.set_figure_params(dpi=100)  # low dpi (dots per inch) yields small inline figures
cpdb_file_path = './v5.0.0/cellphonedb.zip'meta_file_path = './cellphonedb_meta.txt'counts_file_path = './Normalized_counts.txt'out_path = './test1'
#一般方法我们用statistical_analysis_method。(正常的互作分析,并计算互作分析显著性)from cellphonedb.src.core.methods import cpdb_statistical_analysis_methodcpdb_results = cpdb_statistical_analysis_method.call(    cpdb_file_path = cpdb_file_path,                     meta_file_path = meta_file_path,                    counts_file_path = counts_file_path,                counts_data = 'hgnc_symbol',                        #active_tfs_file_path = active_tf_path,           #microenvs_file_path = microenvs_file_path,         score_interactions = True,                         iterations = 1000,                               threshold = 0.1,                                   threads = 5,                                    debug_seed = 42,                                    result_precision = 3,                               pvalue = 0.05,                                      separator = '|',                                   debug = False,                                     output_path = out_path                  )
cellphonedb V5的运行速度是大大提高,可以看一下运行日志。一个字:快!
Reading user files...The following user files were loaded successfully:./Normalized_counts.txt./cellphonedb_meta.txt[][CORE][21/12/23-16:58:42][INFO] [Cluster Statistical Analysis] Threshold:0.1 Iterations:1000 Debug-seed:42 Threads:5 Precision:3[][CORE][21/12/23-16:58:42][WARNING] Debug random seed enabled. Set to 42[][CORE][21/12/23-16:58:43][INFO] Running Real Analysis[][CORE][21/12/23-16:58:43][INFO] Running Statistical Analysis100%|██████████| 1000/1000 [03:23<00:00,  4.91it/s][ ][CORE][21/12/23-17:02:08][INFO] Building Pvalues result[ ][CORE][21/12/23-17:02:09][INFO] Building results[ ][CORE][21/12/23-17:02:09][INFO] Scoring interactions: Filtering genes per cell type..100%|██████████| 12/12 [00:00<00:00, 42.54it/s][ ][CORE][21/12/23-17:02:09][INFO] Scoring interactions: Calculating mean expression of each gene per group/cell type..100%|██████████| 12/12 [00:00<00:00, 173.78it/s][ ][CORE][21/12/23-17:02:10][INFO] Scoring interactions: Calculating scores for all interactions and cell types..100%|██████████| 144/144 [00:33<00:00,  4.27it/s]Saved deconvoluted to ./test1/statistical_analysis_deconvoluted_12_21_2023_170246.txtSaved deconvoluted_percents to ./test1/statistical_analysis_deconvoluted_percents_12_21_2023_170246.txtSaved means to ./test1/statistical_analysis_means_12_21_2023_170246.txtSaved pvalues to ./test1/statistical_analysis_pvalues_12_21_2023_170246.txtSaved significant_means to ./test1/statistical_analysis_significant_means_12_21_2023_170246.txtSaved interaction_scores to ./test1/statistical_analysis_interaction_scores_12_21_2023_170246.txt
最后我们得到的文件如下:和V3一样,那么自然,可视化就可以结合我们之前的!
list(cpdb_results.keys())#['deconvoluted',# 'deconvoluted_percents',# 'means',# 'pvalues',# 'significant_means',# 'CellSign_active_interactions',# 'CellSign_active_interactions_deconvoluted',# 'interaction_scores']

当然了,ktplotspy包,也就是ktplot的python版,也出了专门针对V5的可视化。如果不在python中进行可视化,得到的文件在R中进行可视化也是可以的。一些基本可视化如下:

图片新闻资讯

图片

希望分享对你有启发,其他的可自行查看官网,也是有详细的教程!觉得分享有用的,点个赞再走呗! 本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。