funannotate2: 真核生物基因组注释流程
Funannotate2 是一个全面的真核生物基因组注释流程,为真核生物基因组注释提供完整的工作流。它集成了多种工具和数据库,以生成高质量的基因预测和功能注释。
快速入门:安装
Docker(推荐)
一个包含所有 bioconda 工具(augustus、minimap2、miniprot、snap、glimmerhmm、diamond、trnascan-se、table2asn、……)、funannotate2、funannotate2-addons、helixerlite 以及预下载数据库的预构建镜像,会在每个标记版本发布时发布到 Docker Hub 和 GHCR。
# pull the latest image (~8 GB; databases are baked in)
docker pull nextgenusfs/funannotate2:latest
# or from GHCR
docker pull ghcr.io/nextgenusfs/funannotate2:latest
# quick sanity check
docker run --rm nextgenusfs/funannotate2:latest funannotate2 --version
docker run --rm nextgenusfs/funannotate2:latest funannotate2 install -s
# run against a local data directory, persisting the BUSCO cache across runs
mkdir -p $PWD/data $PWD/busco_cache
docker run --rm -it \
-v $PWD/data:/data \
-v $PWD/busco_cache:/opt/busco_cache \
-e BUSCO_DOWNLOAD_PATH=/opt/busco_cache \
nextgenusfs/funannotate2:latest \
funannotate2 predict -i /data/genome.fa -o /data/out --species "My species"
备注:
- 该镜像仅为
linux/amd64;在 Apple Silicon 上,它通过 Rosetta 2 模拟运行(Docker Desktop 会自动处理此过程)。 - BUSCO 谱系未打包(未压缩约 90 GB)——请如上所示挂载主机目录,以便它们仅下载一次并可重复使用。
- 未包含 GeneMark(受许可证限制);如需使用,请在本地安装并将其挂载到容器中。
使用 pixi
如果您偏好不使用 Docker 的原生安装,该仓库附带了一个 pixi 工作区(pixi.toml / pixi.lock),可在 linux-64 上解析完整环境:
# install pixi once (see https://pixi.sh/latest/#installation)
curl -fsSL https://pixi.sh/install.sh | bash
# clone and install the locked environment
git clone https://github.com/nextgenusfs/funannotate2.git
cd funannotate2
pixi install --locked
# activate and install databases
pixi shell
export FUNANNOTATE2_DB=/path/to/funannotate2-db
funannotate2 install -d all
pixi 环境目前仅针对 linux-64 定义。macOS 用户应使用 Docker。
Linux 系统 (conda)
在推送到 bioconda 之前,您可以尝试以下方法:
conda create -n funannotate2 gfftk gapmm2 minimap2 miniprot snap "augustus==3.5.0" glimmerhmm diamond trnascan-se table2asn gb-io buscolite
conda activate funannotate2
python -m pip install funannotate2
Apple Silicon (M 系列)
在 Apple Silicon (M 系列) 上安装稍微复杂一些,因为存在某些依赖问题以及部分软件的非原生构建。 我未能找到或构建一个可运行的 augustus 版本,因此我改为在本地使用 Docker 运行 augustus 和 genemark。 我设置了两个包含操作说明的仓库(需要安装 Docker Desktop),之后需要将 bash 包装文件放入 PATH 中以模拟 CLI 界面。
https://github.com/nextgenusfs/dockerized-augustus
https://github.com/nextgenusfs/dockerized-genemark
一旦该步骤成功,你就可以使用 conda 安装大部分剩余的依赖项,不过我们需要排除 buscolite 和 funannotate2,因为它们将 augustus 作为依赖项,因此我们将使用 pip 安装这些 python 包。conda 中的 mkl<2022 是为了避免在 apple silicon 上使用 intel mkl 包时出现的烦人警告。
# first install most of the dependencies
conda create -n funannotate2 --platform osx-64 "python>=3.7,<3.13" gfftk gapmm2 minimap2 miniprot snap glimmerhmm diamond trnascan-se gb-io pyhmmer pyfastx requests json-repair pytantan "mkl<2022"
# we can then add the required FUNANNOTATE2_DB env variable to the conda environment, note need to reactivate to use it
conda activate funannotate2
conda env config vars set FUNANNOTATE2_DB=/path/to/funannotate2-db
conda env config vars set AUGUSTUS_CONFIG_PATH=/path/to/augustus-3.5.0/config
conda deactivate
# now reactivate environment, and install the remaining python dependencies with pip
conda activate funannotate2
python -m pip install buscolite git+https://github.com/nextgenusfs/funannotate2.git
# now we can install the databases
funannotate2 install -d all
其他/手动安装
由于许可协议的限制,genemarkHMM 等额外工具必须手动安装。
funannotate2 是一个 python 包,要安装发布版本,请使用 pip 包管理器,如下所示:
pip install funannotate2
或者,要从 github 仓库安装最新开发版本:
python -m pip install git+https://github.com/nextgenusfs/funannotate2.git
开发
测试
Funannotate2 包含单元测试和集成测试,以确保代码正确运行。
运行测试
要运行测试,您需要以开发模式安装 pytest 和该包:
# Install pytest and coverage tools
pip install pytest pytest-cov
# Install funannotate2 in development mode
pip install -e .
# Run all tests
pytest
# Run with coverage report
pytest --cov=funannotate2
# Generate HTML coverage report
python scripts/run_coverage.py
有关测试的更多信息,请参阅 TESTING.md 文件。
开发依赖项
要参与 funannotate2 的开发,您需要安装开发依赖项:
pip install pytest pytest-cov
文档
Funannotate2 包含全面的文档,涵盖安装、使用、API 参考等内容。要构建文档:
# Install Sphinx and the theme
pip install sphinx sphinx_rtd_theme
# Build the documentation
cd docs
make html
构建的文档将位于 docs/_build/html 目录中。
有关文档的更多信息,请参阅 docs/README.md 文件。
运行测试
安装开发依赖项后,您可以使用以下命令运行测试:
python -m pytest
要运行带有覆盖率报告的测试:
python -m pytest --cov=funannotate2 --cov-report=term-missing
或者使用提供的脚本生成 HTML 覆盖率报告:
python scripts/run_coverage.py
要安装此仓库中最新的代码,您可以运行:
python -m pip install git+https://github.com/nextgenusfs/funannotate2.git --upgrade --force --no-deps
引用
Funannotate2 包含一个 CITATION.cff 文件,其中提供了该软件的引用信息。当创建新发布版本时,此文件中的版本号和发布日期会自动更新。
要在您的工作中引用 funannotate2,您可以使用 CITATION.cff 文件中的引用信息,或使用诸如 citeas.org 之类的工具生成您所需格式的引用。