QIIME2でのITS領域解析のために、UNITEデータベースから分類器を作成する


UNITEデータベースとは

UNITEとは、真核生物の核内リボソームITS領域を中心としたデータベースのこと。
真菌のITS2領域のアンプリコンゲノムシーケンスを用いてQIIME2にて種のアサインメントする際に、このデータベースを使用した。

データベースのダウンロード

QIIME用のデータベースが用意されている。
UNITE QIIME release for Fungi (Published 2020)

# 名前が長いので、変更して出力した。
wget https://files.plutof.ut.ee/public/orig/98/AE/98AE96C6593FC9C52D1C46B96C2D9064291F4DBA625EF189FEC1CCAFCF4A1691.gz -O sh_qiime_release_04.02.2020.tar.gz

tar -zxvf sh_qiime_release_04.02.2020.tar.gz

UNITEデータベースにて、プライマー配列に合わせてトリミングしてもメリットがないので、完全なシーケンスで分類器をトレーニングするほうがよい。
標準シーケンスはすでにITS領域にトリミングされているため、developer/のディレクトリ内にあるシーケンスを使うと良い。

UNITEデータベースのバージョンによっては、QIIME2にインポートする前に、行末のスペース、小文字を除去する必要がある。
今回は、以下のコマンドを実施せずに分類器作成まで進めた。

# 小文字の除去。
awk '/^>/ {print($0)}; /^[^>]/ {print(toupper($0))}' sh_qiime_release_04.02.2020/developer/sh_refs_qiime_ver8_99_04.02.2020_dev.fasta | tr -d ' ' > sh_qiime_release_04.02.2020/developer/sh_refs_qiime_ver8_99_04.02.2020_uppercase_dev.fasta

# 2019.7バージョンを使う場合は、行末に空白があった場合に以下で除去。
sed -e '/^>/!s/\(.*\)/\U\1/;s/[[:blank:]]*$//' sh_qiime_release_04.02.2020/developer/sh_refs_qiime_ver8_99_04.02.2020_dev.fasta > sh_qiime_release_04.02.2020/developer/sh_refs_qiime_ver8_99_04.02.2020_no_blank_dev.fasta

QIIME2での分類器の作成

以下、qiime2コマンドを用いて作業をすすめる。分類器のトレーニングには少し時間がかかる。

# 教師データ(UNITEデータベースのシーケンス)の読み込み
qiime tools import \
--type 'FeatureData[Sequence]' \
--input-path sh_qiime_release_04.02.2020/developer/sh_refs_qiime_ver8_99_04.02.2020_dev.fasta \
--output-path sh_refs_qiime_ver8_99_04.02.2020.qza

# 教師データ(UNITEデータベースの分類群)の読み込み
qiime tools import \
--type 'FeatureData[Taxonomy]' \
--input-format HeaderlessTSVTaxonomyFormat \
--input-path sh_qiime_release_04.02.2020/developer/sh_taxonomy_qiime_ver8_99_04.02.2020_dev.txt \ 
--output-path ref-taxonomy.qza

# 分類器のトレーニング
qiime feature-classifier fit-classifier-naive-bayes \
--i-reference-reads sh_refs_qiime_ver8_99_04.02.2020.qza \
--i-reference-taxonomy ref-taxonomy.qza \
--o-classifier sh_refs_qiime_ver8_99_04.02.2020_classifier.qza

@jgalipon さんにご指摘頂き、ファイル名のタイプミスを修正しました!
ありがとうございました。(2021.03.12)

参考にした記事

Classification of fungal ITS sequences

In our experience, fungal ITS classifiers trained on the UNITE reference database do NOT benefit from extracting/trimming reads to primer sites. We recommend training UNITE classifiers on the full reference sequences. Furthermore, we recommend the “developer” sequences (located within the QIIME-compatible release download) because the standard versions of the sequences have already been trimmed to the ITS region (excluding portions of flanking rRNA genes that may be present in amplicons generated with standard ITS primers).

Fungal ITS analysis tutorial

We need to scrub lowercase characters from the sequences to avoid errors downstream. This is because this version of the UNITE database contains some lowercase characters — this is not something that needs to be done to all databases prior to importing to QIIME 2.

QIIME2で分類器を自作する

「qiime feature-classifier」実行後に「Killed」と表示されて処理が終了する場合、メモリ不足の可能性がある。当初Dockerのメモリに8GB割り当てている状態では処理が中断し、24GB割り当てると問題なく実行された。