簡介
cellphoneDB作為使用最廣泛的單細胞通訊軟件之一捣染,已經(jīng)得到了學者廣泛的認可奉狈,它的龐大的數(shù)據(jù)庫也一直在更新芝加。簡短說一下原理央渣,它是基于 UniProt计盒、Ensembl、PDB芽丹、IUPHAR等數(shù)據(jù)庫構建的受配體數(shù)據(jù)庫北启,與其他數(shù)據(jù)庫相比,CellPhoneDB的一個主要優(yōu)點是它考慮了配體和受體的結(jié)構組成拔第,準確地描述了異聚復合物咕村。這一點對于許多細胞因子等蛋白質(zhì)家族來說尤其重要,因為配體-受體相互作用通常涉及多個亞單位蚊俺。
而在最近更新中懈涛,cellphoneDB的數(shù)據(jù)庫已經(jīng)更新到V4.1.0版本∮锯總計的受配體對已經(jīng)達到2923個批钠。相比較上個版本,它的數(shù)據(jù)舍棄了大量未經(jīng)過篩選的受配體得封,在準確性上大大提高埋心,其次是因為軟件的更新,cellphoneDB的數(shù)據(jù)庫格式也發(fā)生了改變呛每,由原來的db格式改成了以zip結(jié)尾的壓縮包踩窖。
此外這次的更新中,將cellphoneDB改為python編寫晨横。大幅度提高了查詢和計算速度洋腮,經(jīng)過測試箫柳,大概快一半時間左右。讀取單細胞數(shù)據(jù)的格式也新增了h5ad格式啥供。
cellphoneDB的3種方法
第一種 cpdb_analysis_method
使用的簡單的分析方法悯恍,不進行顯著性分析,計算每個受配體對的平均值伙狐,原理是通過計算所有參與受配體基因表達量的平均值涮毫,生成的文件是means.csv和deconvoluted.csv
使用的代碼是
from cellphonedb.src.core.methods import cpdb_analysis_method
cpdb_results = cpdb_analysis_method.call(
cpdb_file_path = cellphonedb.zip,
meta_file_path = test_meta.txt,
counts_file_path = test_counts.h5ad,
counts_data = 'hgnc_symbol',
output_path = out_path)
第二種 cpdb_statistical_analysis_method
在第一種方法的基礎上增加了顯著性分析,而且為了確定細胞類型之間最相關的相互作用贷屎,會尋找配體和受體之間的細胞類型特異性相互作用罢防。
對所有細胞類型進行兩兩比較,通過隨機排列所有細胞的聚類標簽(默認為1,000次)唉侄,計算不同細胞類型之間的平均受體和配體表達水平咒吐,對于每個細胞類型之間的每個受體-配體對,在生成一個零分布的基礎上計算一個 p 值属划,該 p 值表示受體-配體相互作用的強度恬叹。然后優(yōu)先選擇細胞類型之間高度富集的受配體對,生成的文件新增pvalues.csv和significant_means.csv
from cellphonedb.src.core.methods import cpdb_degs_analysis_method
cpdb_results = cpdb_degs_analysis_method.call(
cpdb_file_path = cellphonedb.zip,
meta_file_path = test_meta.txt,
counts_file_path = test_counts.h5ad,
degs_file_path = degs_file_path,
counts_data = 'hgnc_symbol',
active_tfs_file_path = active_tf.txt,
score_interactions = True,
microenvs_file_path = microenvs_file_path,
threshold = 0.1,
output_path = out_path)
第二種 cpdb_degs_analysis_method
外部提供一個差異基因的表格,受體或者配體中的基因有一個必須在表格中,生成的文件新增relevant_interactions.txt和significant_means.csv
from cellphonedb.src.core.methods import cpdb_degs_analysis_method
cpdb_results = cpdb_degs_analysis_method.call(
cpdb_file_path = cellphonedb.zip,
meta_file_path = test_meta.txt,
counts_file_path = test_counts.h5ad,
degs_file_path = degs_file_path,
counts_data = 'hgnc_symbol',
active_tfs_file_path = active_tf.txt,
score_interactions = True,
microenvs_file_path = microenvs_file_path,
threshold = 0.1,
output_path = out_path)
差異基因表格(degs_file.txt)見下圖:
日常分析中同眯,我們使用的最多的是方法二绽昼,因此我將方法二的一些具體函數(shù)的參數(shù)進行了注釋
from cellphonedb.src.core.methods import cpdb_statistical_analysis_method
cpdb_results = cpdb_statistical_analysis_method.call(
cpdb_file_path = cpdb_file_path, # 數(shù)據(jù)庫文件路徑
meta_file_path = meta_file_path, # 包含細胞Barcoda注釋的meta文件
counts_file_path = counts_file_path, # counts文件,或者h5ad文件
counts_data = 'hgnc_symbol', # 指定counts矩陣信息的某一列來進行注釋须蜗,可以換成"genename"
active_tfs_file_path = active_tf_path, # 指定的轉(zhuǎn)錄因子文件(可不填)
microenvs_file_path = microenvs_file_path, # 微環(huán)境文件(可不填)
iterations = 1000, # 隨機排列的次數(shù)
threshold = 0.1, #"定義了基因表達的最低細胞百分比
threads = 5, # 線程數(shù)
debug_seed = 42, # debug randome seed. To disable >=0.
result_precision = 3, # 保留結(jié)果小數(shù)點位數(shù)
pvalue = 0.05, # P-value threshold to employ for significance.
subsampling = False, # 是否降采樣
subsampling_log = False, # (mandatory) enable subsampling log1p for non log-transformed data inputs.
subsampling_num_pc = 100, # Number of componets to subsample via geometric skectching (dafault: 100).
subsampling_num_cells = 1000, # Number of cells to subsample (integer) (default: 1/3 of the dataset).
separator = '|', # 兩個細胞類型的連接符,eg(cell A|cell B).
debug = False, # Saves all intermediate tables employed during the analysis in pkl format.
output_path = out_path, # j結(jié)果保存路徑
output_suffix = None # 是否為輸出的文件加上特殊的字符 (default: None).
)