M1芯片的mac如何安装单细胞轨迹分析软件monocle3

154

1. 前言

想给单细胞数据进行拟时序分析,需要下载一个相关的软件。
这类软件挺多的,但最经典的还是monocle,目前最新版是monocle3(20220217)。
但是这个软件依赖非常多,挺难安装的,在monocle3 github主页的issue和其google group里报告了许许多多的安装bug,而且作者现在也几乎不回复了。
另外,我想做的是在使用m1芯片mac的rosetta2环境下安装monocle3,这可能就更难了。在中/英文网上做了大量的搜索,也没有找到好的解答。
但经过一个礼拜的攻坚,最终是安装成功了。

2. 安装

首先就是要在终端里使用homebrew安装这两个玩意

# terminal
brew install pkg-config
brew install gdal

另外就是要额外安装一个gfortran,而且不能用Homebrew的(brew install gcc)命令安装,因为这样会安装到错误的路径。
在安装gfortran时候,需要去github下载,注意要下载成intel版本而不是ARM版本的,估计是因为我的R也是intel版本的。
最终我安装的是最新的intel版本的,文件名gfortran-Intel-11.2-Monterey.dmg。安装时使用默认选项就好。
gfortran下载地址
之后就是根据Monocle3官方的教程,在R里进行正常安装就好了。

# R
if (!requireNamespace("BiocManager", quietly = TRUE))

install.packages("BiocManager")

install.packages("devtools")

devtools::install_github('cole-trapnell-lab/leidenbase')

devtools::install_github('cole-trapnell-lab/monocle3')

library(monocle3) #看能否正常加载

顺便附上我使用的版本和镜像

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.1

> BiocManager::version()
[1] ‘3.14’

> options("repos") # R镜像
$repos
                                        CRAN 
"https://mirrors.tuna.tsinghua.edu.cn/CRAN/" 

> repositories() # Bioconductor镜像
'getOption("repos")' replaces Bioconductor standard repositories,
see '?repositories' for details

replacement repositories:
    CRAN: https://mirrors.tuna.tsinghua.edu.cn/CRAN/

                                                BioCsoft 
           "https://bioconductor.org/packages/3.14/bioc" 
                                                 BioCann 
"https://bioconductor.org/packages/3.14/data/annotation" 
                                                 BioCexp 
"https://bioconductor.org/packages/3.14/data/experiment" 
                                           BioCworkflows 
      "https://bioconductor.org/packages/3.14/workflows" 
                                               BioCbooks 
          "https://bioconductor.org/packages/3.14/books" 
                                                    CRAN 
            "https://mirrors.tuna.tsinghua.edu.cn/CRAN/" 

3. 20231222更新

用ggtree,对之前的特性不满意,一看已经迭代了不少版本了,想更新到最新版,即v3.4.4到3.10.0。但是3.10.0只支持R v4.3版本,脑子一热就把R从v4.2.2更新成v4.3.2。现在所有R包全部得重新安装,再次陷入恐惧= =

果然,R 4.3版本的monocle3又安装不上了,我去安装了我的电脑能安装的最新的gfortran-Intel-12.2-Ventura.dmg,还是安装不上monocle3,monocle3这个垃圾软件呀

按官网给的安装方法多安装了几次竟然安装上了,看来我可以完全切换到4.3版本了?

附官网给的安装方法,好像跟我之前安装的时候不一样了?没有安装leidenbase那一步了。

但即使用以下命令,也不是一次安装好的,多重复安装了几次才安装好,奇怪啊……

BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
                       'limma', 'lme4', 'S4Vectors', 'SingleCellExperiment',
                       'SummarizedExperiment', 'batchelor', 'HDF5Array',
                       'terra', 'ggrastr'))

devtools::install_github('cole-trapnell-lab/monocle3')