Hello! I have been trying to debug this error when using ANCOMBC for a couple of days but I have yet to find the solution despite going through the qiime2 forum for possible solutions.
Error: An error was encountered while running ANCOM-BC in R (return code 1), please inspect stdout and stderr to learn more.
I have tried uninstalling and reinstalling miniconda and qiime2 as well but it still does not work after that. I'm not sure what exactly the error is, would there be any other possible solutions? The full error output is attached below!
I am using qiime2-amplicon-2024.10, natively installed via Linux.
command ran:
qiime composition ancombc \
--i-table gut-table.qza \
--m-metadata-file metadata_wave3.tsv \
--p-formula 'CON_or_HA' \
--o-differentials ancombc-subject.qza \
--verbose
output:
/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_composition/_ancombc.py:77: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
term_alpha_value = (metadata.get_column(term)
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_ancombc.R --inp_abundances_path /tmp/tmp_8h0ve5u/input.biom.tsv --inp_metadata_path /tmp/tmp_8h0ve5u/input.map.txt --md_column_types {"PRM": "categorical", "week_collected": "categorical", "CON_or_HA": "categorical"} --formula CON_or_HA --p_adj_method holm --prv_cut 0.1 --lib_cut 0 --reference_levels ['CON_or_HA::CON'] --tol 1e-05 --max_iter 100 --conserve False --alpha 0.05 --output_loaf /tmp/qiime2/athenap/processes/152771-1741578053.66@athenap/tmp/q2-OutPath-kjslcj6h
── Attaching core tidyverse packages ──────────────────────────────────────────────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Attaching package: ‘jsonlite’
The following object is masked from ‘package:purrr’:
flatten
R version 4.3.3 (2024-02-29)
New names:
• `` -> `...1`
'ancombc' has been fully evolved to 'ancombc2'.
Explore the enhanced capabilities of our refined method!
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
Calls: ancombc ... model.matrix -> model.matrix.default -> contrasts<-
5: stop("contrasts can be applied only to factors with 2 or more levels")
4: `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]])
3: model.matrix.default(formula(paste0("~", formula)), data = meta_data)
2: model.matrix(formula(paste0("~", formula)), data = meta_data)
1: ancombc(data = data, formula = formula, p_adj_method = p_adj_method,
prv_cut = prv_cut, lib_cut = lib_cut, tol = tol, max_iter = max_iter,
conserve = conserve, alpha = alpha)
Traceback (most recent call last):
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_composition/_ancombc.py", line 255, in _ancombc
run_commands([cmd])
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_composition/_ancombc.py", line 32, in run_commands
subprocess.run(cmd, check=True)
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_ancombc.R', '--inp_abundances_path', '/tmp/tmp_8h0ve5u/input.biom.tsv', '--inp_metadata_path', '/tmp/tmp_8h0ve5u/input.map.txt', '--md_column_types', '{"PRM": "categorical", "week_collected": "categorical", "CON_or_HA": "categorical"}', '--formula', 'CON_or_HA', '--p_adj_method', 'holm', '--prv_cut', '0.1', '--lib_cut', '0', '--reference_levels', "['CON_or_HA::CON']", '--tol', '1e-05', '--max_iter', '100', '--conserve', 'False', '--alpha', '0.05', '--output_loaf', '/tmp/qiime2/athenap/processes/152771-1741578053.66@athenap/tmp/q2-OutPath-kjslcj6h']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 530, in __call__
results = self._execute_action(
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2cli/commands.py", line 602, in _execute_action
results = action(**arguments)
File "<decorator-gen-19>", line 2, in ancombc
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 299, in bound_callable
outputs = self._callable_executor_(
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/qiime2/sdk/action.py", line 570, in _callable_executor_
output_views = self._callable(**view_args)
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_composition/_ancombc.py", line 41, in ancombc
return _ancombc(
File "/home/athenap/miniconda3/envs/qiime2-amplicon-2024.10/lib/python3.10/site-packages/q2_composition/_ancombc.py", line 257, in _ancombc
raise Exception('An error was encountered while running ANCOM-BC'
Exception: An error was encountered while running ANCOM-BC in R (return code 1), please inspect stdout and stderr to learn more.
Plugin error from composition:
An error was encountered while running ANCOM-BC in R (return code 1), please inspect stdout and stderr to learn more.
See above for debug info.