Using qiime tools view in jupyter

When using ´qiime tools view somefilename.qzv´ in jupyter it opens up nicely in a new browser window, so no problems there. However, I am unable to then move on because I can’t get the cell to stop working. There is a tool tip to press “q” or “Control-C” or “Control-D”, but where should that be used? In the tab that opens up? With the cursor inside the cell? I’m sorry if this is really obvious, but no amount of googling has helped me… I have tried several things, but eventually I end up restarting the kernel to get the cell to stop hanging. Sometimes I am able to simply interrupt the kernel, but surely that’s not how this should work?

Hello @asajoh,

Welcome to the forum! I could be wrong, but it seems like you are trying to use the QIIME 2 CLI (command line interface) in Jupyter Notebook, which I didn’t even know was possible! I believe what you are looking for is the QIIME API (application programming interface). Using your example, try typing the following:

from qiime2 import Visualization
Visualization.load('somefilename.qzv')

This should open your Visualization file nicely within the Jupyter Notebook. Good luck!

5 Likes

Wow!

Ok, I have no idea what I’m using. I am a bit of a noob. Anyway, running QIIME2 code with a ! in front in a jupyterlab notebook seems to work for most things.

I had already tried what you suggested and only managed to get error messages in return, but obviously now that I tried again, it worked perfectly. Thank you!

The only thing I did differently that I hadn’t tried before, was putting the two lines in separate cells. Not sure if that made the difference or if something else is going on.

Do I need to import Visualization every time or is that a per kernel thing?

2 Likes

Glad it works, @asajoh!

That is certainly odd! In theory, it shouldn't matter whether you put those lines in the same cell or not. My guess is that something went south in your kernel. Perhaps you can restart your kernel and then try running those lines again within the same cell this time.

Yes, you only need to import Visualization once in your kernel!

2 Likes

Wonderful, thank you very much!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.