macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

fastqデータを検証する FastQValidator

 

FastQValidatorは、fastqのフォーマットを検証しておかしなリードが含まれるのか調べることができるツール。具体的には、1つだけファイル名がおかしかったり(ヘッダーが@で始まっていないとか短すぎるとか)、数塩基しかないようなリードが混じっているかどうかなど調べ、エラー数をコールすることができる。使い道はないと思われるかもしれないが、大規模な解析を行っているとfastqのダウンロードが不完全に終わって、気づかないうちに変なfastqを使っているということが起きるかもしれない。FastQValidatorでフォーマットを検証しておけば、そういうトラブルを最小限の手間で防ぐことができる。

本ツールは自動解析ツールの入力ファイルのチェックに使われたりもしている。

 

 

 

インストール

Github

 コンパイルにはlibStatGenが必要。本体より先にビルドしておく。

git clone https://github.com/statgen/libStatGen.git 
cd libStatGen/
make all
make test

FastQValidatorのダウンロードとビルド。

git clone https://github.com/statgen/fastQValidator.git 
cd fastQValidator
make all

bin/にfastQValidatorができる。パスを通しておく。

 

実行方法

fastqファイルを検証する。

fastQValidator --file input.fastq 

解析が終わるとメッセージが標準出力にプリントされる。

Finished processing input.fastq with 16000000 lines containing 4000000 sequences.

There were a total of 0 errors.

Returning: 0 : FASTQ_SUCCESS

このファイルにはエラーはない。

エラーがあれば以下のようなメッセージがプリントされる。

ERROR on Line 25: The sequence identifier line was too short.
ERROR on Line 29: First line of a sequence does not begin wtih @
ERROR on Line 33: No Sequence Identifier specified before the comment.

 

 

color space fastqかどうか調べる。

fastQValidator --colorSpace --file input.fastq 

ここで使ったfastqはATGCNなので、SOLiDのcolorspace fastq(0123)かどうかチェックすると全行でエラーが出る。

Finished processing input.fastq with 16000000 lines containing 4000000 sequences.

There were a total of 200000000 errors.

Returning: 1 : FASTQ_INVALID

  • --baseSpace ACTGN only
  • --colorSpace 0123. only

 

25-bp以下のリードがないかどうかも調べる。

fastQValidator --minReadLen 25 --file input.fastq
  •  --minReadLen Minimum allowed read length (Defaults to 10).

 

 

塩基の構成も各部位ごとに調べる。

 fastQValidator --baseComposition --file 
  •  --baseComposition Print the Base Composition Statistics.

塩基の割合がポジション別にプリントされる。

Read Index %A %C %G %T %N Total Reads At Index

         0    18.02   27.26   38.16   16.56    0.00 4000000

         1    29.03   23.09   25.11   22.77    0.00 4000000

         2    21.28   25.40   21.87   31.46    0.00 4000000

         3    21.20   32.89   25.26   20.65    0.00 4000000

         4    23.30   22.15   33.77   20.77    0.01 4000000

         5    23.19   23.99   31.71   21.12    0.00 4000000

         6    30.34   23.45   23.68   22.54    0.00 4000000

 

 

複数fastqを入力とし、Phread quality scoreの平均も計算させる。

fastQValidator --avgQual --params --file input*fastq
  • --params Print the parameter settings.
  • --avgQual Print the average phred quality per cycle & overall average quality.

各部位のPhread quality scoreがポジション別にプリントされる。

Average Phred Quality by Read Index (starts at 0):

Read Index Average Quality

0 32.79

1 32.69

2 32.87

3 32.96

4 33.23

5 36.57

6 36.77

 

 

50-bp以下のリードが100以上あればランを止める。

fastQValidator --minReadLen 50 --maxErrors 100 --file input.fastq
  • --maxErrors Number of errors to allow before quitting reading/validating the file. -1 (default) indicates to not quit until the entire file is read.

 

 

全配列をキャッシュするので、大きなfastqだとメモリが足りなくなる恐れがある。心配なら2-passモードでランする。

fastQValidator -2 --file input*fastq #フォルダの全fastqを調べる。

 

引用

https://genome.sph.umich.edu/wiki/FastQValidator