MCPcopy Create free account
hub / github.com/OpenGene/fastp

github.com/OpenGene/fastp @v1.3.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3.6 ↗ · + Follow
528 symbols 966 edges 64 files 10 documented · 2% updated 4d agov1.3.6 · 2026-06-29★ 2,395386 open issues

Browse by type

Functions 451 Types & classes 77
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

install with conda install with conda DebianBadge European Galaxy server

fastp

A tool designed to provide ultrafast all-in-one preprocessing and quality control for FastQ data.

This tool is designed for processing short reads (i.e. Illumina NovaSeq, MGI), if you are looking for tools to process long reads (i.e. Nanopore, PacBio, Cyclone), please use fastplong.

fastp supports batch processing of multiple FASTQ files in a folder, see - batch processing

If you use fastp in your work, you can cite fastp as: Shifu Chen. fastp 1.0: An ultra-fast all-round tool for FASTQ data quality control and preprocessing. iMeta 4.5 (2025): e70078 https://doi.org/10.1002/imt2.70078

features

  1. comprehensive quality profiling for both before and after filtering data (quality curves, base contents, KMER, Q20/Q30, GC Ratio, duplication, adapter contents...)
  2. filter out bad reads (too low quality, too short, or too many N...)
  3. cut low quality bases for per read in its 5' and 3' by evaluating the mean quality from a sliding window (like Trimmomatic but faster).
  4. trim all reads in front and tail
  5. cut adapters. Adapter sequences can be automatically detected, which means you don't have to input the adapter sequences to trim them.
  6. correct mismatched base pairs in overlapped regions of paired end reads, if one base is with high quality while the other is with ultra low quality
  7. trim polyG in 3' ends, which is commonly seen in NovaSeq/NextSeq data. Trim polyX in 3' ends to remove unwanted polyX tailing (i.e. polyA tailing for mRNA-Seq data)
  8. preprocess unique molecular identifier (UMI) enabled data, shift UMI to sequence name.
  9. report JSON format result for further interpreting.
  10. visualize quality control and filtering results on a single HTML page (like FASTQC but faster and more informative).
  11. split the output to multiple files (0001.R1.gz, 0002.R1.gz...) to support parallel processing. Two modes can be used, limiting the total split file number, or limitting the lines of each split file.
  12. support long reads (data from PacBio / Nanopore devices).
  13. support reading from STDIN and writing to STDOUT
  14. support interleaved input
  15. support ultra-fast FASTQ-level deduplication
  16. ...

If you find a bug or have additional requirement for fastp, please file an issue:https://github.com/OpenGene/fastp/issues/new

simple usage

  • for single end data (not compressed)
fastp -i in.fq -o out.fq
  • for paired end data (gzip compressed)
fastp -i in.R1.fq.gz -I in.R2.fq.gz -o out.R1.fq.gz -O out.R2.fq.gz

By default, the HTML report is saved to fastp.html (can be specified with -h option), and the JSON report is saved to fastp.json (can be specified with -j option).

examples of report

fastp creates reports in both HTML and JSON format. * HTML report: http://opengene.org/fastp/fastp.html * JSON report: http://opengene.org/fastp/fastp.json

get fastp

install with Bioconda

install with conda

# note: the fastp version in bioconda may be not the latest
conda install -c bioconda fastp

or download the latest prebuilt binary for Linux users

This binary was compiled on CentOS, and tested on CentOS/Ubuntu

# download the latest build
wget http://opengene.org/fastp/fastp
chmod a+x ./fastp

# or download specified version, i.e. fastp v1.3.3
wget http://opengene.org/fastp/fastp.1.3.3
mv fastp.1.3.3 fastp
chmod a+x ./fastp

or compile from source

fastp depends on libisal, libdeflate and libhwy (Google Highway >= 1.1.0). Please install all three before building.

You can install all dependencies at once with conda:

conda install -c conda-forge isa-l libdeflate libhwy

Or install them individually using your system package manager:

Step 1: install isa-l

Install via brew install isa-l (macOS) or apt install libisal-dev (Ubuntu, dynamic linking only). Note: Ubuntu's libisal-dev does not ship a static library (.a). For static linking, compile from source (requires nasm, autoconf, automake, libtool):

git clone --depth=1 --branch v2.31.0 https://github.com/intel/isa-l.git
cd isa-l
./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib64
make -j
sudo make install

Step 2: install libdeflate

Install via package manager: apt install libdeflate-dev (Ubuntu) or brew install libdeflate (macOS). Or compile from source:

git clone https://github.com/ebiggers/libdeflate.git
cd libdeflate
cmake -B build
cmake --build build
sudo cmake --install build

Step 3: install Highway

Google Highway (>= 1.1.0) provides portable SIMD acceleration. Install via brew install highway (macOS) or conda install -c conda-forge libhwy. Note: apt install libhwy-dev on Ubuntu 24.04 provides 1.0.7 which is too old — compile from source instead:

git clone --depth=1 --branch 1.3.0 https://github.com/google/highway.git
cd highway
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DHWY_ENABLE_TESTS=OFF -DHWY_ENABLE_EXAMPLES=OFF
cmake --build build
sudo cmake --install build

Step 4: download and build fastp

# get source (you can also use browser to download from master or releases)
git clone https://github.com/OpenGene/fastp.git

# build
cd fastp
make -j

# Install
sudo make install

On macOS with Homebrew, you may need to specify the include and library paths:

make -j INCLUDE_DIRS=/opt/homebrew/include LIBRARY_DIRS=/opt/homebrew/lib

input and output

fastp supports both single-end (SE) and paired-end (PE) input/output. * for SE data, you only have to specify read1 input by -i or --in1, and specify read1 output by -o or --out1. * for PE data, you should also specify read2 input by -I or --in2, and specify read2 output by -O or --out2. * if you don't specify the output file names, no output files will be written, but the QC will still be done for both data before and after filtering. * the output will be gzip-compressed if its file name ends with .gz

output to STDOUT

fastp supports streaming the passing-filter reads to STDOUT, so that it can be passed to other compressors like bzip2, or be passed to aligners like bwa and bowtie2. * specify --stdout to enable this mode to stream output to STDOUT * for PE data, the output will be interleaved FASTQ, which means the output will contain records like record1-R1 -> record1-R2 -> record2-R1 -> record2-R2 -> record3-R1 -> record3-R2 ...

input from STDIN

  • specify --stdin if you want to read the STDIN for processing.
  • if the STDIN is an interleaved paired-end stream, specify --interleaved_in to indicate that.
  • adapter auto-detection is disabled for STDIN mode

store the unpaired reads for PE data

  • you can specify --unpaired1 to store the reads that read1 passes filters but its paired read2 doesn't, as well as --unpaired2 for unpaired read2.
  • --unpaired1 and --unpaired2 can be the same, so the unpaired read1/read2 will be written to the same single file.

store the reads that fail the filters

  • give --failed_out to specify the file name to store the failed reads.
  • if one read failed and is written to --failed_out, its failure reason will be appended to its read name. For example, failed_quality_filter, failed_too_short etc.
  • for PE data, if unpaired reads are not stored (by giving --unpaired1 or --unpaired2), the failed pair of reads will be put together. If one read passes the filters but its pair doesn't, the failure reason will be paired_read_is_failing.

process only part of the data

If you don't want to process all the data, you can specify --reads_to_process to limit the reads to be processed. This is useful if you want to have a fast preview of the data quality, or you want to create a subset of the filtered data.

do not overwrite exiting files

You can enable the option --dont_overwrite to protect the existing files not to be overwritten by fastp. In this case, fastp will report an error and quit if it finds any of the output files (read1, read2, json report, html report) already exists before.

split the output to multiple files for parallel processing

See output splitting

merge PE reads

See merge paired-end reads

filtering

Multiple filters have been implemented.

quality filter

Quality filtering is enabled by default, but you can disable it by -Q or disable_quality_filtering. Currently it supports filtering by limiting the N base number (-n, --n_base_limit), and the percentage of unqualified bases.  

To filter reads by its percentage of unqualified bases, two options should be provided: * -q, --qualified_quality_phred       the quality value that a base is qualified. Default 15 means phred quality >=Q15 is qualified. * -u, --unqualified_percent_limit   how many percents of bases are allowed to be unqualified (0~100). Default 40 means 40%

You can also filter reads by its average quality score * -e, --average_qual if one read's average quality score <avg_qual, then this read/pair is discarded. Default 0 means no requiremen

Core symbols most depended-on inside this repo

Shape

Method 394
Class 76
Function 57
Enum 1

Languages

C++98%
Python2%

Modules by API surface

src/cmdline.h69 symbols
src/stats.cpp32 symbols
src/options.h31 symbols
src/filterresult.cpp25 symbols
src/util.h24 symbols
src/read.cpp23 symbols
src/fastqreader.cpp20 symbols
src/htmlreporter.cpp18 symbols
src/simd.cpp17 symbols
src/singleproducersingleconsumerlist.h16 symbols
src/peprocessor.cpp15 symbols
src/evaluator.cpp15 symbols

For agents

$ claude mcp add fastp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page