Error occuring with Aldex

Hi,

I'm trying to run aldex2, and even though I have already installed it using R and condo, I still get the following error running the command below:

qiime aldex2 aldex2 --i-table table.qza --m-metadata-file sample-metadata.tsv --m-metadata-column subject --o-differentials differentials.qza --verbose

Running external command-line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: run_aldex2.R /var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/input.tsv.biom /var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/input.map.txt subject 128 t all /var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/output.summary.txt

R version 3.5.1 (2018-07-02)
Error in library(ALDEx2) : there is no package called ‘ALDEx2’
Execution halted
Traceback (most recent call last):
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_aldex2/_method.py", line 59, in aldex2
run_commands([cmd])
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_aldex2/_method.py", line 21, in run_commands
subprocess.run(cmd, check=True)
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['run_aldex2.R', '/var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/input.tsv.biom', '/var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/input.map.txt', 'subject', '128', 't', 'all', '/var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T/tmpn7tucd9d/output.summary.txt']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2cli/commands.py", line 327, in call
results = action(**arguments)
File "</Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/decorator.py:decorator-gen-481>", line 2, in aldex2
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py", line 240, in bound_callable
output_types, provenance)
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py", line 383, in callable_executor
output_views = self._callable(**view_args)
File "/Users/parbab/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_aldex2/_method.py", line 63, in aldex2
" and stderr to learn more." % e.returncode)
Exception: An error was encountered while running ALDEx2 in R (return code 1), please inspect stdout and stderr to learn more.

I'd appreciate your help on this :slight_smile:

I suspect this is the main ussue:

Error in library(ALDEx2) : there is no package called ‘ALDEx2’

What happened at this step of the installation instructions?

install.packages("BiocManager")
BiocManager::install("ALDEx2")

Yes, the installation part in R is like this:

install.packages("BiocManager")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/BiocManager_1.30.10.tgz'
Content type 'application/x-gzip' length 94951 bytes (92 KB)
==================================================
downloaded 92 KB

The downloaded binary packages are in
/var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T//RtmpAxNOBe/downloaded_packages

BiocManager::install("ALDEx2")
Bioconductor version 3.9 (BiocManager 1.30.10), R 3.6.1 (2019-07-05)
Installing package(s) 'ALDEx2'
trying URL 'https://bioconductor.org/packages/3.9/bioc/bin/macosx/el-capitan/contrib/3.6/ALDEx2_1.16.0.tgz'
Content type 'application/x-gzip' length 1037145 bytes (1012 KB)
==================================================
downloaded 1012 KB

The downloaded binary packages are in
/var/folders/8f/d1b8lmn12d955nfl54sk1xqn1sm5d2/T//RtmpAxNOBe/downloaded_packages

Those are different versions of R: the error messages that qiime aldex2 aldex2 gave you say they're from R 3.5.1, while the installation message you got says it's from R 3.6.1.

I think this discrepancy means you need to activate your QIIME 2 conda environment before running these installation commands. Could you try re-running these installation commands after activating your QIIME 2 environment?

I did, but the error occurred again.

Hm, that's interesting. Just to make sure we're on the same page, you got the exact same error as before (with the text "Error in library(ALDEx2) : there is no package called ‘ALDEx2’")?

Not sure what the cause of getting that error again could be, but I looked it up and it seems like in the past this sort of error has been avoidable by installing ALDEx2's R dependencies through conda, rather than through R directly. Could you try running

conda install bioconductor-aldex2 -c defaults -c bioconda -c conda-forge

and see if this fixes things?

Sorry for all the trouble and thanks!

(I'm copying @dgiguer here in case he has any ALDEx2 wisdom :slight_smile: )

It worked!
Thanks a lot :slight_smile: