fqtoolsは 無効なファイルを識別しながら、FASTQファイルを処理できる、高速で信頼性の高いFASTQファイル操作ツール。自動解析パイプラインでの使用も視野に設計されている。
インストール
依存
- makezlib is required for processing compressed (.gz) data. The code relies on several recent zlib file IO functions, so must be a version >= 1.2.3.5.
- htslib is required for reading BAM files. If htslib is not installed, download and compile htslib
htslibはかつてはSAMtoolsと一緒にダウンロードできたが、現在は別々にインストールされるようになっている。samtoolsが動くなら、htslibは持っているはずである。ダウンロードしたfqtoolsのMakeFile内の"HTSDIR=./htslib"をhtslibのパスに書き換えてビルドする。
本体 Github
https://github.com/alastair-droop/fqtools
git clone https://github.com/alastair-droop/fqtools
cd fqtools/
#hsslibのインストール
git clone https://github.com/samtools/htslib
cd htslib/
autoconf
./configure
make
make install
cd ..
#fqtoolsのビルド
make
cd bin/
./fqtools
$ fqtools -h
usage: fqtools [-hvdramuli] [-b BUFSIZE] [-B BUFSIZE] [-q QUALTYPE] [-f FORMAT] [-F FORMAT] COMMAND [...] [FILE] [FILE]
global options:
-h Show this help message and exit.
-v Show the program version and exit.
-d Allow DNA sequence bases (ACGTN)
-r Allow RNA sequence bases (ACGUN)
-a Allow ambiguous sequence bases (RYKMSWBDHV)
-m Allow mask sequence base (X)
-u Allow uppercase sequence bases
-l Allow lowercase sequence bases
-p CHR Set the pair replacement character (default "%")
-b BUFSIZE Set the input buffer size
-B BUFSIZE Set the output buffer size
-q QUALTYPE Set the quality score encoding
-f FORMAT Set the input file format
-F FORMAT Set the output file format
-i Read interleaved input file pairs
-I Write interleaved output file pairs
CHR:
This character will be replaced by the pair value when writing paired files.
BUFSIZE:
Possible suffixes are [bkMG]. If no suffix is given, value is in bytes.
QUALTYPE:
u Do not assume specifc quality score encoding
s Interpret quality scores as Sanger encoded
o Interpret quality scores as Solexa encoded
i Interpret quality scores as Illumina encoded
FORMAT:
F uncompressed FASTQ format (.fastq)
f compressed FASTQ format (.fastq.gz)
b BAM format (.bam)
s SAM format (.sam)
u attempt to infer format from file extension, (default .fastq.gz)
COMMAND:
view View FASTQ files
head View the first reads in FASTQ files
count Count FASTQ file reads
header View FASTQ file header data
sequence View FASTQ file sequence data
quality View FASTQ file quality data
header2 View FASTQ file secondary header data
fasta Convert FASTQ files to FASTA format
basetab Tabulate FASTQ base frequencies
qualtab Tabulate FASTQ quality character frequencies
lengthtab Tabulate FASTQ read lengths
type Attempt to guess the FASTQ quality encoding type
validate Validate FASTQ files
find Find FASTQ reads containing specific sequences
trim Trim reads in a FASTQ file
qualmap Translate quality values using a mapping file
パスの通ったディレクトリにコピーしておく。
ラン
basetab 塩基をカウント
fqtools basetab input.fq
$ fqtools basetab input.fq
A 18538008
C 16527922
G 16350219
T 18729720
qualtab クオリティスコアをカウント
fqtools qualtab input.fq
$ fqtools qualtab input.fq |head -n 15
! 0
" 0
# 0
$ 0
% 0
& 0
' 0
( 17198
) 20322
* 10934
+ 15572
, 50165
- 4090
. 2686
/ 1274
count リード数をカウント
fqtools count input.fq
header ヘッダーだけ表示(ヘッダーのみのcat)
fqtools header input.fq > output
sequence 配列だけ表示(配列のみのcat)
fqtools sequence input.fq > output
quality クオリティスコアだけ表示(クオリティスコアのみのcat)
fqtools quality input.fq > output
fqtools fasta input.fq > output.fa
view 中身を見る(=cat)
fqtools view input.fq
head 先頭10リードを表示
fqtools head input.fq
type シーケンスタイプを表示(詳細は-hで確認できる)
fqtools type input.fq
validate 異常がないか検証(壊れてないか、など)
fqtools validate input.fq
validate 配列ATGCATGCを探す(grep、agrepに近い)。
fqtools find -s ATGCATGC input.fq
$ fqtools find -h
Find FASTQ reads containing specific sequences.
view options:
-h Show this help message and exit.
-k Preserve secondary headers (if present).
-a Require all sequences for a match.
-s SEQUENCE Sequence to match against.
-f SEQ_FILE Read match sequences from file.
-o STEM Output file stem (default "output%").
FILE The fastq file(s) to view.
trim トリミング
#先頭10bp
fqtools trim -s 10 input.fq > trimmmed.fq
#100bpになるまでカット
fqtools trim -l 100 input.fq > trimmmed.fq
$ fqtools trim -h
View FASTQ files.
view options:
-h Show this help message and exit.
-k Preserve secondary headers (if present).
-o STEM Output file stem (default "output%").
-s LENGTH Trim LENGTH bases from the read start.
-l LENGTH Trim the read to a maximum length of LENGTH.
FILE The fastq file(s) to view.
サブコマンド独自のオプション以外に、すべてに共通するグローバルパラメータがある。
- -h Show this help message and exit.
- -v Show the program version and exit.
- -d Allow DNA sequence bases (ACGTN)
- -r Allow RNA sequence bases (ACGUN)
- -a Allow ambiguous sequence bases (RYKMSWBDHV)
- -m Allow mask sequence base (X)
- -u Allow uppercase sequence bases
- -l Allow lowercase sequence bases
- -p CHR Set the pair replacement character (default "%")
- -b BUFSIZE Set the input buffer size
- -B BUFSIZE Set the output buffer size
- -q QUALTYPE Set the quality score encoding -f FORMAT Set the input file format
- -F FORMAT Set the output file format
- -i Read interleaved input file pairs
- -I Write interleaved output file pairs
例えばRNAの塩基数をbasetabサブコマンドでカウントするなら
fqtools -r basetab input.fq
となる。
こちらも参考にしてください。
引用
fqtools: an efficient software suite for modern FASTQ file manipulation
Droop AP.
Bioinformatics. 2016 Jun 15;32(12):1883-4.