BSD 2-Clause "Simplified" License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度技术分析:tanghaibao/jcvi

项目背景与痛点

随着新一代测序技术的发展,基因组学研究生成的数据量呈现出爆炸性增长。高通量测序数据的处理、组装和注释是一项复杂且耗时的工作。jcvi 是由 Tang Haibao 开发的 Python 库,专注于解决基因组组装、注释以及比较基因组学的问题。它旨在自动化并简化大型基因组数据的处理流程,使得遗传学家和其他科研工作者能够更高效地利用这些数据进行研究和发现。

基因组组装涵盖了从原始测序读数到最后的基因组序列组装的多个步骤。高性能计算、存储和算法的效率都是当前研究过程中面临的重要挑战。jcvi 正是为了解决这些问题而创建,侧重于提供全面的工具和算法来处理和分析基因组数据。

核心技术揭秘

jcvi 采用模块化的设计思路,包含了十几个子模块,每个子模块都承担了特定的任务。整体技术架构围绕数据处理流程,从读数的质量控制、比对、组装到后续的基因预测、注释以及比较基因组学分析。

对于数据流程,使用简洁的数据流图来彰显信息流动机制:

graph TD A[输入测序数据] --> B[预处理(质量控制)] B --> C{"比对"} C -->|"核对尝试1"| D[使用BWA比对] C -->|"核对尝试2"| E[使用Bowtie比对] D --> F[合并读取] E --> F F --> G[读取组装] G --> H[基因预测] H --> I[基因注释] I --> J[比较基因组学分析]

jcvi 中的各项工具基于不同的生物信息学算法和策略,能够应对从读取数据输入到高级分析的整个流水线。譬如,它利用了 BWA 和 Bowtie 等成熟的工具进行测序数据分析,并提供了封装在库内的调用接口,简化了操作流程。

功能亮点与差异

相比于其他同类工具如 Assemblytics、augustus、Maker 等,jcvi 立足于将其所有功能集合在一个包中,尽可能减少编码和协调不同工具间的任务繁琐性。其灵活性不仅在于支持基因长度、多条染色体、RNA 数据等多种输入格式,还体现在配置的自定义方面。虽然这些工具可能在单独使用时更加专注其特定的处理步骤,但在面对一个完整的基因组学研究流程时,jcvi 一键式解决方案无疑是一个极大的优势。

应用场景与落地建议

jcvi 非常适合那些需要全面功能和弹性的基因组学研究,特别适用于比较基因组学研究,在这种情况下,一个工具从头到尾处理所有数据流以确保数据的一致性和便于综合分析极为重要。生产环境中,用户需要有足够的计算资源来运行高负荷的比对和组装任务,并且可能需要调整某些工具的参数来优化性能或为特定类型的数据提供最佳结果。

了解输入数据的质量和适用性也是关键因素。例如,对于不同的测序技术(如Illumina、PacBio或Oxford Nanopore),必须选择合适的方法来处理数据,以实现最佳组装结果。

综合评价

优点

  • 组合集成度高:jcvi 提供了广泛的集成工具,使研究者能够快速开始实验,而无需配置多个工具和工作流程。
  • 灵活性:支持多种数据格式输入,包括 RNA-seq、多基因组和长读取数据,极大增强了工具的适应性。
  • 模块化设计理念:每个功能模块负责特定任务,易于理解、维护和扩展。

缺点

  • 资源需求:某些高阶处理任务可能会消耗大量的计算资源,对于资源有限的实验室或小型项目组可能是一大挑战。
  • 复杂性:由于工具链庞大且功能丰富,新手用户可能会觉得初始使用阶段有些难度。

总体来看,jcvi 是一个令人印象深刻的工具包,专为基因组学研究者所设,适用于对大数据拥有处理能力及需求的研究场景。其强大的功能集合和模块化的设计使其拥有广泛的应用前景。

关于

GitHub 原始描述(英文)

Python library to facilitate genome assembly, annotation, and comparative genomics

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Cython
Dockerfile
Makefile
Python

README

JCVI: A Versatile Toolkit for Comparative Genomics Analysis

Latest PyPI version bioconda Github Actions Downloads

Collection of Python libraries to parse bioinformatics files, or perform computation related to assembly, annotation, and comparative genomics.

Authors Haibao Tang (tanghaibao)
Vivek Krishnakumar (vivekkrish)
Adam Taranto (Adamtaranto)
Xingtan Zhang (tangerzhang)
Won Cheol Yim (wyim-pgl)
Email [email protected]
License BSD

How to cite

Tip 提示

JCVI is now published in iMeta!

Tang et al. (2024) JCVI: A Versatile Toolkit for Comparative Genomics Analysis. iMeta

MCSCAN example

ALLMAPS animation

GRABSEEDS example

Contents

Following modules are available as generic Bioinformatics handling methods.

  • algorithms

    • Linear programming solver with SCIP and GLPK.
    • Supermap: find set of non-overlapping anchors in BLAST or NUCMER output.
    • Longest or heaviest increasing subsequence.
    • Matrix operations.
  • apps

    • GenBank entrez accession, Phytozome, Ensembl and SRA downloader.
    • Calculate (non)synonymous substitution rate between gene pairs.
    • Basic phylogenetic tree construction using PHYLIP, PhyML, or RAxML, and viualization.
    • Wrapper for BLAST+, LASTZ, LAST, BWA, BOWTIE2, CLC, CDHIT, CAP3, etc.
  • formats

    Currently supports .ace format (phrap, cap3, etc.), .agp (goldenpath), .bed format, .blast output, .btab format, .coords format (nucmer output), .fasta format, .fastq format, .fpc format, .gff format, obo format (ontology), .psl format (UCSC blat, GMAP, etc.), .posmap format (Celera assembler output), .sam format (read mapping), .contig format (TIGR assembly format), etc.

  • graphics

    • BLAST or synteny dot plot.
    • Histogram using R and ASCII art.
    • Paint regions on set of chromosomes.
    • Macro-synteny and micro-synteny plots.
    • Ribbon plots from whole genome alignments.
  • utils

    • Grouper can be used as disjoint set data structure.
    • range contains common range operations, like overlap and chaining.
    • Miscellaneous cookbook recipes, iterators decorators, table utilities.

Then there are modules that contain domain-specific methods.

  • assembly

    • K-mer histogram analysis.
    • Preparation and validation of tiling path for clone-based assemblies.
    • Scaffolding through ALLMAPS, optical map and genetic map.
    • Pre-assembly and post-assembly QC procedures.
  • annotation

    • Training of ab initio gene predictors.
    • Calculate gene, exon and intron statistics.
    • Wrapper for PASA and EVM.
    • Launch multiple MAKER processes.
  • compara

    • C-score based BLAST filter.
    • Synteny scan (de-novo) and lift over (find nearby anchors).
    • Ancestral genome reconstruction using Sankoff’s and PAR method.
    • Ortholog and tandem gene duplicates finder.

Applications

Please visit wiki for full-fledged applications.

Dependencies

JCVI requires Python3 between v3.9 and v3.12.

Some graphics modules require the ImageMagick library.

On MacOS this can be installed using Conda (see next section). If you are using a linux system (i.e. Ubuntu) you can install ImageMagick using apt-get:

sudo apt-get update
sudo apt-get install libmagickwand-dev

See the Wand docs for instructions on installing ImageMagick on other systems.

A few modules may ask for locations of external programs, if the executable cannot be found in your PATH.

The external programs that are often used are:

Managing dependencies with uv

You can use uv to create and manage a project environment from pyproject.toml and uv.lock.

uv sync --extra tests

Run commands inside the managed environment with uv run, for example:

uv run jcvi --version
uv run pytest

Managing dependencies with Conda

You can use the YAML files in this repo to create an environment with basic JCVI dependencies.

If you are new to Conda, we recommend the Miniforge distribution.

conda env create -f environment.yml

conda activate jcvi

After activating the Conda environment install JCVI using one of the following options.

Installation

Installation options

  1. Use uv to install dependencies and set up a local development environment.
git clone git://github.com/tanghaibao/jcvi.git && cd jcvi
uv sync --extra tests
pre-commit install
  1. Use pip to install the latest development version directly from this repo.
pip install git+https://github.com/tanghaibao/jcvi.git
  1. Install latest release from PyPi.
pip install jcvi
  1. Alternatively, if you want to install in development mode with pip.
git clone git://github.com/tanghaibao/jcvi.git && cd jcvi
pip install -e '.[tests]'
pre-commit install

Test Installation

If installed successfully, you can check the version with:

jcvi --version

Usage

Use python -m to call any of the modules installed with JCVI.

Most of the modules in this package contains multiple actions. To use the fasta example:

Usage:
    python -m jcvi.formats.fasta ACTION


Available ACTIONs:
          clean | Remove irregular chars in FASTA seqs
           diff | Check if two fasta records contain same information
        extract | Given fasta file and seq id, retrieve the sequence in fasta format
          fastq | Combine fasta and qual to create fastq file
         filter | Filter the records by size
         format | Trim accession id to the first space or switch id based on 2-column mapping file
        fromtab | Convert 2-column sequence file to FASTA format
           gaps | Print out a list of gap sizes within sequences
             gc | Plot G+C content distribution
      identical | Given 2 fasta files, find all exactly identical records
            ids | Generate a list of headers
           info | Run `sequence_info` on fasta files
          ispcr | Reformat paired primers into isPcr query format
           join | Concatenate a list of seqs and add gaps in between
     longestorf | Find longest orf for CDS fasta
           pair | Sort paired reads to .pairs, rest to .fragments
    pairinplace | Starting from fragment.fasta, find if adjacent records can form pairs
           pool | Pool a bunch of fastafiles together and add prefix
           qual | Generate dummy .qual file based on FASTA file
         random | Randomly take some records
         sequin | Generate a gapped fasta file for sequin submission
       simulate | Simulate random fasta file for testing
           some | Include or exclude a list of records (also performs on .qual file if available)
           sort | Sort the records by IDs, sizes, etc.
        summary | Report the real no of bases and N's in fasta files
           tidy | Normalize gap sizes and remove small components in fasta
      translate | Translate CDS to proteins
           trim | Given a cross_match screened fasta, trim the sequence
      trimsplit | Split sequences at lower-cased letters
           uniq | Remove records that are the same

Then you need to use one action, you can just do:

python -m jcvi.formats.fasta extract

This will tell you the options and arguments it expects.

Feel free to check out other scripts in the package, it is not just for FASTA.

Star History

Star History
Chart

评论

暂无评论