服务器丨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最新版

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

相关文章
|
存储 弹性计算 缓存
阿里云服务器ECS经济型、通用算力、计算型、通用和内存型选购指南及使用场景分析
本文详细解析阿里云ECS服务器的经济型、通用算力型、计算型、通用型和内存型实例的区别及适用场景,涵盖性能特点、配置比例与实际应用,助你根据业务需求精准选型,提升资源利用率并降低成本。
960 3
|
Oracle 关系型数据库 Linux
VirtualBox 7.1.10 (macOS, Linux, Windows) - 开源跨平台虚拟化软件
VirtualBox 7.1.10 (macOS, Linux, Windows) - 开源跨平台虚拟化软件
1223 0
VirtualBox 7.1.10 (macOS, Linux, Windows) - 开源跨平台虚拟化软件
|
Java 测试技术 网络安全
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
718 0
Burp Suite Professional 2025.10 for Windows x64 - 领先的 Web 渗透测试软件
|
Linux API iOS开发
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
765 1
Blender 4.5 (Linux, macOS, Windows) - 开源 3D 创意软件 (渲染 建模 雕刻)
|
存储 弹性计算 运维
阿里云服务器全解析:ECS是什么、应用场景、租用流程及优缺点分析
阿里云ECS(Elastic Compute Service)是阿里云提供的高性能、高可用的云计算服务,支持弹性扩展、多样化实例类型和多种计费模式。适用于网站搭建、数据处理、运维测试等多种场景,具备分钟级交付、安全可靠、成本低、易运维等优势,是企业及开发者上云的理想选择。
1491 5
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
Linux 虚拟化 iOS开发
VirtualBox 7.2.0 (macOS, Linux, Windows) - 开源跨平台虚拟化软件
VirtualBox 7.2.0 (macOS, Linux, Windows) - 开源跨平台虚拟化软件
2036 0
|
Linux 网络安全 数据安全/隐私保护
使用Linux系统的mount命令挂载远程服务器的文件夹。
如此一来,你就完成了一次从你的Linux发车站到远程服务器文件夹的有趣旅行。在这个技术之旅中,你既探索了新地方,也学到了如何桥接不同系统之间的距离。
2422 21
|
Java Linux 网络安全
Linux云端服务器上部署Spring Boot应用的教程。
此流程涉及Linux命令行操作、系统服务管理及网络安全知识,需要管理员权限以进行配置和服务管理。务必在一个测试环境中验证所有步骤,确保一切配置正确无误后,再将应用部署到生产环境中。也可以使用如Ansible、Chef等配置管理工具来自动化部署过程,提升效率和可靠性。
1443 13
|
Linux iOS开发 MacOS
Krita 5.2.10 (Linux, macOS, Windows) - 开源免费绘画软件
Krita 5.2.10 (Linux, macOS, Windows) - 开源免费绘画软件
931 0
Krita 5.2.10 (Linux, macOS, Windows) - 开源免费绘画软件