macでインフォマティクス

macでインフォマティクス

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

メタゲノムのアセンブリcontig.fastaに精度の高い系統情報をアサインするCATと、binned.fastaに精度の高い系統情報をアサインするBAT

2019 2/15 タイトル修正、2/26 コマンドの誤り修正、7/7 インストール説明修正、10/25 論文引用追記、10/29 wgetしてくるデータベースのリンク更新

2020 1/8 コマンドの例修正、2/5 インストールの流れ修正、091/3 wgetしてくるデータベースのリンク更新

2022/0622 summaryコマンド追記

 

メタゲノミクスは、自然環境における微生物群集からのDNAのダイレクトシーケンシングであり、生物圏の膨大な微生物配列を発見することによって微生物学の分野に革命をもたらした。 DNAシーケンシングのスループットが向上するにつれて、メタゲノミクスは個々のリードの解析からシーケンスアセンブリへと移行した。シーケンスデプスが増すと、高品質の連続した配列(コンティグ)のデノボアセンブリが可能になった。さらに、現在の最先端技術は、これらのコンティグを高品質のドラフトゲノムまたはメタゲノムアセンブリゲノム(MAG)にビニングすることを含む。

(一部略)
 ショートリードから効率的系統分類を行うためのいくつかの効率的なツールが長年にわたって開発されてきた。ほとんどのツールは、それぞれのリードを独立した観測とみなし、リード、K-mer、または翻訳されたタンパク質レベルのいずれかで、リファレンスデータベースで最も一致するヒットを識別することによって分類学的起源を推定する(概要についてはref.10を参照)。 Kraken (K-merベース)、CLARK (識別型K-merベース)、Kaiju (タンパク質ベース)などの広く使用されているプログラムは、毎秒数十万のシークエンスリードを処理できる。FOCUS で実装されているように、精度を犠牲にすることなくさらに高速なアプローチではK-merプロファイルの混合モデリングを使用する。時には、最善のヒットと同様のスコアを有する複数のヒットを可能にするために、最後の共通祖先(LCAアルゴリズムが適用される(例えば、kraken、MEGAN)。同様に優れたトップヒットが見つかった場合、KaijuはLCAアルゴリズムによるベストヒットアプローチを使用する。
 同様のアプローチがコンティグにも適用され、分類はしばしばリファレンスデータベースへの最良のヒットに基づいている。高速ではあるが、例えばゲノム領域が高度に保存されているかまたは最近になって近縁生物からの水平遺伝子伝播(HGT)を介して獲得された場合には、ベストヒットアプローチは分類において誤った特異性をもたらし得る。以下に示すように、問題は、クエリのコンティグがデータベース内のシーケンスと非常に異なる場合、すなわちそれらが既知の生物と遠く離れている場合に特に深刻である。より高い分類ランクでの分類のみが考慮される場合、特異性(正確に分類された/完全に分類された)が増加し得る一方で、このアプローチは、既知の生物とclosely relatedなクエリコンティグに関して分類学的解像が不必要に失われ望ましくない。

 コンティグは長さに応じて複数のオープンリーディングフレーム(ORF)を含み得、その各々は分類学的シグナルを含む。これらの信号を統合することは、コンティグ全体のよりロバストな分類を可能にするはずであるが、驚くべきことに、コンティグ分類のための分散した信号を統合するツールはほとんど存在しない。ウイルス特異的パイプラインMetaVir2は、コンティグにコードされている最大5つのORFの分類を評価する。最近、LASTの検索ヒットポジションに基づいてシーケンスを区間に分割するMEGANロングリードアルゴリズムが導入された(ref.17, pubmed)。
 対照的に、MAGの分類系統への分類では、複数のORFからの情報を含めるのが一般的である。複数のマーカー遺伝子の系統樹を用いて完全なゲノムを分類することは十分に確立されているので(ref.19, pubmed)、MAG分類はこれらのベストプラクティスに従う。プロセス初期の一部のステップは自動化することができる、なぜならCheckMにより初期の 低解像度のバックボーンツリーへの配置ができ、phyloSkeleton(ref.21, pubmed)により特定のマーカー遺伝子の同定および分類群のバックボーンツリーの選択などが自動でできるからである 。しかしながら、得られた系統発生の解釈は、依然として重要な手作業のステップであり、ゲノム分類学のためのこのアプローチは、生成されるMAGの数が増えるにつれてうまく拡大できない面倒な仕事となっている(例えばref.7参照)。
 ここでは、Contig Annotation Tool(CAT)とBin Annotation Tool(BAT)を紹介する。これらの2つのツールは、基になるORFベースのアルゴリズムが、長い配列のロバストな分類と複数のタンパク質コード遺伝子配列を含むMAGを提供するように特別に設計されている。どちらのツールも自動化されており、最小限のユーザー入力のみ必要とする。すべての局面は柔軟で、ユーザーの好みに合わせた調整もできる。

 

 

インストール 

mac os10.14とubuntu16.0.4(python3.6.2)で動作確認した。

CAT and BAT have been thoroughly tested on Linux systems, and should run on Mac OS as well.

依存

#Anacondaを使っているならcondaで導入可能
conda install -c bioconda -y diamond==0.9.14
conda install -c bioconda -y prodigal==2.6.3

本体 Github

#biocondaから一括導入 (link)(diamond, prodigalも導入される。仮想環境推奨)
mamba create -n bat -y
conda activate bat
mamba install -c bioconda -c conda-forge -y cat

#または個別に導入する
git clone https://github.com/dutilh/CAT.git
cd CAT/CAT_pack/

#パスを通す
export PATH=$PATH:$PWD

> ./CAT

$ ./CAT -h

usage: CAT (prepare | contigs | bins | add_names | summarise) [-v / --version] [-h / --help]

 

Run Contig Annotation Tool (CAT) or Bin Annotation Tool (BAT).

 

Required choice:

  prepare Download database files and construct databases.

  contigs Run CAT on a contig set.

  bins Run BAT on a set of bins.

  add_names Add taxonomic names to CAT or BAT output files.

  summarise Summarise a named CAT or BAT classification file.

 

Optional arguments:

  -v, --version Print version information and exit.

  -h, --help Show this help message and exit.

 > ./CAT prepare.py -h

usage: CAT (prepare | contigs | bins | add_names | summarise) [-v / --version] [-h / --help]

CAT: error: one of the arguments prepare contigs bins add_names summarise is required

 

> CAT contigs -h

age: CAT contigs -c -d -t [options] [-h / --help]

 

Run Contig Annotation Tool (CAT).

 

Required arguments:

-c , --contigs_fasta 

Path to contigs fasta file.

-d , --database_folder 

Path to folder that contains database files.

-t , --taxonomy_folder 

Path to folder that contains taxonomy files.

 

Optional arguments:

-r , --range r parameter [0-50] (default: 10).

-f , --fraction f parameter [0-0.99] (default: 0.5).

-o , --out_prefix Prefix for output files (default: out.CAT).

-p , --proteins_fasta 

Path to predicted proteins fasta file. If supplied,

CAT will skip the protein prediction step.

-a , --diamond_alignment 

Path to Diamond alignment table. If supplied, CAT will

skip the Diamond alignment step and only classify the

contigs. A predicted proteins fasta file should also

be supplied with argument [-p / --proteins].

-n , --nproc Number of cores to deploy by Diamond (default:

maximum).

--path_to_prodigal Path to Prodigal binaries. Please supply if CAT can

not find Prodigal.

--path_to_diamond Path to Diamond binaries. Please supply if CAT can not

find Diamond.

-q, --quiet Suppress verbosity.

--no_log Suppress log file.

-h, --help Show this help message and exit.

 > ./CAT bins -h

$ cat 333

usage: CAT bins -b -d -t [options] [-h / --help]

 

Run Bin Annotation Tool (BAT).

 

Required arguments:

-b , --bin_folder Path to directory containing bins.

-d , --database_folder 

Path to folder that contains database files.

-t , --taxonomy_folder 

Path to folder that contains taxonomy files.

 

Optional arguments:

-s , --bin_suffix Suffix of bins in bin folder (default: .fna).

-r , --range r parameter [0-50] (default: 5).

-f , --fraction f parameter [0-0.99] (default: 0.3).

-o , --out_prefix Prefix for output files (default: out.BAT).

-p , --proteins_fasta 

Path to concatenated predicted proteins fasta file

generated during an earlier run of BAT. If supplied,

BAT will skip the protein prediction step.

-a , --diamond_alignment 

Path to Diamond alignment table generated during an

earlier run of BAT. If supplied, BAT will skip the

Diamond alignment step and only classify the bins. A

concatenated predicted proteins fasta file should also

be supplied with argument [-p / --proteins].

-n , --nproc Number of cores to deploy by Diamond (default:

maximum).

--path_to_prodigal Path to Prodigal binaries. Please supply if BAT can

not find Prodigal.

--path_to_diamond Path to Diamond binaries. Please supply if BAT can not

find Diamond.

-q, --quiet Suppress verbosity.

--no_log Suppress log file.

-h, --help Show this help message and exit.

> ./CAT add_names -h

usage: CAT add_names -i -o -t [options] [-h / --help]

 

Add taxonomic names to CAT or BAT output files.

 

Required arguments:

-i , --input_file Path to input file. Can be either classification

output file or ORF2LCA output file.

-o , --output_file Path to output file.

-t , --taxonomy_folder 

Path to folder that contains taxonomy files.

 

Optional arguments:

--only_official Only output official level names.

-q, --quiet Suppress verbosity.

-h, --help Show this help message and exit.

 

> ./CAT summarise -h

usage: CAT summarise -c -i -o [-h / --help]

 

Summarise a named CAT or BAT classification file.

 

Required arguments:

-i , --input_file Path to named CAT contig classification file or BAT

bin classification file. Currently only official ranks

are supported, and only classification files

containing a single classification per contig / bin.

-o , --output_file Path to output file.

 

Optional arguments:

-c , --contigs_fasta 

Path to contigs fasta file. This is required if you

want to summarise a contig classification file.

-q, --quiet Suppress verbosity.

-h, --help Show this help message and exit.

 

 

データベースの準備

オーサーが準備してくれているpre-buidのdiamondデータベースをダウンロードする(tar.gz 87GB)(*1)。

wget tbb.bio.uu.nl/bastiaan/CAT_prepare/CAT_prepare_20210107.tar.gz
tar -xvzf CAT_prepare_20210107.tar.gz

解凍すると CAT_database/とCAT_taxonomy/ができるので、ラン時にこのディレクトリを指定する。

> ls -alth CAT_prepare_20181212/

drwxr-xr-x 5 kazu 4.0K 2月 14 13:09 ../

drwxr-xr-x 4 kazu 4.0K 12月 13 23:46 ./

drwxr-xr-x 2 kazu 4.0K 12月 13 23:44 2018-12-12_CAT_database/

drwxr-xr-x 2 kazu 4.0K 12月 13 23:23 2018-12-12_taxonomy/

-rw-r--r-- 1 kazu 2.6K 12月 13 23:23 2018-12-12.CAT_prepare.fresh.log

 自分で作成する場合、まずNRのデータベースのダウンロードと、系統情報などのtax_dumpファイルセットを用意する必要がある。詳細はGIthub参照。

 

実行方法

1、CAT、またはBATを実行する。メタゲノムをde novoアセンブリして得たcontigを指定する。途中で動くdiamondはCPUをあるだけかなり効率よく使うので、フラグ指定なしが一番早いが、他の処理を並行して行っている時は注意する("-n threads"で指定可能)。

CAT contigs -c contigs.fa -d CAT_database/ -t CAT_taxonomy/ -o out

いくつかファイルが出力されるが、デフォルト名の最終出力はout.CAT.ORF2LCA.txt とout.CAT.bin2classification.txtという、lineage情報とbit.scoreのファイルになる。

 

すでにbinningしてfastaファイルを得ているならbinned.fastaディレクトリを指定してCAT bins(BAT)を実行する。FASTAのprefixはfastaとする。

CAT bins -b bin_dir -d database_dir -t taxonomy_dir -s fasta -n 50 -o CAT

> head '/home/kazu/CAT_BAT/CAT-master/CAT_pack/ out.ORF2LCA.txt' 

# ORF lineage bit-score

NODE_1000_length_1357_cov_2.956098_1 1;131567;2;1224;1236;135619;224372;59753;2202653 339.0

NODE_1000_length_1357_cov_2.956098_2 1;131567;2;1224;1236 76.3

NODE_1001_length_1357_cov_2.785366_1 1;131567;2;1224;1236;135619;224372;59753;2202653 316.6

NODE_1001_length_1357_cov_2.785366_2 1;131567;2;1224;1236;135619;224372;59753;2202653 387.9

NODE_1002_length_1356_cov_34.640358_1 1;131567;2;1783272;1798711;1117;1301283;1150;1892252;35823;118562 211.8

NODE_1002_length_1356_cov_34.640358_2 1;131567;2;1783272;1798711;1117;1301283;1150;1892252;35823;118562 169.5

NODE_1003_length_1356_cov_1.789260_1 1;131567;2;1224;1236;135619;224372;59753;2202653 154.8

NODE_1003_length_1356_cov_1.789260_2 1;131567;2;1224;1236;135619;224372;59753;2202653 535.4

NODE_1004_length_1355_cov_1.951140_1 1;131567;2;1224;1236;135619;224372;59753;2202653 447.2

右端のカラムがlineage情報になる。


  

2、種名追加

CAT add_names -i out.CAT.ORF2LCA.txt -o out.CAT.ORF2LCA_names.txt -t taxonomy_dir

>  head out.CAT.ORF2LCA_names.txt

# ORF lineage bit-score full lineage names

NODE_1000_length_1357_cov_2.956098_1 1;131567;2;1224;1236;135619;224372;59753;2202653 339.0 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

NODE_1000_length_1357_cov_2.956098_2 1;131567;2;1224;1236 76.3 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class)

NODE_1001_length_1357_cov_2.785366_1 1;131567;2;1224;1236;135619;224372;59753;2202653 316.6 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

NODE_1001_length_1357_cov_2.785366_2 1;131567;2;1224;1236;135619;224372;59753;2202653 387.9 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

NODE_1002_length_1356_cov_34.640358_1 1;131567;2;1783272;1798711;1117;1301283;1150;1892252;35823;118562 211.8 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Terrabacteria group (no rank) Cyanobacteria/Melainabacteria group (no rank) Cyanobacteria (phylum) Oscillatoriophycideae (subclass) Oscillatoriales (order) Microcoleaceae (family) Arthrospira (genus) Arthrospira platensis (species)

NODE_1002_length_1356_cov_34.640358_2 1;131567;2;1783272;1798711;1117;1301283;1150;1892252;35823;118562 169.5 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Terrabacteria group (no rank) Cyanobacteria/Melainabacteria group (no rank) Cyanobacteria (phylum) Oscillatoriophycideae (subclass) Oscillatoriales (order) Microcoleaceae (family) Arthrospira (genus) Arthrospira platensis (species)

NODE_1003_length_1356_cov_1.789260_1 1;131567;2;1224;1236;135619;224372;59753;2202653 154.8 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

NODE_1003_length_1356_cov_1.789260_2 1;131567;2;1224;1236;135619;224372;59753;2202653 535.4 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

NODE_1004_length_1355_cov_1.951140_1 1;131567;2;1224;1236;135619;224372;59753;2202653 447.2 root (no rank) cellular organisms (no rank) Bacteria (superkingdom) Proteobacteria (phylum) Gammaproteobacteria (class) Oceanospirillales (order) Alcanivoracaceae (family) Alcanivorax (genus) Alcanivorax indicus (species)

右端のカラムにつく。

 

3、まとめ

CAT add_names -i out.contig2classification.txt -o
out.CAT.ORF2LCA_names.txt -t taxonomy/ --only_official

CAT summarise -c contig.fasta -i out.CAT.ORF2LCA_names.txt -o
CAT_summary.txt

テスト時はエラーになった。 --only_official”を付けるとランできた。

 

引用

Robust taxonomic classification of uncharted microbial sequences and bins with CAT and BAT
F.A. Bastiaan von Meijenfeldt, Ksenia Arkhipova, Diego D. Cambuy, Felipe H. Coutinho, Bas E. Dutilh

bioRxiv preprint first posted online Jan. 24, 2019

 

2019 10/24追記

Robust taxonomic classification of uncharted microbial sequences and bins with CAT and BAT

F. A. Bastiaan von Meijenfeldt, Ksenia Arkhipova, Diego D. Cambuy, Felipe H. Coutinho & Bas E. Dutilh
Genome Biology volume 20, Article number: 217 (2019)

 

*1

ダウンロードには一晩かかった。 

 

関連


 

 

Blobtoolsの系統アサイン感度も改善できそうですね。