新建一个conda环境,安装4.3.3版本的R,并将此版本的R内核添加到Jupyter
conda create -n Seuratv5
conda install r-base=4.3.3
install.package(c('repr','IRdisplay','evaluate','crayon','pbdZMQ','uuid','digest','devtools'))
#devtools安装报错,提示没有usethis
#一气之下,我选择使用conda安装
conda install -c bioconda r-devtools
devtools::install_github(IRkernel/IRkernel)
conda install -c r r-irkernel #方法2
#报错
jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 1.
#解决方式
#参考https://github.com/IRkernel/IRkernel/issues/713
#
github上的解答如下:
jupyter-client has to be installed but "jupyter kernelspec --version" exited with code 1.
means that the jupyter command is in your PATH, but jupyter-client isn’t installed
似乎是jupyter-client未安装
pip install jupyter-client
IRkernel::installspec(name='Seuratv5',displayname='Seuratv5_R')
R中Seuratv5安装参考2个教程
Analysis, visualization, and integration of Visium HD spatial datasets with Seurat • Seurat
可以基于github(见第二个链接)或者CRAN(见第一个链接)进行安装
本次尝试使用CRAN安装
install.packages("SeuratObject")
#报错,提示Matrix无法安装
#参考解决方式 https://blog.youkuaiyun.com/weixin_64317226/article/details/134651916
remotes::install_version("Matrix", version = "1.6.4")
install.packages("SeuratObject")
Index of /src/contrib/Archive/MASS
install.packages("Seurat")
#提示MASS未安装
#直接使用CRAN安装,但是CRAN中只包含两个最新版本MASS,适用于R_version>4.4,安装不上,无法选择之前的旧版本
#github源 https://github.com/cran/MASS/releases github源也只有新版本的MASS
#devtools::install_github(url)
#CRAN源 https://cran.r-project.org/src/contrib/Archive/MASS/
install.packages("https://cran.r-project.org/src/contrib/Archive/MASS/MASS_7.3-60.tar.gz", repos=NULL, type="source")
还可以依赖安装一些相关的包,提高运算效率
#Seurat does not require, but makes use of, packages developed by other labs that can substantially enhance speed and performance. These include presto (Korunsky/Raychaudhari labs), BPCells (Greenleaf Lab), and glmGamPoi (Huber Lab). We recommend users install these along with Seurat:
install.packages(c("BPCells", "presto", "glmGamPoi"))
#BPCells安装缺乏hdf5环境
#解决hdf5环境问题后重新安装
官网推荐安装以下四个包,作用详见注释
#We also recommend installing these additional packages, which are used in our vignettes, and enhance the functionality of Seurat:
#Signac: analysis of single-cell chromatin data
#SeuratData: automatically load datasets pre-packaged as Seurat objects
#Azimuth: local annotation of scRNA-seq and scATAC-seq queries across multiple organs and tissues
#SeuratWrappers: enables use of additional integration and differential expression methods
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes")
}
install.packages('Signac')
#报错显示缺乏Rsamtools
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Rsamtools")
#重新安装Singac
install.packages('Signac') #成功
remotes::install_github("satijalab/seurat-data", quiet = TRUE)#成功
#azimuth提示Hdf5r异常,hdf5r安装又需要依赖Linux下的hdf5编译器
remotes::install_github("satijalab/seurat-wrappers", quiet = TRUE) #成功
hdf5安装-CentOs系统
#hdf5源网页
#https://support.hdfgroup.org/downloads/hdf5/hdf5_1_14_5.html
#https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_5/downloads/index.html
wget https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_5/downloads/hdf5-1.14.5.tar.gz
tar zxf hdf5-1.14.5.tar.gz
cd hdf5-1.14.5/
sudo ./configure --prefix=/usr/local/hdf5
sudo make
sudo make install
make check-install
尝试安装hdf5r 安装过程出错的解决方案
devtools::install_github(repo = "hhoeflin/hdf5r")
configure: WARNING:
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
configure: error: hdf5 does not seem to be installed on your platform.
Please install the hdf5 library.
The required HDF5 library files can be installed as follows:
- Debian-based (e.g. Debian >= 8.0, Ubuntu >= 15.04): 'sudo apt-get install libhdf5-dev'
- Old Debian-based (e.g Debian < 8.0, Ubuntu < 15.04): Install from source (see INSTALL)
- OS X using Homebrew: 'brew install hdf5'
- RPM-based (e.g Fedora): 'sudo yum install hdf5-devel'
ERROR: configuration failed for package ‘hdf5r’
* removing ‘/home/xintong/anaconda3/envs/Seuratv5/lib/R/library/hdf5r’
Warning message:
In i.p(...) :
安装程序包‘/home/xintong/RTEMP/RtmpwOamRI/file34c24c9c946/hdf5r_1.3.11.tar.gz’时退出狀態的值不是0
此处提示R找不到h5cc和h5pcc的地址,因此
install.packages("hdf5r", configure.args="--with-hdf5=/usr/local/hdf5/bin/h5cc")
Error: package or namespace load failed for ‘hdf5r’ in dyn.load(file, DLLpath = DLLpath, ...):
无法载入共享目标对象‘/home/xintong/anaconda3/envs/Seuratv5/lib/R/library/00LOCK-hdf5r/00new/hdf5r/libs/hdf5r.so’::
libhdf5_hl.so.310: 无法打开共享对象文件: 没有那个文件或目录
错误: 载入失败
停止执行
这表明加载包的时候不能识别 hdf5 的动态库,实际包已经安装好了,只是不能加载 hdf5 动态库,需要手动配置 hdf5 动态库 libhdf5_hl.so.310
向R的配置文件中加入以下内容,这一步非常重要,解决了这一步就成功安装上了
echo dyn.load('/usr/local/hdf5/lib/libhdf5_hl.so.310') >> ~/.Rprofile
便可解决这个问题
上面的解决办法是在 R 中进行,分为两步,一是指定 h5cc路径,二是加载 libhdf5_hl.so.100库。那么我们可以通过把 h5cc 加到路径中或者是链接到 /usr/local/bin下,然后把 hdf5 库添加到 LD_LIBRARY_PATH.
#软连接到/usr/local/bin 我理解这部分内容比较类似于将hdf5中的内容添加到系统环境变量中,因此R能识别到hdf5相关编译器,与这部分下列注释的代码可能有异曲同工之妙
#install.packages("hdf5r", configure.args="--with-hdf5=/usr/local/hdf5/bin/h5cc")
for f in /usr/local/hdf5/bin/* ; do ln -s $f /usr/local/bin ; done \
#LD配置
echo /usr/local/hdf5/lib > /etc/ld.so.conf.d/hdf5.conf
然后安装即可
install.packages(“hdf5r”) 成功
虽说能解决hdf5r的安装问题,但是BPCells仍然安装不上,因此用conda安装hdf5,然后安装BPCells成功
conda install -c anaconda hdf5
remotes::install_github("bnprks/BPCells/r")
#remotes::install_github("satijalab/azimuth", quiet = TRUE)报错显示BSgenome.Hsapiens.UCSC.hg38安装失败
BiocManager::install("BSgenome.Hsapiens.UCSC.hg38")
2472

被折叠的 条评论
为什么被折叠?



