跳转到主要内容

精确主机读取删除

项目描述

[Tests](https://github.com/EIT-Pathogena/hostile-eit /actions/workflows/test.yml) PyPI version Bioconda version Downloads DOI:10.1101/2023.07.04.547735

logo

敌对 EIT

这个仓库是原始Hostile项目的分支,旨在确保我们使用它的产品的长期支持和可维护性。通过分支原始仓库,我们将更有效地管理更新、修复错误和实现功能,同时保持与原始代码库的核心功能一致。这种方法允许我们针对我们产品的特定需求进行专注的注意,确保它保持健壮和更新。通过积极维护和定期更新,我们旨在提高产品的寿命和性能,并承诺提供通用的修复和支持。

Hostile

Hostile 准确地从短读和长读(元)组中移除宿主序列,消耗配对或非配对 fastq[.gz] 输入。电池已包含在内——首次运行时将下载人类参考基因组。默认情况下,Hostile 很精确,移除比现有方法少一个数量级的微生物读数,同时从1000 Genomes Project样本中移除 >99.5% 的真实人类读数。为了最大限度地保留微生物读数,请使用针对细菌和/或病毒基因组进行屏蔽的现有索引,或使用内置的屏蔽工具创建自己的索引。可以(使用 --rename)用整数替换读头,以提高隐私性和减小FASTQ文件大小。繁重的工作由现有的快速工具(Minimap2/Bowtie2 和 Samtools)完成。对于短(配对)读数,Bowtie2 是默认的对齐器,而对于长读数,Minimap2 是默认的对齐器。在基准测试中,细菌Illumina读数以 32Mbp/s(210k reads/sec)的速度去污染,而细菌ONT读数以 22Mbp/s 的速度去污染,使用 8 个对齐线程。默认情况下,Hostile 去污染短读数需要 4GB 的 RAM,去污染长读数需要 13GB(Minimap2)。更多信息和支持信息可以在 论文博客文章 中找到。请打开一个问题报告问题 其他 联系 我们 以获得帮助、建议等。

索引

默认索引 human-t2t-hla 包含 T2T-CHM13v2.0IPD-IMGT/HLA v3.51,并且在运行Hostile时会自动下载,除非指定了其他索引。使用屏蔽索引可能会略微提高微生物序列的保留率,如下所示。索引 human-t2t-hla-argos985 对包括常见人类病原体的 985参考等级细菌基因组 进行屏蔽,而 human-t2t-hla.argos-bacteria-985_rs-viral-202401_ml-phage-202401 进一步对已知的所有病毒和噬菌体基因组进行屏蔽。后一个应该在使用时优先考虑病毒序列的保留。要使用标准索引,只需将索引名称作为 --index 参数的值传递即可,它会负责下载和缓存相关索引。可以通过使用 --offline 标志禁用自动下载,并且 --index 可以接受自定义参考基因组或 Bowtie2 索引的路径。由牛津大学 ModMedMicro 研究单位 提供的对象存储。

名称 组成 日期 屏蔽位置
human-t2t-hla (默认) T2T-CHM13v2.0 + IPD-IMGT/HLA v3.51 2023-07 0 (0%)
human-t2t-hla-argos985 human-t2t-hla 用150mer屏蔽 [985](https://github.com/EIT-Pathogena/hostile-eit
                                                   /blob/main/paper/supplementary-table-2.tsv) [FDA-ARGOS](https://www.ncbi.nlm.nih.gov/bioproject/231221) **bacterial** genomes                                                        |                                                                          2023-07                                                                           | 317,973 (**0.010%**)   |

| human-t2t-hla.rs-viral-202401_ml-phage-202401 | human-t2t-hla 用150mer屏蔽 18,719 RefSeq 病毒 和 26,928 Millard 实验室 噬菌体 基因组 | 2024-01 | 1,172,993 (0.037%) | | human-t2t-hla.argos-bacteria-985_rs-viral-202401_ml-phage-202401 | human-t2t-hla 用150mer屏蔽 [985](https://github.com/EIT-Pathogena/hostile-eit
/blob/main/paper/supplementary-table-2.tsv) FDA-ARGOS 细菌,18,719 RefSeq 病毒,和 26,928 个 Millard 实验室 噬菌体 基因组 | 2024-01 | 1,473,260 (0.046%) | | human-t2t-hla-argos985-mycob140 | human-t2t-hla 使用 150mer 遮蔽 [985](https://github.com/EIT-Pathogena/hostile-eit)

/blob/main/paper/supplementary-table-2.tsv) FDA-ARGOS **细菌** & [140](https://github.com/EIT-Pathogena/hostile-eit /blob/main/paper/supplementary-table-2.tsv) 结核菌 基因组 | 2023-07 | 319,752 (0.010%) |

论文 中评估了 human-t2t-hlahuman-t2t-hla-argos985-mycob140 的性能

安装 使用 bioconda 安装 使用 Docker 安装

由于存在非 Python 依赖项(Bowtie2、Minimap2、Samtools 和 Bedtools),建议使用 conda/mamba 或 Docker 进行安装。Hostile 在 Ubuntu Linux 22.04、MacOS 12 和 Windows 的 WSL 下进行了测试。

Conda/mamba

conda create -y -n hostile_eit -c conda-forge -c bioconda hostile_eit
conda activate hostile_eit

Docker

wget https://raw.githubusercontent.com/EIT-Pathogena/hostile-eit
/main/Dockerfile
docker build . --platform linux/amd64

还提供了 Biocontainer 图像,但请注意,这通常落后于最新发布的版本

索引安装(可选)

Hostile 首次运行时将自动下载并缓存默认索引 human-t2t-hla,这意味着无需预先下载索引。然而

  • 要下载和缓存默认索引(human-t2t-hla),请运行 hostile fetch

  • 要列出可用的索引,请运行 hostile fetch --list

  • 要下载和缓存另一个标准索引,例如运行 hostile fetch --name human-t2t-hla-argos985。这将下载并缓存短读(Bowtie2)和长读(Minimap2)索引,除非使用例如 --aligner minimap2 限制为其中一个。

  • 要使用自定义基因组(使用 hostile mask 或其他方式创建),使用 --index path/to/genome.fa(用于 Minimap2)或 --index path/to/bowtie2-index-name(用于 Bowtie2)运行 hostile clean。请注意,Minimap2 模式接受 fasta 格式的基因组路径,而 Bowtie2 模式接受预计算的索引路径,不包括 .x.bt2 后缀。可以使用例如 bowtie2-build genome.fa index-name 为 Hostile 创建一个 Bowtie2 索引。

  • 要更改索引存储位置,将环境变量 HOSTILE_CACHE_DIR 设置为您选择的目录。运行 hostile fetch --list 以验证。

命令行用法

$ hostile clean -h
usage: hostile clean [-h] --fastq1 FASTQ1 [--fastq2 FASTQ2] [--aligner {bowtie2,minimap2,auto}] [--index INDEX]
                     [--invert] [--rename] [--reorder] [--out-dir OUT_DIR] [--threads THREADS]
                     [--aligner-args ALIGNER_ARGS] [--force] [--offline] [--debug]

Remove reads aligning to an index from fastq[.gz] input files

options:
  -h, --help            show this help message and exit
  --fastq1 FASTQ1       path to forward fastq[.gz] file
  --fastq2 FASTQ2       optional path to reverse fastq[.gz] file
                        (default: None)
  --aligner {bowtie2,minimap2,auto}
                        alignment algorithm. Default is Bowtie2 (paired reads) & Minimap2 (unpaired reads)
                        (default: auto)
  --index INDEX         name of standard index or path to custom genome/index
                        (default: human-t2t-hla)
  --invert              keep only reads aligning to the target genome (and their mates if applicable)
                        (default: False)
  --rename              replace read names with incrementing integers
                        (default: False)
  --reorder             ensure deterministic output order
                        (default: False)
  --out-dir OUT_DIR     path to output directory
                        (default: /Users/bede/Research/Git/hostile)
  --threads THREADS     number of alignment threads. A sensible default is chosen automatically
                        (default: 5)
  --aligner-args ALIGNER_ARGS
                        additional arguments for alignment
                        (default: )
  --force               overwrite existing output files
                        (default: False)
  --offline             disable automatic index download
                        (default: False)
  --debug               show debug messages
                        (default: False)

短读,默认索引

$ hostile clean --fastq1 human_1_1.fastq.gz --fastq2 human_1_2.fastq.gz
INFO: Hostile version 1.0.0. Mode: paired short read (Bowtie2)
INFO: Found cached standard index human-t2t-hla
INFO: Cleaning…
INFO: Cleaning complete
[
    {
        "version": "1.0.0",
        "aligner": "bowtie2",
        "index": "human-t2t-hla",
        "options": [],
        "fastq1_in_name": "human_1_1.fastq.gz",
        "fastq1_in_path": "/Users/bede/human_1_1.fastq.gz",
        "fastq1_out_name": "human_1_1.clean_1.fastq.gz",
        "fastq1_out_path": "/Users/bede/human_1_1.clean_1.fastq.gz",
        "reads_in": 2,
        "reads_out": 0,
        "reads_removed": 2,
        "reads_removed_proportion": 1.0,
        "fastq2_in_name": "human_1_2.fastq.gz",
        "fastq2_in_path": "/Users/bede/human_1_2.fastq.gz",
        "fastq2_out_name": "human_1_2.clean_2.fastq.gz",
        "fastq2_out_path": "/Users/bede/human_1_2.clean_2.fastq.gz"
    }
]

短读,遮蔽索引,保存日志

$ hostile clean --fastq1 human_1_1.fastq.gz --fastq2 human_1_2.fastq.gz --index human-t2t-hla-argos985 > log.json
INFO: Hostile version 1.0.0. Mode: paired short read (Bowtie2)
INFO: Found cached standard index human-t2t-hla
INFO: Cleaning…
INFO: Cleaning complete

短非配对读,保存日志

默认情况下,假设单个 fastq 为长读。在去除非配对短读时,通过指定 --aligner bowtie2 覆盖此行为。

$ hostile clean --aligner bowtie2 --fastq1 tests/data/human_1_1.fastq.gz > log.json
INFO: Hostile version 1.0.0. Mode: short read (Bowtie2)
INFO: Found cached standard index human-t2t-hla
INFO: Cleaning…
INFO: Cleaning complete

长读

$ hostile clean --fastq1 tests/data/tuberculosis_1_1.fastq.gz
INFO: Hostile version 1.0.0. Mode: long read (Minimap2)
INFO: Found cached standard index human-t2t-hla
INFO: Cleaning…
INFO: Cleaning complete
[
    {
        "version": "1.0.0",
        "aligner": "minimap2",
        "index": "human-t2t-hla",
        "options": [],
        "fastq1_in_name": "tuberculosis_1_1.fastq.gz",
        "fastq1_in_path": "/Users/bede/Research/Git/hostile/tests/data/tuberculosis_1_1.fastq.gz",
        "fastq1_out_name": "tuberculosis_1_1.clean.fastq.gz",
        "fastq1_out_path": "/Users/bede/Research/Git/hostile/tuberculosis_1_1.clean.fastq.gz",
        "reads_in": 1,
        "reads_out": 1,
        "reads_removed": 0,
        "reads_removed_proportion": 0.0
    }
]

Python 用法

from pathlib import Path
from hostile.lib import clean_fastqs, clean_paired_fastqs

# Long reads, defaults
clean_fastqs(
    fastqs=[Path("reads.fastq.gz")],
)

# Paired short reads, various options, capture log
log = clean_paired_fastqs(
    fastqs=[(Path("reads_1.fastq.gz"), Path("reads_2.fastq.gz"))],
    index="human-t2t-hla-argos985",
    out_dir=Path("decontaminated-reads"),
    rename=True,
    force=True,
    threads=4
)

print(log)

遮蔽参考基因组

mask 子命令使得创建自定义遮蔽索引以实现特定目标生物体的最大保留变得简单

hostile mask human.fasta lots-of-bacterial-genomes.fasta --threads 8

您可能希望使用现有的 参考基因组 作为起点。遮蔽使用 Minimap2 将提供的目标基因组中的 150mer 与参考基因组对齐,并使用 bedtools 遮蔽所有对齐区域。创建了遮蔽基因组(用于 Minimap2)和遮蔽 Bowtie2 索引。

限制

  • Hostile 优先保留微生物序列,而不是丢弃宿主序列。如果您努力去除最后一个人类序列,其他方法可能更适合您。
  • 使用所有可用的CPU核心并不总是能提高性能。因此,根据可用的CPU核心数量,会自动选择一个合理的默认值。
  • Minimap2在开始去污之前,对人类基因组索引有30-90秒的开销。令人惊讶的是,加载预构建索引并没有显著加快。我希望在未来版本中减轻这一点。

引用

Bede Constantinides, Martin Hunt, Derrick W Crook, Hostile: accurate decontamination of microbial host sequences, 生物信息学, 2023; btad728, https://doi.org/10.1093/bioinformatics/btad728

@article{10.1093/bioinformatics/btad728,
    author = {Constantinides, Bede and Hunt, Martin and Crook, Derrick W},
    title = {Hostile: accurate decontamination of microbial host sequences},
    journal = {Bioinformatics},
    volume = {39},
    number = {12},
    pages = {btad728},
    year = {2023},
    month = {12},
    issn = {1367-4811},
    doi = {10.1093/bioinformatics/btad728},
    url = {https://doi.org/10.1093/bioinformatics/btad728},
    eprint = {https://academic.oup.com/bioinformatics/article-pdf/39/12/btad728/54850422/btad728.pdf},
}

开发安装

git clone https://github.com/EIT-Pathogena/hostile-eit
.git
cd hostile-eit
conda env create -y -f environment.yml
conda activate hostile-eit
pip install --editable '.[dev]'
pytest

项目详情


下载文件

下载您平台对应的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源分布

hostile_eit-2.0.0rc3.tar.gz (1.8 MB 查看哈希值)

上传时间 源代码

构建分布

hostile_eit-2.0.0rc3-py3-none-any.whl (17.7 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误记录StatusPageStatusPage状态页面