单细胞轨迹分析-monocle包的使用

探序基因肿瘤研究院 整理

安装:

monocle源码下载:https://www.bioconductor.org/packages/release/bioc/html/monocle.html

R版本,4.2.0

BiocManager::install("monocle")

不过在安装过程中还是报错了:

Warning: 无法在https://bioconductor.org/packages/3.15/bioc/src/contrib中读写索引:

  无法打开URL'https://bioconductor.org/packages/3.15/bioc/src/contrib/PACKAGES'

Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.0 (2022-04-22)

Installing package(s) 'monocle'

Warning: 没有'‘qlcMatrix’'这种相依关系

还安装相依关系‘RBGL’, ‘HSMMSingleCell’, ‘biocViews’

于是单独安装RBGL:

BiocManager::install("RBGL")

下载程序包‘RBGL’时出了问题

Installation paths not writeable, unable to update packages

  path: /usr/local/lib64/R/library

然后:

> BiocManager::install("RBGL")

Warning: 无法在貯藏處https://bioconductor.org/packages/3.15/bioc/src/contrib中读写索引:

  无法打开URL'https://bioconductor.org/packages/3.15/bioc/src/contrib/PACKAGES'

Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.0 (2022-04-22)

Installing package(s) 'RBGL'

还安装相依关系‘graph’

试开URL’https://bioconductor.org/packages/3.15/bioc/src/contrib/graph_1.74.0.tar.gz'

发现下载速度慢,于是到https://bioconductor.org/packages/release/bioc/html/graph.html下载,再:

R CMD INSTALL graph_1.80.0.tar.gz,安装成功。RBGL同样下载,再安装

R CMD INSTALL RBGL_1.78.0.tar.gz,安装成功。

其他依赖的包都能装好,就差qlcMatrix,找到线索:https://cran.r-project.org/web/packages/qlcMatrix/index.html,提示:

Package ‘qlcMatrix’ was removed from the CRAN repository.

Formerly available versions can be obtained from thearchive.

Archived on 2023-11-29 as issues were not corrected in time.

下载了qlcMatrix_0.9.7.tar.gz。最后R CMD INSTALL monocle_2.30.0.tar.gz

根据网上报道,安装monocle经常有错,比如R版本太高。

使用:

重要:构建CDS对象,所需要的3个输入文件:表达矩阵信息、基因信息和表型信息。

注意:Seurat为将基因表达矩阵,使用了Seurat包处理成的Seurat结构的一个变量

Mat <- Seurat@assays$RNA@counts

  p_data <- Seurat@meta.data

  p_data$celltype <- Seurat@active.ident

  f_data <- data.frame(gene_short_name = row.names(Mat),row.names = row.names(Mat))

#注意,表达矩阵Mat的细胞名字和数量要和p_data一致。表达矩阵Mat的基因名字和数量要和f_data一致。

  pd <- new('AnnotatedDataFrame', data = p_data)

  fd <- new('AnnotatedDataFrame', data = f_data)

  cds <- newCellDataSet(Mat,phenoData = pd,featureData = fd,lowerDetectionLimit = 0.5,expressionFamily = negbinomial.size())

  cds <- estimateSizeFactors(cds)

  cds <- estimateDispersions(cds)

  express_genes <- VariableFeatures(Seurat)

  cds<- setOrderingFilter(cds, express_genes)

  cds <- reduceDimension(cds,max_components = 2,method = 'DDRTree')

  cds <- orderCells(cds)

画图:

plot_cell_trajectory(cds,color_by="Pseudotime",size=1,show_backbone=TRUE)

其他更多的图,可以参照-【单细胞轨迹分析】monocle2

相关报错:

> cds <- orderCells(cds)

Warning messages:

1: In graph.dfs(dp_mst, root = root_cell, neimode = "all", unreachable = FALSE,  :

  Argument `neimode' is deprecated; use `mode' instead

2: In graph.dfs(dp_mst, root = root_cell, neimode = "all", unreachable = FALSE,  :

  Argument `neimode' is deprecated; use `mode' instead

参考:

简书-【单细胞轨迹分析】monocle2

  • 20
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要安装monocle2,您可以按照以下步骤进行操作: 1. 首先,检查一下可用的monocle版本,可以使用以下命令:conda search monocle 2. 创建一个新的conda环境,可以使用以下命令:conda create -n monocle2 3. 激活monocle2环境,可以使用以下命令:conda activate monocle2 4. 安装monocle 2.18.0版本,可以使用以下命令:conda install bioconductor-monocle==2.18.0 5. 在R中加载monocle库,可以使用以下命令:library(monocle,lib.loc="刚刚创建的monocle2环境所在路径/lib/R/library") 如果您之前没有创建conda环境,可以按照上述步骤创建一个新的环境并安装monocle2。\[1\] 希望这可以帮助您安装monocle2!如果您有任何其他问题,请随时提问。 #### 引用[.reference_title] - *1* *2* [linux安装轨迹分析所需Rmonocle2和monocle3的方法](https://blog.csdn.net/x_yAOTU/article/details/126071592)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Monocle操作笔记-1:软件安装](https://blog.csdn.net/flashan_shensanceng/article/details/121402718)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值