2019 4/26 わかりにくい文章を修正
2021 8/8 コマンド修正
メタゲノム研究の重要な成果は、分類群または機能群の存在量の推定である。これらのグループへのアサインおける固有の不確実性は、それらの階層的コンテキストとそれらの予測信頼度の両方を考慮することを重要にしている。しかし、メタゲノムデータを視覚化するための現在のツールは、定量的な階層関係を省略または歪ませ、二次的な変数を表示するための機能を欠いている。
ここでKrona、メタゲノム分類の複雑な階層内の相対存在量と信頼性の直感的な探査を可能にする新しい視覚化ツールを紹介する。 Kronaは、パラメトリックなカラーリングとインタラクティブな極座標ズーミングを備え、さまざまな放射状のスペースフィルディスプレイを組み合わせている。 HTML 5とJavaScriptの実装により、インストールされたソフトウェアやプラグインを必要とせずに、あらゆるモダンWebブラウザで閲覧できる完全にインタラクティブなチャートが可能になる。このWebベースのアーキテクチャでは、各チャートを独立したドキュメントにすることもできるため、電子メールで共有したり標準のWebサーバーに投稿したりすることが容易になる。 論文ではKronaの有用性を説明するために、さまざまなメタゲノムデータセットへのその適用と一般的なメタゲノム解析ツールとの互換性について説明する。Kronaレンダリングコードと変換ツールはどちらもBSDオープンソースライセンスの下で無料で提供され、http://krona.sourceforge.netから入手できる。
インストール
docker上のubuntu16.04でビルドし、動作確認した。
本体 Github
#Anacondaを使っているならcondaで導入できる
conda install -c bioconda -y krona
> ktImportTaxonomy
$ ktImportTaxonomy
______________________________________________________________________________________________________________/ KronaTools 2.7 - ktImportTaxonomy \___
Creates a Krona chart based on taxonomy IDs and, optionally, magnitudes and scores. Taxonomy IDs corresponding to a rank of "no rank" in the database will be assigned to their parents to make the hierarchy less cluttered (e.g.
"Cellular organisms" will be assigned to "root").
__________________________________________________________________________________________________________________________________________/ Usage \___
ktImportTaxonomy \
[options] \
taxonomy_1[:magnitudes_1][,name_1] \
[taxonomy_2[:magnitudes_2][,name_2]] \
...
taxonomy Tab-delimited file with taxonomy IDs and (optionally) query IDs, magnitudes and scores. By default, query IDs, taxonomy IDs and scores will be taken from columns 1, 2 and 3, respectively (see -q, -t, -s, and -m).
Lines beginning with "#" will be ignored. By default, separate datasets will be created for each input (see [-c]).
magnitudes Optional file listing query IDs with magnitudes, separated by tabs. This can be used to account for read length or contig depth to obtain a more accurate representation of abundance. By default, query sequences
without specified magnitudes will be assigned a magnitude of 1. Magnitude files for assemblies in ACE format can be created with ktGetContigMagnitudes.
name A name to show in the list of datasets in the Krona chart (if multiple input files are present and [-c] is not specified). By default, the basename of the file will be used.
________________________________________________________________________________________________________________________________________/ Options \___
[-o <string>] Output file name. [Default: 'taxonomy.krona.html']
[-n <string>] Name of the highest level. [Default: 'Root']
[-i] Include a wedge for queries with no hits.
[-c] Combine data from each file, rather than creating separate datasets within the chart.
[-q <integer>] Column of input files to use as query ID. Required if magnitude files are specified. [Default: '1']
[-t <integer>] Column of input files to use as taxonomy ID. [Default: '2']
[-s <integer>] Column of input files to use as score. [Default: '3']
[-m <integer>] Column of input files to use as magnitude. If magnitude files are specified, their magnitudes will override those in this column.
[-d <integer>] Maximum depth of wedges to include in the chart.
[-k] Allow assignments to taxa with ranks labeled "no rank" (instead of moving up to parent).
[-x <integer>] Hue (0-360) for "bad" scores. [Default: '0']
[-y <integer>] Hue (0-360) for "good" scores. [Default: '120']
[-u <string>] URL of Krona resources to use instead of bundling them with the chart (e.g. "http://krona.sourceforge.net"). Reduces size of charts and allows updates, though charts will not work without access to this URL.
[-qp <string>] Url to send query IDs to (instead of listing them) for each wedge. The query IDs will be sent as a comma separated list in the POST variable "queries", with the current dataset index (from 0) in the POST
variable "dataset". The url can include additional variables encoded via GET.
[-tax <string>] Path to directory containing a taxonomy database to use. [Default: '/Users/kazuma/.pyenv/versions/miniconda3-4.0.5/opt/krona/taxonomy']
> ktImportText
$ ktImportText
_____________________________________________________________________________________________________/ KronaTools 2.7 - ktImportText \___
Creates a Krona chart from text files listing quantities and lineages.
_____________________________________________________________________________________________________________________________/ Usage \___
ktImportText \
[options] \
text_1[,name_1] \
[text_2[,name_2]] \
...
text Tab-delimited text file. Each line should be a number followed by a list of wedges to contribute to (starting from the highest level). If no wedges are listed (and just a quantity is given), it will
contribute to the top level. If the same lineage is listed more than once, the values will be added. Quantities can be omitted if -q is specified. Lines beginning with "#" will be ignored. By default,
separate datasets will be created for each input (see [-c]).
name A name to show in the list of datasets in the Krona chart (if multiple input files are present and [-c] is not specified). By default, the basename of the file will be used.
__________________________________________________________________________________________________________________________/ Options \___
[-o <string>] Output file name. [Default: 'text.krona.html']
[-n <string>] Name of the highest level. [Default: 'all']
[-q] Files do not have a field for quantity.
[-c] Combine data from each file, rather than creating separate datasets within the chart.
[-u <string>] URL of Krona resources to use instead of bundling them with the chart (e.g. "http://krona.sourceforge.net"). Reduces size of charts and allows updates, though charts will not work without access to
this URL.
データベース作成
condaパッケージマネージャを使ってインストールすると、最後に以下のようにメッセージが出る。
If you would like the taxonomic data stored elsewhere, simply replace
this directory with a symlink. For example:
rm -rf /home/kazu/.pyenv/versions/miniconda3-4.0.5/opt/krona/taxonomy
mkdir /path/on/big/disk/taxonomy
ln -s /path/on/big/disk/taxonomy /home/kazu/.pyenv/versions/miniconda3-4.0.5/opt/krona/taxonomy
ktUpdateTaxonomy.sh
taxonomyデータベースをダウンロードする前に、以下のようにリンクを修正。ここではpyenvでpythonのバージョン管理しており、miniconda3-4.0.5に入れたkronaのデータベースリンクを修正している。
rm -rf ~/.pyenv/versions/miniconda3-4.0.5/opt/krona/taxonomy
mkdir -p krona/taxonomy
データベースダウンロード
ktUpdateTaxonomy.sh krona/taxonomy/
cp -r krona/taxonomy/ ~/.pyenv/versions/miniconda3-4.0.5/opt/krona/
> head -n 30 ~/krona/taxonomy/taxonomy.tab
$ head -n 30 ~/krona/taxonomy/taxonomy.tab
1 0 1 no rank root
2 2 131567 superkingdom Bacteria
6 7 335928 genus Azorhizobium
7 8 6 species Azorhizobium caulinodans
9 8 32199 species Buchnera aphidicola
10 7 1706371 genus Cellvibrio
11 9 1707 species Cellulomonas gilvus
13 7 203488 genus Dictyoglomus
14 8 13 species Dictyoglomus thermophilum
16 7 32011 genus Methylophilus
17 8 16 species Methylophilus methylotrophus
18 8 213421 genus Pelobacter
19 9 18 species Pelobacter carbinolicus
20 7 76892 genus Phenylobacterium
21 8 20 species Phenylobacterium immobile
22 7 267890 genus Shewanella
23 8 22 species Shewanella colwelliana
24 8 22 species Shewanella putrefaciens
25 8 22 species Shewanella hanedai
27 5 49928 species halophilic eubacterium NRCC 41227
28 5 49928 species halophilic eubacterium
29 6 28221 order Myxococcales
31 8 80811 family Myxococcaceae
32 9 31 genus Myxococcus
33 10 32 species Myxococcus fulvus
34 10 32 species Myxococcus xanthus
35 10 32 species Myxococcus macrosporus
38 10 47 species Archangium disciforme
39 8 80811 family Archangiaceae
40 9 39 genus Stigmatella
実行方法
1、ktImportTaxonomy 分類学の階級に従って分類(link)
フォーマットはクエリのID、NCBI taxonomy ID (taxIDs)、scoreの順番。
異なる場合、例えばkraken report出力を可視化する場合、NCBI taxonomy IDはカラム3、クエリのIDはカラム2なので、
よって、次のようにカラム指定する(*1)。
ktImportTaxonomy -q 2 -t 3 results.kraken -o output.plot.html
- -q Column of input files to use as query ID. Required if magnitude files are specified. [Default: '1']
- -t Column of input files to use as taxonomy ID. [Default: '2']
output.plot.htmlが出力される。
2、ktImportText テキストファイル入力から可視化(link)
分類学の階級以外のデータの可視化に利用できる。例えば下のような食物の分類。
フォーマットは、左端のカラムが割合。2カラム目以降は使用している階級の上位から記載していく。例えば上のようにカラム2で脂質、カラム3で飽和脂肪酸、または不飽和脂肪酸。
ランするには、用意したテキストファイルを指定する。
ktImportText results.kraken -o output.plot.html
引用
Interactive metagenomic visualization in a Web browser
Brian D Ondov, Nicholas H Bergman, Adam M Phillippy
BMC Bioinformatics. 2011; 12: 385.
参考
*1
またはcut -f 2-3でカラム2-3だけ取り出し、それをktImportTaxonomyの入力に使う。これでオプションのフラグ無しでランできる。
Question: Transforming kraken outputs to krona
Transforming kraken outputs to krona
関連