Using Mothur in an IPython Notebook

Hi Forum,

I’m new here, so I hope that this the right place to put this. I am also new to Mother, but I have been using IPython for a while now. I saw this tweet the tweet: https://twitter.com/patschloss/status/454224386375958528

I downloaded the software from here: https://github.com/SchlossLab/ipython-mothurmagic

But, I can’t seem to get it working.
When I try to execute a command, for example:

%%mothur cluster(help)

I get the error message:

"Can’t open mothur: Permission denied”

However, the command ls -l indicates that I have full permission:

-rwxr-xr-x@ 1 USER staff 17728780 Apr 5 11:31 mother

Does anyone know what I need to do so that I can use this magic?

Is your executable mother (as written in the output) or mothur? We expect mothur :slight_smile:

Haha, it should have said “Mothur”. My browser still autocorrects mothur to mother. I bet you guys get that a lot.
The corrected line:
drwxr-xr-x@ 9 sanglab staff 306 Apr 17 12:12 mothur

Thank you for your reply by the way.

Can you execute mothur from the command line outside of the notebook fine? All that ipython-mothurmagic does is issue a system subprocess call so if you can open mothur from the command line then the notebook should also be able to open it… ipython-mothurmagic expects mothur to either be in your path or in the directory that you are running the notebook from.

Also, for when you do get it working, ipython-mothurmagic does cell magic not line magic. So:

%%mothur mothur.command(help)

That won’t work, but:

%%mothur
mothur.command(help)

That will work. Also note mothur’s current variables won’t persist across notebook cells or sessions. If you want current variables to persist you can use my fork available here.

NOOB ALERT!
I had moved the Mothur directory into the folder with my notebooks, that was the problem :roll: . I just now made a new notebook inside the Mothur folder and it worked perfectly. Thanks for your help and for your reply. I think Mothur is a great product and I will recommend it to all of my friends (who do this kind of work). :geek:

Glad you got it working! :smiley:

Richard