拯救单细胞代谢研究!从部署到修复:scFEA 的终极使用攻略

项目地址 changwn/scFEA:单细胞通量估计分析 (scFEA) 尝试下面的 Web 服务器! --- changwn/scFEA: single cell Flux Estimation Analysis (scFEA) Try the below web server! [changwn/scFEA:单细胞通量估计分析 (scFEA) 尝试下面的 Web 服务器! --- changwn/scFEA: single cell Flux Estimation Analysis (scFEA) Try the below web server!](https://github.com/changwn/scFEA)

Download scFEA: 下载 scFEA:

shell 复制代码
git clone https://github.com/changwn/scFEA

Install requirements: 安装要求:

shell 复制代码
cd scFEA
conda install --file requirements
conda install pytorch torchvision -c pytorch
pip install --user magic-impute

装完之后发现可以调出帮助 但是执行python src/scFEA.py就报错了

shell 复制代码
python src/scFEA.py --help
usage: scFEA.py [-h] [--data_dir <data_directory>]
                [--input_dir <input_directory>] [--res_dir <data_directory>]
                [--test_file TEST_FILE] [--moduleGene_file MODULEGENE_FILE]
                [--stoichiometry_matrix STOICHIOMETRY_MATRIX]
                [--sc_imputation {True,False}]

scFEA: A graph neural network model to estimate cell-wise metabolic flux using
single cell RNA-seq data

optional arguments:
  -h, --help            show this help message and exit
  --data_dir <data_directory>
                        The data directory for scFEA model files.
  --input_dir <input_directory>
                        The data directory for single cell input data.
  --res_dir <data_directory>
                        The data directory for result [output]. The output of scFEA includes two matrices, predicted metabolic flux and metabolites
                        stress at single cell resolution.
  --test_file TEST_FILE
                        The test SC file [input]. The input of scFEA is a single cell profile matrix, where row is gene and column is cell. Example
                        datasets are provided in /data/ folder. The input can be raw counts or normalised counts. The logarithm would be performed
                        if value larger than 30.
  --moduleGene_file MODULEGENE_FILE
                        The table contains genes for each module. We provide human and mouse two models in scFEA. For human model, please use
                        module_gene_m168.csv which is default. All candidate moduleGene files are provided in /data/ folder.
  --stoichiometry_matrix STOICHIOMETRY_MATRIX
                        The table describes relationship between compounds and modules. Each row is an intermediate metabolite and each column is
                        metabolic module. For human model, please use cmMat_171.csv which is default. All candidate stoichiometry matrices are
                        provided in /data/ folder.
  --cName_file CNAME_FILE
                        The name of compounds. The table contains two rows. First row is compounds name and second row is corresponding id.
  --sc_imputation {True,False}
                        Whether perform imputation for SC dataset (recommend set to <True> for 10x data).

报错

shell 复制代码
(scFEA) :~/Downloads/scFEA$ python src/scFEA.py
Starting load data...
Load compound name file, the balance output will have compound name.
Load data done.
Starting process data...
Traceback (most recent call last):
  File "/Downloads/scFEA/src/scFEA.py", line 370, in <module>
    main(args)
  File "/Downloads/scFEA/src/scFEA.py", line 172, in main
    geneExprDf = geneExprDf.append(temp, ignore_index = True, sort=False)
  File "/.local/lib/python3.10/site-packages/pandas/core/generic.py", line 5989, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

最坑的来了 作者从没回复过issue, 根据报错提示 ai会提示让降级numpy和pandas 然并卵 降级后就只剩重装了

正确的步骤就是下面这个安装顺序 scFEA需要改函数调用

r 复制代码
mamba install --file requirements  
mamba install pytorch torchvision -c pytorch  
mamba install pytorch torchvision torchaudio cpuonly -c pytorch  # 单cpu 无GPU
mamba install bioconda::magic-impute  

在 Pandas 的最新版本中,DataFrame.append 方法已被废弃,并被 _append 方法取代。因此,代码中使用 .append 方法的部分需要调整以兼容较新的 Pandas 版本。

解决方法:

  1. 替换 append 方法 : 使用 pandas.concat 替代 DataFrame.append,因为这是推荐的标准方法。

    修改以下代码:

    ini 复制代码
    geneExprDf = geneExprDf.append(temp, ignore_index = True, sort=False)

    为:

    ini 复制代码
    geneExprDf = pd.concat([geneExprDf, temp], ignore_index=True)

    注意concat 不支持 sort 参数,所以如果需要排序,可能需要额外处理。

最终 再次运行 完美解决

bash 复制代码
(scFEA) :~/Downloads/scFEA$ python src/scFEA.py
Starting load data...
Load compound name file, the balance output will have compound name.
Load data done.
Starting process data...
Process data done.
Starting train neural network...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:54<00:00,  1.83it/s]
Training time:  54.65031886100769
scFEA job finished. Check result in the desired output folder.
相关推荐
克莱因3583 小时前
Linux CentOS7 进程基础知识
linux·运维·服务器
Skilce4 小时前
ZrLog 高可用部署
运维·服务器·数据库·阿里云·maven
papaofdoudou7 小时前
LINUX VFIO被IOMMUFD取代
linux·运维·服务器
无忧智库8 小时前
智慧医院的“新基建”:从顶层设计到全栈式智能运维的深度解构(PPT)
大数据·运维
杨云龙UP9 小时前
mysqldump逻辑备份文件恢复总结:全库恢复、单库恢复,一篇讲明白
linux·运维·服务器·数据库·mysql·adb
舰长1159 小时前
linux系统服务器加固1、中风险 未设置登录失败处理功能和登录连接超时处理功能。2、中风险 未限制默认账户的访问权限。3、中风险 未实现管理用户的权限分离。
linux·运维·服务器
mounter62510 小时前
Linux 7.0 重磅更新:详解 nullfs 如何重塑根文件系统挂载与内核线程隔离
linux·运维·服务器·kernel
江南风月10 小时前
日志审计系统WGLOG支持syslog吗
运维·网络·日志审计
想唱rap12 小时前
Linux线程
java·linux·运维·服务器·开发语言·mysql
JFSJFX12 小时前
手机短信误删怎么办?这4种恢复办法亲测有效,轻松找回短信
运维·服务器