q2-krona: Plugin for creating Krona plots

Hello everyone,

I've finally got time from work and finished the plugin. :tada:

Special thanks to @Nicholas_Bokulich for suggesting making my own plugin, and @thermokarst for revision.

The plugin is available at my github page (see: https://github.com/kaanb93/q2-krona).

Simply, Krona is a tool to create interactive multi-layered pie charts. Here is an example view of the chart below.

q2-krona is developed to make is easy to generate Krona plots, because the tool needs some rearrangement on FeatureTable[Frequency] to be able to work.

For now, the plugin consists of one visualizer and one pipeline. There might be some additions later on.

PLOT

This visualizer takes FeatureTable[Frequency] as input. But, I strongly suggest to use a collapsed table because this visualizer does NOT use reference taxonomy.

COLLAPSE AND PLOT

This pipeline uses taxa collapse method to use reference taxonomy with FeatureTable[Frequency] taken as input and krona plot visualizer to generate Krona plots. Collapse level and taxonomy delimiter are definable.

Here, I used feature table filtered to 2k minimum frequency and taxonomy from Parkinson's Mouse Tutorial to test the plugin.

Files:
https://docs.qiime2.org/2021.8/data/tutorials/pd-mice/table_2k.qza
https://docs.qiime2.org/2021.8/data/tutorials/pd-mice/taxonomy.qza

 qiime krona collapse-and-plot \
--i-table table_2k.qza \
--i-taxonomy taxonomy.qza \
--o-krona-plot krona.qzv

Output:
krona.qzv (401.0 KB)

The visualizer is viewable at QIIME 2 View.

Hope this plugin helps all QIIMErs. I can take suggestions/critiques on this forum or the github page.

Best wishes,

17 Likes

Hi @the_dummy,
Brilliant thanks so much!
I got only one comment:
could you please add to:
https://library.qiime2.org/plugins/

:pray:

Thank so much!
Luca

6 Likes

Hi @llenzi ,

I have just done it :+1:

6 Likes

This looks great @the_dummy!

One suggestion, you should add the original Krona reference to the plugin, so that the original authors get credit. Below are some examples from RESCRIPt:

Then you can test that it works by running qiime krona --citations.

6 Likes

Hi @SoilRotifer,

I wasn't sure how to cite it but your example helped me clarify my head. Thank you!

1 Like

Thank you for this nice tool!
I have an issue: on a command-line-only computer. I get the message:
Plugin error from krona:
[Errno 2] No such file or directory: '/tmp/tmpx4vzjxpu/index.html'
Debug info has been saved to /tmp/qiime2-q2cli-err-slkk0igk.log

However: it works perfectly on a local PC the same command with the same data and same version of Qiime (2021.11) and Ubuntu (20.04), Python (3.8).

If you want I can also supply the log file.

1 Like

Hi @jack2017 ,

It's nice to see people using it :slight_smile:

Could you check if krona itself is installed and ktImportText is callable in the environment?

1 Like

I've added error handling for FileNotFoundError. Now, the plugin checks if ktImportText is available.

Dear @the_dummy

I installed krona 1.0.2, ran the command again and got the message:

Plugin error from krona:
'ktImportText' is not found, but can be installed with:
conda install -c bioconda krona
Debug info has been saved to /tmp/qiime2-q2cli-err-8fro5eex.log

So I installed bioconda krona and now it works indeed! Thanks!

2 Likes

It is in the instructions, so I must have been too hasty installing krona on that 2nd machine...

1 Like

Hi @the_dummy!

Amazing work! I was looking at Krona's web for days hoy to import qiime files and it was just here in the forum!! Thank you so much!

Just one thing... do u know if it is possible to delete the first letter in the taxonomy file (like k_ from kingdom etc) for the plot??

Thank you in advance!!
Ana.

1 Like

Hi @Anuka,

Firstly, you are welcome. I'm glad that the plugin is helping people.

And I think RESCRIPt's edit taxonomy is the right answer here. It is better to edit taxonomy file first, and then use the plotting tool. Some regex knowledge is required to accomplish what you asked, and I'm not good at it. :man_facepalming:

But I think the pattern is something like below:

^(k_)*(p_)* etc. etc. (s_)*$

Maybe @SoilRotifer could help us better.

Best wishes,

Kaan

2 Likes

Hello all!!

I was wondering if is it possible to do krona charts based on metadata... I mean, I have 72 samples, from 3 dates and 2 different conditions... is it possible to get 2 krona charts, one from each condition? Thank you all!!!

Best wishes,

Anuka.

Hi @Anuka,

I would use filter-samples to get two different feature tables based on the conditions.

Then, you can use the feature tables regularly with q2-krona.

Sincerely,

Kaan

1 Like

Got it!! Thank you a lot!!

But now I'm having problems using this table in q2-krona...

Plugin error from krona:

[Errno 2] No such file or directory: '/tmp/tmpmyqgups5/index.html'

Debug info has been saved to /tmp/qiime2-q2cli-err-81c693y8.log

If I use othe table as input I've no problem, but I got this error when using this one... Where can be the problem?? Thank you in advance!!

Could you paste the command that you tried running, and the debug info file /tmp/qiime2-q2cli-err-81c693y8.log?

Here is the command:
qiime krona collapse-and-plot --i-table filtered_tables/filtered_table.qza --i-taxonomy taxonomy/taxonomy.qza --o-krona-plot krona/krona_collapsed.qzv

All the error is what I pasted:

Plugin error from krona:

[Errno 2] No such file or directory: '/tmp/tmpmyqgups5/index.html'

Debug info has been saved to /tmp/qiime2-q2cli-err-81c693y8.log

I found the error, the file filtered was empty. However, I found that after filtration, I got 24 samples (all December samples, for example), so I got 24 krona plots... and I just want one, as the mean of all december samples...

Is it possible? Here are the scripts I used:

qiime feature-table filter-samples --i-table dada2/table_14k.qza --m-metadata-file metadata.tsv --p-where "[Date] IN ('December')" --o-filtered-table dada2/December_table.qza

qiime krona collapse-and-plot --i-table dada2/December_table.qza --i-taxonomy taxonomy/taxonomy.qza --o-krona-plot krona/krona_december.qzv

Thank you in advance

Hi @Anuka,

Sorry for the late response, I was out of town, and could not find a good time to check my stuff.

You can use feature-table group for this occasion. It allows to group samples by desired modes.

Just a side note: Do not forget to prepare a new metadata file after grouping, because the new feature table will contain new sample IDs.

Hope this helps,

Kaan

It worked!!

Thank you very much!!

1 Like