Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 3 years have passed since last update.

fastpを用いたアダプタートリミングとクオリティコントロール

0
Posted at

fastp

fastpは、アダプタートリミングとクオリティコントロールを同時に行う、高速なNGSデータ前処理パイプラインである。
fastqファイルに対応しており、fq.gzでもランが可能。
詳しくはfastpのgithubを参照

インストール

condaによるインストールがシンプルかつ簡単。
git cloneによるダウンロードとコンパイルを用いたバイナリのインストールも可能(著者は試していない)。

download.sh
#condaによるインストール。著者はpython3.9で走らせてるが、割とどのバージョンでも動く。
conda install -c bioconda -y fastp
conda update -c bioconda -y fastp


#githubよりソースコードをダウンロードしてコンパイル(pathを通す必要がある)
git clone https://github.com/OpenGene/fastp.git 
cd fastp 
make 
sudo make install

#インストールされたか確認。インストールされているとバージョンが出力される。
fastp -v

#fastp 0.22.0

fastpの実行

ここでは、基本的なオプションを説明する。
fastpはアダプター配列を自動検出する。自動検出はオプション-A をつけることで無効化できる。
※自動検出は内部プログラムでなにが実行されているかわかりずらいので、嫌う人もいる。
著者はアダプター配列がわかれば-Aをつけて配列指定、わからなければ自動検出で実行している。

run.sh
#githubよりソースコードをダウンロード。\はコードの改行(見やすくなる)。
fastp \
-i DNBSEQ_2021-A1_Read1.fq.gz \ #インプット1
-I DNBSEQ_2021-A1_Read2.fq.gz \ #インプット2
-o A1_Read1_tremmed.fastq.gz \ #アウトプット1
-O A1_Read2_tremmed.fastq.gz \ #アウトプット2
-h report.html \ #トリミング後のクオリティ値。htmlで開ける。
-j report.json \ #トリミング後のクオリティ値。json方式。
-q 20 \ #phred quality scoreの平均が20以下(エラー率1%以上)の領域を除去(低クオリティを除去)
-t 1 \ #3'末端の1塩基を強制トリミング(フォワード)
-T 1 \ #3'末端の1塩基を強制トリミング(リバース)
-l 20 \ #20bp以下の配列を強制除去
-w 8 \ #スレッド数
--adapter_sequence AAGTCGGAGGCCAAGCGGTCTTAGGAAGACAA \ #トリミングするアダプターの指定
--adapter_sequence_r2 AAGTCGGATCGTAGCCATGTCGTTCTGTGAGCCAAGGAGTTG \ #トリミングするアダプターの指定
>& fastp.log & #実行後にログを作成

以下はfor文による自動化。フォルダ内のサンプルをすべて処理する。
使用するシーケンサーによってraw dataの出力形式が異なるので、その部分については適宜改変が必要。
まずサンプルリストを作成し、そのリスト内のサンプルをすべて処理するスクリプト。

run_auto.sh
#サンプルリストの作成。_R1_001.fastq.gzの部分は使用するサンプル名の後ろ側。自身のサンプルに合わせて改変。
#以下はMiseq出力ファイル形式。Miseq出力のraw dataであれば、コピペでいける。
ls *_L001_R1_001.fastq.gz | sed -e 's/_L001_R1_001.fastq.gz//g' > list.txt

#listの中身を確認
less list.txt

#トリミング&フィルタリング
for file in `cat list.txt`; do
fastp -i ${file}_L001_R1_001.fastq.gz -I ${file}_L001_R2_001.fastq.gz -o ${file}_R1_tremmed.fastq.gz -O ${file}_R2_tremmed.fastq.gz -h ${file}.html -j ${file}.json -q 20 -t 1 -T 1 -l 20 -w 8
done

参考(2023/04/05)

高速なfastqの前処理パイプライン fastp

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?