[meta]
name = "fastp"
category = "qc"
description = "Ultra-fast FASTQ preprocessor with quality control, adapter trimming, and filtering"
tags = ["qc", "trimming", "adapter", "fastq", "quality-control", "ngs", "illumina"]
author = "oxo-call built-in"
source_url = "https://github.com/OpenGene/fastp"

[context]
concepts = [
    "fastp performs QC + adapter trimming in a single pass; it auto-detects Illumina adapters without specification.",
    "Use -i/-I for paired-end input (R1/R2) and -o/-O for paired-end output; -i/-o for single-end.",
    "fastp outputs an HTML report (-h) and JSON report (-j) by default; always specify meaningful output filenames.",
    "Use -w N for multi-threading (default: 16 if available); -q for quality threshold (default: 15); -l for minimum length.",
    "fastp --dedup enables deduplication for PCR duplicate removal (slower but no need for samtools markdup).",
    "For UMI-based data, use --umi --umi_loc=read1 (or read2/index1/index2/per_index/per_read).",
]

pitfalls = [
    "For paired-end data, use -i R1.fq -I R2.fq and -o clean_R1.fq -O clean_R2.fq (uppercase for R2).",
    "The default fastp output filenames are output.fastq and output2.fastq — always specify -o and -O explicitly.",
    "fastp generates fastp.html and fastp.json by default — redirect with -h and -j for better organization.",
    "For polyA trimming (RNA-seq), add --trim_poly_a.",
    "--adapter_sequence only works for single-end; for paired-end use --adapter_sequence AND --adapter_sequence_r2.",
]

[[examples]]
task = "quality trim and filter paired-end FASTQ reads with 8 threads"
args = "-i R1.fastq.gz -I R2.fastq.gz -o clean_R1.fastq.gz -O clean_R2.fastq.gz -h report.html -j report.json -w 8"
explanation = "-i/-I for R1/R2 input; -o/-O for R1/R2 output; -h/-j for HTML and JSON reports"

[[examples]]
task = "trim adapters from single-end reads and filter reads shorter than 50 bp"
args = "-i reads.fastq.gz -o clean_reads.fastq.gz -l 50 -h report.html -j report.json"
explanation = "-l 50 discards reads shorter than 50 bp after trimming; auto-detects adapters"

[[examples]]
task = "quality trim paired-end reads and set minimum quality to 20"
args = "-i R1.fq.gz -I R2.fq.gz -o out_R1.fq.gz -O out_R2.fq.gz -q 20 -l 36 -w 8 -h qc.html -j qc.json"
explanation = "-q 20 sets minimum base quality; -l 36 minimum read length after trimming"

[[examples]]
task = "run fastp on paired-end RNA-seq data with polyA trimming"
args = "-i R1.fq.gz -I R2.fq.gz -o out_R1.fq.gz -O out_R2.fq.gz --trim_poly_a -w 8 -h rna_qc.html -j rna_qc.json"
explanation = "--trim_poly_a removes polyA tails common in RNA-seq data"

[[examples]]
task = "quality control only (no trimming, just generate the QC report)"
args = "-i R1.fq.gz -I R2.fq.gz -o /dev/null -O /dev/null --disable_adapter_trimming --disable_quality_filtering -h qc_report.html -j qc_report.json"
explanation = "output to /dev/null and disable filters to get a pure QC report without modifying reads"
