mortonjt / q2-ancombc

qiime2 plugin for ANCOMBC
7 stars 5 forks source link

Can't run multivariate testing #6

Closed jwdebelius closed 3 years ago

jwdebelius commented 3 years ago

Using the tutorial, data I tried to run a multivariate command:

qiime ancombc ancombc  \
 --i-table table.qza  \
 --i-taxonomy taxonomy.qza \
 --m-metadata-file metadata.txt  \
 --p-formula "labels+microbe_total" \
 --p-global-test \
 --o-differentials differentials.qza \
 --verbose

I get the following error:

In .local(object) : Coercing from data.frame class to character matrix 
prior to building taxonomyTable. 
This could introduce artifacts. 
Check your taxonomyTable, or coerce to matrix manually.
Error in `[.data.frame`(meta_data, , group) : undefined columns selected
Calls: ancombc -> data_prep -> unique -> [ -> [.data.frame
Execution halted
Traceback (most recent call last):
  File "/Users/jusdeb/Repositories/q2-ancombc/q2_ancombc/_method.py", line 92, in ancombc
    global_test = run_commands([cmd])
  File "/Users/jusdeb/Repositories/q2-ancombc/q2_ancombc/_method.py", line 20, in run_commands
    proc = subprocess.run(cmd, check=True)
  File "/Users/jusdeb/miniconda3/envs/qiime2-dev-2021.5/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['run_ancombc.R', './input.biom.tsv', './taxonomy.tsv', './input.map.txt', 'labels+microbe_total', 'holm', '0.9', '1000', 'labels+microbe_total', 'TRUE', 'TRUE', '1e-05', '100', 'TRUE', '0.05', 'FALSE', './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/jusdeb/miniconda3/envs/qiime2-dev-2021.5/lib/python3.6/site-packages/q2cli/commands.py", line 329, in __call__
    results = action(**arguments)
  File "<decorator-gen-546>", line 2, in ancombc
  File "/Users/jusdeb/miniconda3/envs/qiime2-dev-2021.5/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    output_types, provenance)
  File "/Users/jusdeb/miniconda3/envs/qiime2-dev-2021.5/lib/python3.6/site-packages/qiime2/sdk/action.py", line 390, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/Users/jusdeb/Repositories/q2-ancombc/q2_ancombc/_method.py", line 98, in ancombc
    " and stderr to learn more." % e.returncode)
Exception: An error was encountered while running ANCOMBC in R (return code 1), please inspect stdout and stderr to learn more.

Plugin error from ancombc:

  An error was encountered while running ANCOMBC in R (return code 1), please inspect stdout and stderr to learn more.

See above for debug info.
mortonjt commented 3 years ago

Hmm, not sure what is going on here, I will need to look into the error more carefully. CC @FrederickHuangLin

jwdebelius commented 3 years ago

I think there's an issue with the metadata there - that there is only one label which is what screws things up. But, playing with the data in R, I think there are other ways the data may need to be output.

I think the bigger issue right now is that the QIIME 2 code doesn't support multiple variables because fo the res -> dataframe conversion. I don't know if then you'd want to seperate the output variables into different sheets/tables, or just concatenate all the list variables

mortonjt commented 3 years ago

I think we can concat all the list variables into a global stats object type. Is that what you are suggesting?

On Thu, Apr 22, 2021 at 7:55 AM Justine Debelius @.***> wrote:

I think there's an issue with the metadata there - that there is only one label which is what screws things up. But, playing with the data in R, I think there are other ways the data may need to be output.

I think the bigger issue right now is that the QIIME 2 code doesn't support multiple variables because fo the res -> dataframe conversion. I don't know if then you'd want to seperate the output variables into different sheets/tables, or just concatenate all the list variables

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mortonjt/q2-ancombc/issues/6#issuecomment-824914092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA75VXP2BXZTYSHG3NVYO4DTKA2E3ANCNFSM43EYHIHA .

jwdebelius commented 3 years ago

I see two options. One is to create seperate files for each result variable (essentiaally waht we have now) and create a shiny new type. Which then needs a shiny new convereter/parser/visualized.

The other is to coerce labels onto the R list outputs, cbind the crap out of everything, and then save the tabular output and call it a day.

It may mean needing a seperate visualization if people want to pull/visualize one covariate like a volcano visualization where you can optionally pass a metadata column

jwdebelius commented 3 years ago

I erm have a PR that I think addresses this. It also drops the requirement for taxonomy since you dont actually need taxonomy to run this, and it might be a PITA for people who want to run it on genus level data for something 🤷‍♀️. I think #7 hits a lot of the issues

mortonjt commented 3 years ago

I'm closing this since #7 appears to resolve this issue. Feel free to reopen if it doesn't