久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

scRNA分析 | 解決可能的報(bào)錯(cuò),,從0開始教你完成細(xì)胞通訊分析-cellphoneDB

 生信補(bǔ)給站 2022-12-06 發(fā)布于北京

CellPhoneDB是一個(gè)受配體及其相互作用的數(shù)據(jù)庫(kù),,整合了UniProt, ensemble, PDB, IMEx,,IUPHAR等數(shù)據(jù)庫(kù)的信息,。CellPhoneDB數(shù)據(jù)庫(kù)概況如下圖所示


本文將從頭開始介紹(1)如何安裝cellphonedb以及解決可能的報(bào)錯(cuò),,(2)如何下載cellphonedb數(shù)據(jù)庫(kù),(3)單細(xì)胞數(shù)據(jù)提取輸入文件 以及(4)簡(jiǎn)單的可視化.

一 cellphonedb準(zhǔn)備

1,,cellphonedb安裝

考慮到不同的生信軟件對(duì)于python 或者 R 的版本要求不一致,,建議建立一個(gè)獨(dú)立的python環(huán)境。官網(wǎng)https://github.com/ventolab/CellphoneDB介紹了conda 和 virtualenv 2種方式,,這里使用conda的方式,。

1) Create python=>3.6 environment

conda create -n cpdb python=3.7

2) Activate environment

source activate cpdb

3) Install CellPhoneDB

pip install cellphonedb

ERROR1:如果這一步出現(xiàn)如下報(bào)錯(cuò)

解決方式就是先安裝一下rpy2

conda install -c conda-forge rpy2

安裝之后再安裝pipinstallcellphonedb 即可。

檢測(cè)方式:在終端輸入cellphonedb ,,出現(xiàn)如下截圖的提示則安裝成功,,cellphonedb主要commands有四個(gè),本文主要介紹一下紅框內(nèi)的method和plot,,database也很重要 ,。

安裝成功!

2,,下載cellphoneDB數(shù)據(jù)庫(kù)

一般直接默認(rèn)選擇最新的版本,。

(1)使用上述的database參數(shù)下載數(shù)據(jù)庫(kù)文件,cellphonedb database download

[ ][APP][05/12/22-17:19:52][INFO] Downloading release v4.0.0 of CellPhoneDB database[ ][APP][05/12/22-17:20:06][INFO] Download completed![ ][APP][05/12/22-17:20:06][INFO] Copying database to xxx/releases/v4.0.0

(2)在https://github.com/ventolab/CellphoneDB-data 網(wǎng)址手動(dòng)下載cellphone.db文件 ,。

以上兩種方式均可以,,記清楚數(shù)據(jù)庫(kù)文件所在的路徑就可以。

3,,準(zhǔn)備輸入文件

在單細(xì)胞的seuratObject文件中提取矩陣文件和注釋文件,,這里以以一個(gè)樣本為例

library(Seurat) library(tidyverse)load("sce.anno.RData")#使用一個(gè)樣本作為示例test <- subset(sce2, sample == "P01")
#注釋文件meta_data <- test@meta.data %>% rownames_to_column("Cell") %>% select(Cell,celltype) write.table(meta_data, 'test_meta.txt', sep='\t', quote=F, row.names=F)
#矩陣文件test@assays$RNA@data[1:4,1:4]write.table(as.matrix(test@assays$RNA@data), 'test_count.txt', sep='\t', quote=F)
test@assays$RNA@data[1:4,1:4]4 x 4 sparse Matrix of class "dgCMatrix" K16733_AAACATACTCGTTT-1 K16733_AAAGCAGAACGTTG-1 K16733_AAAGCAGACTGAGT-1 K16733_AAAGGCCTGCTCCT-1MIR1302-2HG . . . .FAM138A . . . .OR4F5 . . . .AL627309.1                        .                       .                       .                       .

將上述的test_count.txt ,test_meta.txt 和 cellphone.db文件,,上傳到終端,。

二 cellphonedb 計(jì)算

1,method-計(jì)算通訊關(guān)系

(1)首先使用method參數(shù)進(jìn)行主要的細(xì)胞通訊計(jì)算

cellphonedb method statistical_analysis test_meta.txt test_count.txt --database ./cellphone.db --counts-data=gene_name --output-path

主要參數(shù):

--database  :cellphonedb數(shù)據(jù)庫(kù)文件

--counts-data :count 矩陣是基因名格式,,添加參數(shù)--counts-data=gene_name ,;如果行名為ensemble名稱的話,可以使用默認(rèn)值,。

--output-path  :輸出路徑

其他一些默認(rèn)參數(shù):Threshold:0.1 Iterations:1000 Debug-seed:-1 Threads:4 Precision:3

(2)運(yùn)算完成后,,會(huì)在輸出路徑下得到以下4個(gè)文件:

deconvoluted.txt:基因在亞群中的平均表達(dá)量
mean.txt:每對(duì)受體-配體的平均表達(dá)量
pvalues.txt:每對(duì)受體-配體的p值
significant_means.txt:每對(duì)受體-配體顯著性結(jié)果的平均表達(dá)量值

2,, cellphonedb可視化

cellphonedb提供了plot函數(shù)可以進(jìn)行簡(jiǎn)單的可視化

#氣泡圖cellphonedb plot dot_plot #熱圖cellphonedb plot heatmap_plot test_meta.txt

ERROR2:如果出現(xiàn)如下報(bào)錯(cuò)

ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/proj/cellphone_env2/lib/python3.7/site-packages/markupsafe/__init__.py)

解決方式:可以將markupsafe降為2.0.1 。

 pip install markupsafe==2.0.1

ERROR3:出現(xiàn)如下報(bào)錯(cuò),,提示沒有g(shù)gplot2

解決方式:安裝R環(huán)境以及對(duì)應(yīng)的R包

conda install -c conda-forge r-base=3.6.2 # if not installed alreadyconda install -c conda-forge  r-ggplot2conda install -c conda-forge r-pheatmap

之后再運(yùn)行plot即可得到以下2張圖

至此cellphonedb的主要分析就完成了,!

A:當(dāng)然希望你不會(huì)遇到以上ERROR,如果遇到了那就解決就完事,。

B:當(dāng)然也可以根據(jù)method得到的4個(gè)結(jié)果文件,,使用ggplot2或其他R包自行繪制 (以待后續(xù))。

參考資料: https://github.com/Teichlab/cellphonedb

◆ ◆ ◆  ◆ 

精心整理(含圖PLUS版)|R語(yǔ)言生信分析,,可視化(R統(tǒng)計(jì),,ggplot2繪圖,生信圖形可視化匯總)

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多