服务器丨Linux安装测试单细胞分析软件copykat,遇到的常见报错与解决思路与方法

简介: 服务器丨Linux安装测试单细胞分析软件copykat,遇到的常见报错与解决思路与方法

今天分享的内容是copykat在云服务器Linux端的部署的方法,主要包括安装和测试两大部分,最终的效果是调用服务器进行计算。

测试环境

  • Linux centos 7
  • R 4.2.3
  • minconda3
  • 天意云 24C 192GB

主要的思路是先在linux下创建一个新的conda环境,安装上新版的R,然后再依次安装各种依赖包,但是由于linux系统有时缺少系统支持库文件,因此需要根据报错提示解决各种连锁软件的安装,主要遇到的问题集中在XML、GSVA、httpuv、seurat、RcppEigen、hdf5r等,接来下依次介绍解决办法。

安装步骤

新建环境

最好新建一个环境copykat,该步骤不是必需的。

conda activate copykat
conda install r-base=4.1.2

安装基础软件

checkPkg <- function(pkg){
return(requireNamespace(pkg, quietly = TRUE))
}
if(!checkPkg("BiocManager")) install.packages("BiocManager")
if(!checkPkg("devtools")) install.packages("devtools")

安装依赖软件

library(devtools)
if(!checkPkg("RcppArmadillo")) install.packages("RcppArmadillo")
if(!checkPkg("RcppProgress")) install.packages("RcppProgress")
if(!checkPkg("markdown")) install.packages("markdown")
if(!checkPkg("R.utils")) install.packages("R.utils")
if(!checkPkg("NNLM")) install_github("linxihui/NNLM")
if(!checkPkg("copykat")) install_github("navinlabcode/copykat")
if(!checkPkg("Seurat")) BiocManager::install("Seurat")
if(!checkPkg("knitr")) BiocManager::install("knitr")
if(!checkPkg("GSVA")) BiocManager::install("GSVA")
if(!checkPkg("pheatmap")) BiocManager::install("pheatmap")
if(!checkPkg("ComplexHeatmap")) BiocManager::install("ComplexHeatmap")

安装copykat

install_github("Miaoyx323/stCancer")

如果以上代码运行完没有任何ERROR,恭喜你运气比较好,如果中间出现报错,请接着看下面的内容。

报错与解决办法

XML引起GSVA安装失败

image-20230411190940520

解决方法:退出R,利用conda安装r-XML

conda install r-XML

httpuv引起seurat安装失败

ERROR: failed to lock directory ‘/home/zjw/miniconda3/envs/work/lib/R/library’ for modifying
Try removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/00LOCK-httpuv’
ERROR: failed to lock directory ‘/home/zjw/miniconda3/envs/work/lib/R/library’ for modifying
Try removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/00LOCK-RcppEigen’
ERROR: dependency ‘httpuv’ is not available for package ‘shiny’
* removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/shiny’
  ERROR: dependency ‘shiny’ is not available for package ‘miniUI’
* removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/miniUI’
  ERROR: dependencies ‘miniUI’, ‘shiny’, ‘RcppEigen’ are not available for package ‘Seurat’
* removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/Seurat’

解决方法:添加参数INSTALL_opts = '--no-lock'再安装

install.packages("httpuv",INSTALL_opts = '--no-lock')
conda install r-httpuv

image-20230411191801893

RcppEigen报错

ERROR: failed to lock directory ‘/home/zjw/miniconda3/envs/work/lib/R/library’ for modifying
Try removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/00LOCK-RcppEigen’

解决方法:同上

install.packages("RcppEigen",INSTALL_opts = '--no-lock')
conda install r-RcppEigen

hdf5r报错

Error in Read10X_h5("matrix.h5") :
  Please install hdf5r to read HDF5 files

解决方法:yum安装后用conda安装r-hdf5r

sudo yum install hdf5-devel
# install.packages("hdf5r")
conda install r-hdf5r

hdf5版本过低

configure: error: The version of hdf5 installed on your system is not sufficient. Please ensure that at least version 1.8.13 is installed
ERROR: configuration failed for package ‘hdf5r’
* removing ‘/home/zjw/miniconda3/envs/work/lib/R/library/hdf5r’
The downloaded source packages are in
        ‘/tmp/Rtmpr0m6Da/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("hdf5r") :
  installation of package ‘hdf5r’ had non-zero exit status

如果出现版本不符提示,解决方法:

  1. 下载hdf5-1.8.13的源码
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.13/src/hdf5-1.8.13.tar.bz2
  1. 编译安装
tar xjf hdf5-1.8.13.tar.bz2
cd hdf5-1.8.13
./configure --prefix=$HOME/.local/bin/hdf5-1.8.13
make && make install
  1. 设置环境变量
export PATH=$HOME/.local/bin/hdf5-1.8.13/bin:$PATH
export LD_LIBRARY_PATH=$HOME/.local/bin/hdf5-1.8.13/lib:$LD_LIBRARY_PATH
  1. 重新安装R包hdf5r
install.packages('hdf5r')

使用测试

示例脚本代码

t1 <- Sys.time()
library(copykat)
library(Seurat)
library(hdf5r)
download.file("https://cf.10xgenomics.com/samples/cell-exp/6.0.0/Brain_Tumor_3p/Brain_Tumor_3p_filtered_feature_bc_matrix.h5",
destfile = "matrix.h5")
mat <- Read10X_h5("matrix.h5")
sco <- CreateSeuratObject(mat,project="Glioblastoma")
Glioblastoma <- copykat(rawmat = sco@assays$RNA@counts, sam.name = "Glioblastoma", n.cores = 18)
pred <- data.table::fread("Glioblastoma_copykat_prediction.txt")
table(pred$copykat.pred)
t2 <- Sys.time()

运行结果

29K Apr 11 20:34 Glioblastoma_copykat_clustering_results.rds
 209M Apr 11 20:33 Glioblastoma_copykat_CNA_raw_results_gene_by_cell.txt
 296M Apr 11 20:35 Glioblastoma_copykat_CNA_results.txt
 924K Apr 11 20:35 Glioblastoma_copykat_heatmap.jpeg
  42K Apr 11 20:34 Glioblastoma_copykat_prediction.txt
  71M Apr 11 20:36 Glioblastoma_copykat_with_genes_heatmap.pdf
 7.1M Apr 11 20:26 matrix.h5
  333 Apr 11 20:26 out.log
  533 Apr 11 20:13 testcode.R

image-20230411210300234

测试完成,能够正常使用copykat进行单细胞数据分析,并且能够充分调用服务器计算资源,计算速度相对比较快,通过这个方式能够进行更大规模的单细胞数据分析。

[1] "running copykat v1.1.0"
[1] "step1: read and filter data ..."
[1] "36601 genes, 1615 cells in raw data"
[1] "filtered out 106 cells with less than 200 genes; remaining 1510 cells"
[1] "12101 genes past LOW.DR filtering"
[1] "step 2: annotations gene coordinates ..."
[1] "start annotation ..."
[1] "step 3: smoothing data with dlm ..."
[1] "step 4: measuring baselines ..."
number of iterations= 160
number of iterations= 111
number of iterations= 1030
number of iterations= 193
number of iterations= 186
number of iterations= 234
[1] "step 5: segmentation..."
[1] "step 6: convert to genomic bins..."
[1] "step 7: adjust baseline ..."
[1] "step 8: final prediction ..."
[1] "step 9: saving results..."
[1] "step 10: ploting heatmap ..."
Time difference of 4.411825 mins
参考:https://www.omicsclass.com/article/1637

image-20230411211928280

END

© 素材来源于网络,侵权请联系后台删除

往期推荐:

文献丨群体转录组分析锁定关键转录因子

文献丨转录组RNA seq——青年阶段!

文献丨高通量表型组图像识别与GWAS

笔记丨ggplot2热图入门学习笔记

笔记丨PCA分析基本知识和数学原理

图书丨R语言、Python、Linux

超算丨数据分析时电脑配置不够用?试试

软件 | 如何进行基因家族分析?TBtools

服务器丨家用联想台式机重装Linux系统

转录组丨一套完整的操作流程案例

转录组丨利用limma包进行差异表达分析

Python笔记丨函数和类相关基础知识总结

Python笔记丨条件与循环流程知识总结

Python笔记丨数据类型基础与易错点总结

GWAS丨全基因组关联分析工具GAPIT最新版

数据可视化丨优雅的带显著性标记的箱线散点图

相关文章
|
12月前
|
存储 弹性计算 运维
阿里云服务器全解析:ECS是什么、应用场景、租用流程及优缺点分析
阿里云ECS(Elastic Compute Service)是阿里云提供的高性能、高可用的云计算服务,支持弹性扩展、多样化实例类型和多种计费模式。适用于网站搭建、数据处理、运维测试等多种场景,具备分钟级交付、安全可靠、成本低、易运维等优势,是企业及开发者上云的理想选择。
1261 5
|
Linux API iOS开发
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
567 1
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
|
12月前
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
3820 0
|
存储 安全 Linux
Linux服务器上安装配置GitLab的步骤。
按照以上步骤,一个基础的GitLab服务应该运行并可以使用。记得定期检查GitLab官方文档,因为GitLab的安装和配置步骤可能随着新版本而变化。
1072 0
|
缓存 监控 Linux
Linux 软件安装与卸载
在Linux上,学习安装和卸载软件是基础。以网络监控工具iftop为例,安装涉及下载源码(`wget`),解压(`tar -zxf`),配置(`./configure`),安装依赖(如`libpcap-devel`),再执行`make`和`make install`。另外,可以通过RPM或YUM(在CentOS中可能是DNF)管理软件,如`rpm -ivh`安装,`rpm -e`卸载,`yum install`或`dnf install`同样用于安装。了解这些命令能提升Linux系统的管理效率。
490 0
|
缓存 关系型数据库 MySQL
【Linux入门篇】四种软件查看、安装、卸载方式
【Linux入门篇】四种软件查看、安装、卸载方式
563 0
|
Linux Shell 数据库
Linux软件的安装和卸载
Linux软件的安装和卸载
364 0