2025/08/13 追記
Fastplongは、広く使われているツールfastpをベースにロングリードのFASTQデータ前処理に最適化したfastp。Fastp同様にアダプターを自動的に検出する機能を持ち、従来より高速にロングリードの品質チェックとフィルタリングを行うことができる。
インストール
condaで環境を作って導入した。
#conda
mamba create -n fastplong
conda activate fastplong
mamba install -c bioconda fastplong -y
#download the latest build
wget http://opengene.org/fastplong/fastplong
chmod a+x ./fastplong
> fastplong
fastplong: ultra-fast FASTQ preprocessing and quality control for long reads
version 0.2.2
usage: fastplong [options] ...
options:
-i, --in read input file name (string [=])
-o, --out read output file name (string [=])
--failed_out specify the file to store reads that cannot pass the filters. (string [=])
-z, --compression compression level for gzip output (1 ~ 9). 1 is fastest, 9 is smallest, default is 4. (int [=4])
--stdin input from STDIN.
--stdout stream passing-filters reads to STDOUT. This option will result in interleaved FASTQ output for paired-end output. Disabled by default.
--reads_to_process specify how many reads/pairs to be processed. Default 0 means process all reads. (int [=0])
--dont_overwrite don't overwrite existing files. Overwritting is allowed by default.
-V, --verbose output verbose log information (i.e. when every 1M reads are processed).
-A, --disable_adapter_trimming adapter trimming is enabled by default. If this option is specified, adapter trimming is disabled
-s, --start_adapter the adapter sequence at read start (5'). (string [=auto])
-e, --end_adapter the adapter sequence at read end (3'). (string [=auto])
-a, --adapter_fasta specify a FASTA file to trim both read by all the sequences in this FASTA file (string [=])
-d, --distance_threshold threshold of sequence-adapter-distance/adapter-length (0.0 ~ 1.0), greater value means more adapters detected (double [=0.25])
--trimming_extension when an adapter is detected, extend the trimming to make cleaner trimming, default 10 means trimming 10 bases more (int [=10])
-f, --trim_front trimming how many bases in front for read, default is 0 (int [=0])
-t, --trim_tail trimming how many bases in tail for read, default is 0 (int [=0])
-x, --trim_poly_x enable polyX trimming in 3' ends.
--poly_x_min_len the minimum length to detect polyX in the read tail. 10 by default. (int [=10])
-5, --cut_front move a sliding window from front (5') to tail, drop the bases in the window if its mean quality < threshold, stop otherwise.
-3, --cut_tail move a sliding window from tail (3') to front, drop the bases in the window if its mean quality < threshold, stop otherwise.
-W, --cut_window_size the window size option shared by cut_front, cut_tail or cut_sliding. Range: 1~1000, default: 4 (int [=4])
-M, --cut_mean_quality the mean quality requirement option shared by cut_front, cut_tail or cut_sliding. Range: 1~36 default: 20 (Q20) (int [=20])
--cut_front_window_size the window size option of cut_front, default to cut_window_size if not specified (int [=4])
--cut_front_mean_quality the mean quality requirement option for cut_front, default to cut_mean_quality if not specified (int [=20])
--cut_tail_window_size the window size option of cut_tail, default to cut_window_size if not specified (int [=4])
--cut_tail_mean_quality the mean quality requirement option for cut_tail, default to cut_mean_quality if not specified (int [=20])
-Q, --disable_quality_filtering quality filtering is enabled by default. If this option is specified, quality filtering is disabled
-q, --qualified_quality_phred the quality value that a base is qualified. Default 15 means phred quality >=Q15 is qualified. (int [=15])
-u, --unqualified_percent_limit how many percents of bases are allowed to be unqualified (0~100). Default 40 means 40% (int [=40])
-n, --n_base_limit if one read's number of N base is >n_base_limit, then this read is discarded. Default is 5 (int [=5])
-m, --mean_qual if one read's mean_qual quality score <mean_qual, then this read is discarded. Default 0 means no requirement (int [=0])
-L, --disable_length_filtering length filtering is enabled by default. If this option is specified, length filtering is disabled
-l, --length_required reads shorter than length_required will be discarded, default is 15. (int [=15])
--length_limit reads longer than length_limit will be discarded, default 0 means no limitation. (int [=0])
-y, --low_complexity_filter enable low complexity filter. The complexity is defined as the percentage of base that is different from its next base (base[i] != base[i+1]).
-Y, --complexity_threshold the threshold for low complexity filter (0~100). Default is 30, which means 30% complexity is required. (int [=30])
-j, --json the json format report file name (string [=fastplong.json])
-h, --html the html format report file name (string [=fastplong.html])
-R, --report_title should be quoted with ' or ", default is "fastplong report" (string [=fastplong report])
-w, --thread worker thread number, default is 3 (int [=3])
--split split output by limiting total split file number with this option (2~999), a sequential number prefix will be added to output name ( 0001.out.fq, 0002.out.fq...), disabled by default (int [=0])
--split_by_lines split output by limiting lines of each file with this option(>=1000), a sequential number prefix will be added to output name ( 0001.out.fq, 0002.out.fq...), disabled by default (long [=0])
--split_prefix_digits the digits for the sequential number padding (1~10), default is 4, so the filename will be padded as 0001.xxx, 0 to disable padding (int [=4])
-?, --help print this message
実行方法
ロングリードを指定する。デフォルトでアダプター検出はONになっている。5'末端と3'末端の10塩基のトリミングも行う(-f 10 -t 10)。500b以下は捨てる。
fastplong -i in.fq.gz -o out.fq.gz -w 8 -q 15 -f 10 -t 10 -j report.json -h report.html -l 500
- -w worker thread number, default is 3 (int [=3])
- -q the quality value that a base is qualified. Default 15 means phred quality >=Q15 is qualified. (int [=15])
- -l reads shorter than length_required will be discarded, default is 15. (int [=15])
- -j the json format report file name (string [=fastplong.json])
-
-h the html format report file name (string [=fastplong.html])
- -m if one read's mean_qual quality score <mean_qual, then this read is discarded. Default 0 means no requirement (int [=0])
- -W the window size option shared by cut_front, cut_tail or cut_sliding. Range: 1~1000, default: 4 (int [=4])
- -f trimming how many bases in front for read, default is 0 (int [=0])
- -t trimming how many bases in tail for read, default is 0 (int [=0])
- -x enable polyX trimming in 3' ends.
- --poly_x_min_len the minimum length to detect polyX in the read tail. 10 by default. (int [=10])
- -5 move a sliding window from front (5') to tail, drop the bases in the window if its mean quality < threshold, stop otherwise.
- -3 move a sliding window from tail (3') to front, drop the bases in the window if its mean quality < threshold, stop otherwise.
前処理されたリードとレポートが出力される。

10GBのgzip圧縮fastqの前処理には2分ほどかかった(5995WX, 16 threads)。
任意のアダプターを指定する。
fastplong -i in.fq -o out.fq -w 3 -s AAGGATTCATTCCCACGGTAACAC -e GTGTTACCGTGGGAATGAATCCTT
- -s the adapter sequence at read start (5'). (string [=auto])
- -e the adapter sequence at read end (3'). (string [=auto])
- -a specify a FASTA file to trim both read by all the sequences in this FASTA file (string [=])
- -A adapter trimming is enabled by default. If this option is specified, adapter trimming is disabled
fastplongはスライディングウィンドウ内の平均品質スコアを評価することで品質カットをサポートしている。2つの異なる操作をサポートしている。
- -5, --cut_front スライディングウィンドウを前方(5')から後方に移動し、ウィンドウ内の塩基の平均品質がcut_mean_quality以下の場合はその塩基を削除し、そうでない場合は停止する。デフォルトは無効。先頭のN塩基もトリミングされる。widnowサイズを設定するにはcut_front_window_sizeを、平均品質閾値を設定するにはcut_front_mean_qualityを使う。ウィンドウサイズが1の場合、Trimomatic LEADING法と同様。
- -3, --cut_tail テール(3')からフロントへスライディングウィンドウを移動し、その平均品質がcut_mean_quality以下であればウィンドウ内のベースをドロップし、そうでなければ停止する。デフォルトは無効。末尾のN塩基もトリミングされる。widnowサイズを設定するには cut_tail_window_size を使い,平均品質閾値を設定するには cut_tail_mean_quality を使う.ウィンドウサイズが1の場合、Trimomatic TRAILING法と同様。
レポート例
https://opengene.org/fastplong/fastplong.html



←Before, After→
その他(レポジトリより)
- fastplongはアダプターを検出する際にedit distanceを計算する。d, --distance_threshold を指定することで、アダプター比較のミスマッチ許容度を調整できる。デフォルト値は0.25で、これは25%のミスマッチを許容することを意味する。データのエラー率が高い場合はこの値を大きくし、データの品質が高い場合はこの値を小さくする。
- よりきれいにトリミングするために、fastplongはアダプターに接続された塩基を少し多めにトリミングする。このオプションは-trimming_extensionで指定でき、デフォルト値は10になっている。
- FASTQファイルの並列処理(すなわち並列アライメント)のために、fastplongは出力を複数のファイルに分割することができる。ファイル数制限による分割と行数を制限しての分割をサポートしている。
-
fastplongはグローバルトリミングをサポートしている。例えば、最後のサイクルを強制トリミングするには-t 1をつける。フロント/テールトリミングの設定は、-fと -tで指定する。
引用
Ultrafast one-pass FASTQ data preprocessing, quality control, and deduplication using fastp
Shifu Chen
iMeta, First published: 08 May 2023
https://onlinelibrary.wiley.com/doi/10.1002/imt2.107
参考
Tool:fastplong: ultrafast preprocessing and quality control for long reads
https://www.biostars.org/p/9604252/#9604428
https://www.haplox.jp/news/detail/20241023001
関連