Fastp使用方法

fastp是一個(gè)速度非??斓臏y(cè)序數(shù)據(jù)質(zhì)控軟件,以下為軟件參數(shù)的說明,根據(jù)github內(nèi)容整理。

github: https://github.com/OpenGene/fastp

簡(jiǎn)單使用:

單端數(shù)據(jù)

fastp -i in.fq -o out.fq

雙端數(shù)據(jù)

fastp -i in.R1.fq.gz -I in.R2.fq.gz -o out.R1.fq.gz -O out.R2.fq.gz

結(jié)果輸出為html和json格式。

輸出到STDOUT

--stdout
# 結(jié)果輸出到標(biāo)準(zhǔn)輸出,對(duì)于雙端數(shù)據(jù)read1和read2交替輸出即record1-R1 -> record1-R2 -> record2-R1 -> record2-R2 -> record3-R1 -> record3-R2 ...

采用STDIN作為輸入

--stdin
# 以標(biāo)準(zhǔn)輸入作為輸入,交替的雙端數(shù)據(jù)可指定 --interleaver_in 參數(shù)

存儲(chǔ)雙端數(shù)據(jù)中未配對(duì)的數(shù)據(jù)

--unpaired1    # 存儲(chǔ)read2被過濾但read1滿足要求的read1
--unpaired2    # 存儲(chǔ)read1被過濾但read2滿足要求的read2
               # 這兩個(gè)參數(shù)可指定相同的文件,來同時(shí)保存read1和read2

存儲(chǔ)過濾的read

--failed_out    # 存儲(chǔ)過濾的reads,過濾的原因會(huì)加入到read name中
                # 若未配對(duì)的read沒有保存,則會(huì)和過濾的read一起保存到這里,其過濾原因?yàn)閜aired_read_is_failing

處理部分reads

--reads_to_process    # 設(shè)置要處理的reads數(shù)

不覆蓋現(xiàn)有文件

--dont_overwrite    # 禁止覆蓋現(xiàn)有文件

過濾

# 質(zhì)量過濾,默認(rèn)開啟
-Q, --disable_quality_filtering   # 關(guān)閉質(zhì)量過濾
-n, --n_base_limit    # 限制N的數(shù)量
-u, --unqualified_percent_limit    # 限制低質(zhì)量堿基的百分比,默認(rèn)40,表示40%
-q, --qualified_quality_phred    # 質(zhì)量值低于此值認(rèn)為是低質(zhì)量堿基,默認(rèn)15,表示質(zhì)量為Q15
-e, --average_qual    # 限制read的平均質(zhì)量值,小于此值將被過濾,默認(rèn)0,表示不要求

# 長(zhǎng)度過濾,默認(rèn)開啟
-L, --disable_length_filtering    # 關(guān)閉長(zhǎng)度過濾
-l, --length_required    # 最小長(zhǎng)度值
--length_limit    # 最大長(zhǎng)度值,默認(rèn)0,表示不限制

# 低復(fù)雜度過濾,默認(rèn)關(guān)閉
# 復(fù)雜度定義:與下一個(gè)堿基不同的堿基所占的百分比
-y, --low_complexity_filter    # 開啟復(fù)雜度過濾
-Y, --complexity_threshold    # 范圍0~100,默認(rèn)30,表示復(fù)雜度需達(dá)到30%

去接頭

# 去除接頭,默認(rèn)開啟,自動(dòng)檢測(cè)接頭
-A, --disable_adapter_trimming    # 關(guān)閉去除接頭
# 對(duì)于單端數(shù)據(jù),fastp通過分析前1M reads來自動(dòng)檢測(cè)接頭,但也可以自己指定接頭,當(dāng)接頭序列被指定后,自動(dòng)檢測(cè)將關(guān)閉
-a, --adapter_sequence    # 指定接頭序列
# 對(duì)于雙端數(shù)據(jù),通過read1和read2之間的overlap可判斷接頭,因此通常可以不指定接頭序列,但仍然可以人為指定read1和read2的接頭序列。當(dāng)fastp無法找到overlap時(shí)(比如低質(zhì)量堿基),將根據(jù)指定的接頭序列進(jìn)行接頭去去除。
--adapter_sequence    # read1的接頭序列
--adapter_sequence_r2    # read2的接頭序列
--detect_adapter_for_pe    # 開啟雙端的接頭檢測(cè)(應(yīng)該不同于overlap方法)
# fastp具有內(nèi)置的接頭序列,以便于更好的檢測(cè)接頭,可以指定包含接頭序列的fasta文件來去除多個(gè)接頭
--adapter_fasta    # 指定包含接頭序列的fasta文件
                   # 接頭序列至少6bp長(zhǎng)度,否則將被跳過
                   # 可以指定任何想去除的序列,比如polyA

reads切除

# 根據(jù)質(zhì)量對(duì)read進(jìn)行切除
# fastp通過計(jì)算滑窗內(nèi)的平均堿基質(zhì)量對(duì)read進(jìn)行切除,主要有3種模式
#1.
-5, --cut_front    # 默認(rèn)關(guān)閉,從5'開始滑動(dòng)滑窗,如果滑窗內(nèi)的堿基質(zhì)量值低于閾值,則切除,繼續(xù)滑動(dòng),否則停止
--cut_front_window_size    # 設(shè)置滑窗大小
--cut_front_mean_quality    # 平均質(zhì)量值閾值
                            # 開頭的N堿基也會(huì)被切除
#2.
-3, --cut_tail    # 默認(rèn)關(guān)閉,從3'端開始滑動(dòng),同上
--cut_tail_window_size
--cut_tail_mean_quality
#3.
-r, --cut_right    # 從5'端開始滑動(dòng),如果遇到滑窗中平均質(zhì)量小于閾值,切除滑窗及其右邊的序列
--cut_right_window_size    # 設(shè)置滑窗大小
--cut_right_mean_quality    # 平均質(zhì)量值閾值
#如果未設(shè)置上述的滑窗大小和平均質(zhì)量值閾值,則使用以下參數(shù)的值:
-W, --cut_window_size
-M, --cut_mean_quality

# 全局切除,切除所有read 5'端或3'端read
-f, --trim_front1    # 切除read1或單端數(shù)據(jù)5'端n bp的序列
-t, --trim_tail1    # 切除read1或單端數(shù)據(jù)3'端n bp的序列
-F, --trim_front2    # 切除read2 5'端n bp的序列
-T, --trim_tail2    # 切除read2 3'端n bp的序列
                    # -F和-T若不指定則默認(rèn)和-f和-t相同
-b, --max_len1    # read1長(zhǎng)度若超過此參數(shù)則切除3'端多余序列
-B, --max_len2    # read2長(zhǎng)度若超過此參數(shù)則切除3'端多余序列
                  # 若-B參數(shù)不指定而指定了-b,則-B默認(rèn)與-b相同

# 去除polyG
# 對(duì)于Illumina NextSeq/NovaSeq data(通過machine ID檢測(cè))自動(dòng)進(jìn)行polyG切除
-g, --trim_poly_g    # 開啟所有數(shù)據(jù)的polyG去除
-G, --disable_trim_poly_g    # 關(guān)閉polyG去除
--poly_g_min_len    # polyG最小長(zhǎng)度,默認(rèn)10

# 去除polyX,默認(rèn)關(guān)閉
-x, --trim_poly_x    # 開啟
--poly_x_min_len    # polyX最小長(zhǎng)度,默認(rèn)10
                    # 當(dāng)polyG和polyX同時(shí)開啟時(shí),先去除ployG,再去除polyX

UMI處理

# 將umi加到read name中,若umi在read中,則會(huì)切除
-U, --umi    # 開啟UMI處理
--umi_loc    # umi所處位置,以下幾種選擇{index1, index2, read1, read2, per_index, per_read}
--umi_len    # umi長(zhǎng)度,當(dāng)umi_loc為read1/read2/per_read時(shí)需要指定
--umi_prefix    # 為umi加上前綴

雙端數(shù)據(jù)堿基矯正

# 雙端數(shù)據(jù)堿基矯正,默認(rèn)關(guān)閉
# fastp對(duì)雙端read進(jìn)行overlap分析,當(dāng)出現(xiàn)不匹配的堿基時(shí),如果一個(gè)堿基質(zhì)量值很高,另一個(gè)堿基質(zhì)量值很低,則使用質(zhì)量值高的堿基對(duì)質(zhì)量值低的堿基進(jìn)行矯正,且使用同一質(zhì)量值
-c, --correction    # 開啟矯正
# overlap的檢測(cè)需要同時(shí)滿足以下3個(gè)參數(shù)設(shè)置的條件:
--overlap_len_require    # 最小overlap長(zhǎng)度,默認(rèn)30
--overlap_diff_limit    # overlap序列中最大差異堿基數(shù),默認(rèn)5
--overlap_diff_limit_percent    # overlap序列中最大差異堿基百分比,默認(rèn)20%

fastp中影響序列長(zhǎng)度的操作優(yōu)先級(jí)

1, UMI preprocessing (--umi)
2, global trimming at front (--trim_front)
3, global trimming at tail (--trim_tail)
4, quality pruning at 5' (--cut_front)
5, quality pruning by sliding window (--cut_right)
6, quality pruning at 3' (--cut_tail)
7, trim polyG (--trim_poly_g, enabled by default for NovaSeq/NextSeq data)
8, trim adapter by overlap analysis (enabled by default for PE data)
9, trim adapter by adapter sequence (--adapter_sequence, --adapter_sequence_r2. For PE data, this step is skipped if last step succeeded)
10, trim polyX (--trim_poly_x)
11, trim to max length (---max_len)

輸出文件拆分

-s, --split    # 輸出拆分為n個(gè)文件,輸出文件前綴為拆分編號(hào)
-S, --split_by_lines    # 通過限制每個(gè)輸出文件的reads數(shù)進(jìn)行拆分,但實(shí)際文件行數(shù)可能會(huì)更多一些

雙端文件merge

# merge依賴read1和read2之間overlap的鑒定,因此堿基矯正中的overlap_len_require (default 30), overlap_diff_limit (default 5) and overlap_diff_limit_percent (default 20%)參數(shù)同樣影響merge過程
-m, --merge    # 開啟merge
--merged_out    # 存儲(chǔ)merged reads的文件
--include_unmerged    # 將--out1, --out2, --unpaired1 and --unpaired2的輸出重定向到--merged_out

duplication rate

# 評(píng)估duplication rate,默認(rèn)開啟
# 所有堿基完全相同的read被認(rèn)為是重復(fù)的,包含N堿基的read不會(huì)被認(rèn)為是重復(fù)的
--dont_eval_duplication    # 關(guān)閉重復(fù)率評(píng)估
# 由于哈希算法的原因,重復(fù)率的評(píng)估不是完全準(zhǔn)確的,可設(shè)置不同的準(zhǔn)確度等級(jí),等級(jí)越高越準(zhǔn)確,需要的內(nèi)存和時(shí)間也越多
--dup_calc_accuracy    # 設(shè)置準(zhǔn)確度等級(jí),1~6,不去除重復(fù)reads時(shí)默認(rèn)為1,去除重復(fù)reads時(shí)默認(rèn)為3

# 去除重復(fù)reads,默認(rèn)關(guān)閉
-D, --dedup    # 開啟

所有參數(shù)

usage: fastp -i <in1> -o <out1> [-I <in1> -O <out2>] [options...]
options:
  # I/O options
  -i, --in1                          read1 input file name (string)
  -o, --out1                         read1 output file name (string [=])
  -I, --in2                          read2 input file name (string [=])
  -O, --out2                           read2 output file name (string [=])
      --unpaired1                      for PE input, if read1 passed QC but read2 not, it will be written to unpaired1. Default is to discard it. (string [=])
      --unpaired2                      for PE input, if read2 passed QC but read1 not, it will be written to unpaired2. If --unpaired2 is same as --unpaired1 (default mode), both unpaired reads will be written to this same file. (string [=])
      --failed_out                     specify the file to store reads that cannot pass the filters. (string [=])
      --overlapped_out                 for each read pair, output the overlapped region if it has no any mismatched base. (string [=])
  -m, --merge                          for paired-end input, merge each pair of reads into a single read if they are overlapped. The merged reads will be written to the file given by --merged_out, the unmerged reads will be written to the files specified by --out1 and --out2. The merging mode is disabled by default.
      --merged_out                     in the merging mode, specify the file name to store merged output, or specify --stdout to stream the merged output (string [=])
      --include_unmerged               in the merging mode, write the unmerged or unpaired reads to the file specified by --merge. Disabled by default.
  -6, --phred64                      indicate the input is using phred64 scoring (it'll be converted to phred33, so the output will still be phred33)
  -z, --compression                  compression level for gzip output (1 ~ 9). 1 is fastest, 9 is smallest, default is 4. (int [=4])
      --stdin                          input from STDIN. If the STDIN is interleaved paired-end FASTQ, please also add --interleaved_in.
      --stdout                         output passing-filters reads to STDOUT. This option will result in interleaved FASTQ output for paired-end input. Disabled by default.
      --interleaved_in                 indicate that <in1> is an interleaved FASTQ which contains both read1 and read2. 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.
      --fix_mgi_id                     the MGI FASTQ ID format is not compatible with many BAM operation tools, enable this option to fix it.
  
  # adapter trimming options
  -A, --disable_adapter_trimming     adapter trimming is enabled by default. If this option is specified, adapter trimming is disabled
  -a, --adapter_sequence               the adapter for read1. For SE data, if not specified, the adapter will be auto-detected. For PE data, this is used if R1/R2 are found not overlapped. (string [=auto])
      --adapter_sequence_r2            the adapter for read2 (PE data only). This is used if R1/R2 are found not overlapped. If not specified, it will be the same as <adapter_sequence> (string [=])
      --adapter_fasta                  specify a FASTA file to trim both read1 and read2 (if PE) by all the sequences in this FASTA file (string [=])
      --detect_adapter_for_pe          by default, the adapter sequence auto-detection is enabled for SE data only, turn on this option to enable it for PE data.
    
  # global trimming options
  -f, --trim_front1                    trimming how many bases in front for read1, default is 0 (int [=0])
  -t, --trim_tail1                     trimming how many bases in tail for read1, default is 0 (int [=0])
  -b, --max_len1                       if read1 is longer than max_len1, then trim read1 at its tail to make it as long as max_len1. Default 0 means no limitation (int [=0])
  -F, --trim_front2                    trimming how many bases in front for read2. If it's not specified, it will follow read1's settings (int [=0])
  -T, --trim_tail2                     trimming how many bases in tail for read2. If it's not specified, it will follow read1's settings (int [=0])
  -B, --max_len2                       if read2 is longer than max_len2, then trim read2 at its tail to make it as long as max_len2. Default 0 means no limitation. If it's not specified, it will follow read1's settings (int [=0])

  # duplication evaluation and deduplication
  -D, --dedup                          enable deduplication to drop the duplicated reads/pairs
      --dup_calc_accuracy              accuracy level to calculate duplication (1~6), higher level uses more memory (1G, 2G, 4G, 8G, 16G, 24G). Default 1 for no-dedup mode, and 3 for dedup mode. (int [=0])
      --dont_eval_duplication          don't evaluate duplication rate to save time and use less memory.

  # polyG tail trimming, useful for NextSeq/NovaSeq data
  -g, --trim_poly_g                  force polyG tail trimming, by default trimming is automatically enabled for Illumina NextSeq/NovaSeq data
      --poly_g_min_len                 the minimum length to detect polyG in the read tail. 10 by default. (int [=10])
  -G, --disable_trim_poly_g          disable polyG tail trimming, by default trimming is automatically enabled for Illumina NextSeq/NovaSeq data

  # polyX tail trimming
  -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])
  
  # per read cutting by quality options
  -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.
  -r, --cut_right                      move a sliding window from front to tail, if meet one window with mean quality < threshold, drop the bases in the window and the right part, and then stop.
  -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])
      --cut_right_window_size          the window size option of cut_right, default to cut_window_size if not specified (int [=4])
      --cut_right_mean_quality         the mean quality requirement option for cut_right, default to cut_mean_quality if not specified (int [=20])
  
  # quality filtering options
  -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/pair is discarded. Default is 5 (int [=5])
  -e, --average_qual                 if one read's average quality score <avg_qual, then this read/pair is discarded. Default 0 means no requirement (int [=0])

  
  # length filtering options
  -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])

  # low complexity filtering
  -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])

  # filter reads with unwanted indexes (to remove possible contamination)
      --filter_by_index1               specify a file contains a list of barcodes of index1 to be filtered out, one barcode per line (string [=])
      --filter_by_index2               specify a file contains a list of barcodes of index2 to be filtered out, one barcode per line (string [=])
      --filter_by_index_threshold      the allowed difference of index barcode for index filtering, default 0 means completely identical. (int [=0])

  # base correction by overlap analysis options
  -c, --correction                   enable base correction in overlapped regions (only for PE data), default is disabled
      --overlap_len_require            the minimum length to detect overlapped region of PE reads. This will affect overlap analysis based PE merge, adapter trimming and correction. 30 by default. (int [=30])
      --overlap_diff_limit             the maximum number of mismatched bases to detect overlapped region of PE reads. This will affect overlap analysis based PE merge, adapter trimming and correction. 5 by default. (int [=5])
      --overlap_diff_percent_limit     the maximum percentage of mismatched bases to detect overlapped region of PE reads. This will affect overlap analysis based PE merge, adapter trimming and correction. Default 20 means 20%. (int [=20])

  # UMI processing
  -U, --umi                          enable unique molecular identifier (UMI) preprocessing
      --umi_loc                      specify the location of UMI, can be (index1/index2/read1/read2/per_index/per_read, default is none (string [=])
      --umi_len                      if the UMI is in read1/read2, its length should be provided (int [=0])
      --umi_prefix                   if specified, an underline will be used to connect prefix and UMI (i.e. prefix=UMI, UMI=AATTCG, final=UMI_AATTCG). No prefix by default (string [=])
      --umi_skip                       if the UMI is in read1/read2, fastp can skip several bases following UMI, default is 0 (int [=0])

  # overrepresented sequence analysis
  -p, --overrepresentation_analysis    enable overrepresented sequence analysis.
  -P, --overrepresentation_sampling    One in (--overrepresentation_sampling) reads will be computed for overrepresentation analysis (1~10000), smaller is slower, default is 20. (int [=20])

  # reporting options
  -j, --json                         the json format report file name (string [=fastp.json])
  -h, --html                         the html format report file name (string [=fastp.html])
  -R, --report_title                 should be quoted with ' or ", default is "fastp report" (string [=fastp report])
  
  # threading options
  -w, --thread                       worker thread number, default is 3 (int [=3])
  
  # output splitting options
  -s, --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])
  -S, --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])
  -d, --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
  -?, --help                         print this message
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容