mafft does not work inside my Qiime2 environment

Hello, I am running q2cli version 2021.2.0, installed using conda, on MacOS Mojave 10.14.6.

I am having issues with mafft but it doesn’t seem to be related to the memory/large file issues covered in posts like this one. The command I was running when I discovered the issue was:

qiime phylogeny align-to-tree-mafft-fasttree \
  --i-sequences rep-seqs.qza \
  --o-alignment aligned-seqs.qza \
  --o-masked-alignment masked-aligned-rep-seqs.qza \
  --o-tree unrooted-tree.qza \
  --o-rooted-tree rooted-tree.qza

However, before I go into the specifics of this error, simply running mafft within my conda Qiime2 environment does not invoke the same behavior as running it outside of this environment:

(qiime2-2021.2) ~ $ mafft

v0.000 != v7.055b (2013/07/25)

There is a problem in the configuration of your shell.
Check the MAFFT_BINARIES environmental variable by
$ echo $MAFFT_BINARIES

This variable must be *unset*, unless you have installed MAFFT
with a special configuration.  To unset this variable, type
$ unset MAFFT_BINARIES
or
% unsetenv MAFFT_BINARIES
Then retry
$ mafft input > output

To keep this change permanently, edit setting files
(.bash_profile, .profile, .cshrc, etc) in your home directory
to delete the MAFFT_BINARIES line.
On MacOSX, also edit or remove the .MacOSX/environment.plist file
and then re-login (MacOSX 10.6) or reboot (MacOSX 10.7).

Please send a problem report to [email protected],
if this problem remains.

So I checked where it was accessing mafft:

(qiime2-2021.2) ~ $ which mafft
/opt/local/bin/mafft

And then deactivated the environment and checked again:

(qiime2-2021.2) ~ $ conda deactivate
(base) ~ $ which mafft
/opt/local/bin/mafft

It’s the same, but in the base environment mafft results in different behaviour:

(base) ~ $ mafft

---------------------------------------------------------------------

   MAFFT v7.055b (2013/07/25)

        Copyright (c) 2013 Kazutaka Katoh
        MBE 30:772-780 (2013), NAR 30:3059-3066 (2002)
        http://mafft.cbrc.jp/alignment/software/
---------------------------------------------------------------------


Input file? (fasta format)
@ 

I have tried:

  1. to unset the binaries both inside and outside of the conda environment with unset MAFFT_BINARIES as indicated in the error message, but this does not seem to change anything
  2. adding mafft to ~/.bash_profile, although this seems unnecessary as which mafft already points to the correct location.
  3. searching for generic solutions when unable to unset an environment variable, but I have been unable to find a solution. I am certain it is something simple, but unfortunately this is not my forte. I appreciate that this may not be, technically speaking, a Qiime2 issue, but I am hoping that it is a behavior that you will understand in the context of Qiime2 and thus be able to advise.
1 Like

Hi, @kathrine-mcaulay :wave: !

Do you recall having installed mafft separately, outside of your QIIME 2 installation and how you went about it? These sorts of issues often arise as a result of a misconfigured PATH variable. And you are probably correct that it is likely something simple! With your QIIME 2 conda environment activated, can you share the output of the env command as well as conda list?

Thanks @andrewsanchez. I actually have zero memory of installing mafft outside of my QIIME2 installation and as you will see from the attached files, things are a little disorganized...

conda_list_qiime2_4.19.21.txt (29.7 KB) env_qiime2_4.19.21.txt (7.9 KB)

When it comes to the PATH variable, the order of items matters. You can see below that the mafft installation external to your qiime 2 conda environment appears before the qiime 2 environment. It’s important that the qiime 2 environment comes first. Otherwise, your computer will favor programs that appear earlier in the list.

PATH=/opt/local/bin/mafft:/Users/m213406/Filtlong/bin:/Users/m213406/nanotimeparse:/Users/m213406/NanoOK/bin:/opt/local/share/arb/bin:/opt/local/bin:/opt/local/sbin:/Users/m213406/opt/anaconda3/envs/qiime2-2021.2/bin:/Users/m213406/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/m213406/centrifuge/bin:/usr/local/ncbi/blast/bin:/Library/TeX/texbin:/opt/X11/bin

Usually, the PATH variable is configured in the ~/.bash_profile on mac os, but it could be conifigured elsewhere like in ~/.zshrc. The way to fix this is figure out where PATH is being set, and to remove the line that is prepending mafft to the variable. For example, if you find the following line in your ~/.bash_profile:

export PATH=/opt/local/bin/mafft:$PATH

This would prepend that specific mafft installation. In this case, you could just remove that line entirely.

Note that there are also several other items which appear at the beginning of the list, prior to the qiime2 bit. This may or may not cause problems, but is often a sign of a less than ideal approach to configuring PATH.

I hope that helps! Good luck, and let me know how you get along.

1 Like

Hmmm, ok so this line was in my ~/.bash_profile, but only because I put it there while trying to troubleshoot this before posting on here. I do not have .bashrc or .zshrc on this machine.

I believe I installed these other programs in my base environment, is this what is forcing them before qiime2 inside this environment? I can certainly uninstall nanotimeparse as I ended up having to use that inside a virtual machine anyway. Regarding the others: arb was installed using MacPorts and the others I manually added to ~/bash_profile. Presumably I have messed things up doing this.

Do you want me to take this elsewhere since it isn’t really a QIIME2 question at this stage?

It looks like those other programs have nothing to do with conda and were installed by other means.

I'm happy to assist. This is a somewhat common issue so it's handy to have a record of problems/solutions here on the forum.

1 Like

Thank you, I appreciate it.

I removed the other programs that I am not using frequently from my PATH. This seemed to remove any reference to mafft from the output of env. I then uninstalled and reinstalled QIIME2 and this seems to have solved the problem.

Thanks again for helping me troubleshoot!

2 Likes

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