fastp-py 是一个基于 Python 的 fastp 包装工具,专为批量处理 Fastq 文件的质量控制(QC)而设计。它能够并行处理多个样本,并生成类似 fastqc-chip 的标准化输出结构,方便后续分析和报告生成。
当前版本: v1.2.1
qc.report.txt 汇总所有样本的 QC 指标。fastp,也可使用系统路径或指定路径)本工具为单文件 Python 脚本,直接下载 fastp-py 并赋予执行权限即可使用。
chmod +x fastp-py
1. 批量处理目录下的所有 fastq 文件:
./fastp-py /path/to/input_dir /path/to/output_dir
2. 处理单个样本(一对 PE reads):
./fastp-py sample_R1.fastq.gz /path/to/output_dir --read2 sample_R2.fastq.gz --sample sample_name
指定并行进程数:
使用 -p 参数指定并行任务数量(默认为 4)。
./fastp-py input_dir output_dir -p 8
自动检测接头:
使用 -a auto 开启 fastp 的 PE 接头自动检测。
./fastp-py input_dir output_dir -a auto
指定 fastp 路径:
如果 fastp 安装在系统路径中,可以使用 --bin system;或者指定具体路径。
# 使用系统环境变量中的 fastp
./fastp-py input_dir output_dir --bin system
# 使用指定路径的 fastp
./fastp-py input_dir output_dir --bin /usr/local/bin/fastp
查看版本:
./fastp-py -V
# 如果想查看指定路径 fastp 的版本
./fastp-py --bin /path/to/fastp -V
| 参数 | 说明 | 默认值 |
|---|---|---|
input_path | 输入 Fastq 文件目录或 R1 文件路径 | (必选) |
output_path | 输出目录 | (必选) |
-p, --process_num | 并行处理的样本数量 | 4 |
-a, --adapter | 接头序列 (输入 auto 开启自动检测) | TruSeq Adapter... |
--extra-adapters | 额外的接头序列,逗号分隔 | (常见接头) |
--sep | 样本名分隔符 (用于从文件名提取样本名) | _ |
--read2 | R2 文件路径 (仅用于单样本模式) | None |
--sample | 样本名称 (仅用于单样本模式) | 自动提取 |
--bin | fastp 程序路径 (self, system 或具体路径) | self |
--logfile | 日志文件路径 | None |
-v, --verbose | 打印更多调试日志 | False |
-V, --version | 显示版本信息 | - |
以下 fastp 参数已内置默认值,可通过命令行参数覆盖(未在 help 中完全列出,但支持透传):
-q 15: 质量值阈值 (Phred quality score)-u 10: 允许低质量碱基的百分比-n 2: 允许 N 碱基的数量-l 50: 过滤后 Read 的最小长度-y: 开启低复杂度序列过滤 (默认开启)-g: 开启 polyG 尾部修剪 (默认开启)注意: 若要关闭 -g (polyG trimming),可以使用 -G 参数。
输出目录将包含以下内容:
output_dir/ ├── sample1.R1.clean.fastq.gz # 过滤后的 R1 ├── sample1.R2.clean.fastq.gz # 过滤后的 R2 ├── adapter.fa # 使用的接头序列文件 (如果用到) ├── qc.report.txt # 所有样本的 QC 汇总表格 ├── 002/ # 存放未配对或过滤掉的 reads │ ├── sample1.R1.unpair.fastq.gz │ ├── sample1.R2.unpair.fastq.gz │ └── sample1.npass.fastq.gz └── QC/ # 存放详细 QC 报告 ├── sample1.fastp.html # fastp HTML 报告 ├── sample1.fastp.json # fastp JSON 报告 ├── sample1.fastp.log # fastp 运行日志 ├── sample1.qc.json # 转换后的 QC 数据 JSON ├── sample1.clean.fastqc # 用于绘图的数据 └── sample1.fastqc.info # 简要 QC 信息
-q 15 -u 10 -n 2 -l 50 -y -g。--poly_g_min_len,现在使用 fastp 默认值。-y (低复杂度过滤)。--bin 手动指定 fastp 路径(支持 self, system 或绝对路径)。