micom-dev / q2-micom

A Qiime plugin for MICOM.
https://micom-dev.github.io/q2-micom
Apache License 2.0
10 stars 4 forks source link

tuple error #14

Closed Hansol-cloud closed 3 years ago

Hansol-cloud commented 3 years ago

Hi, Christian!

I have a trouble with using micom as a qiime2(2021.2) plugin following the community tutorial. When I tried to build growth, It's not working. I attached the Error content.

Traceback (most recent call last): File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2cli/commands.py", line 329, in call results = action(**arguments) File "", line 2, in grow File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable output_types, provenance) File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 418, in _callableexecutor spec.qiime_type, output_view, spec.view_type, prov) File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/result.py", line 267, in _from_view result = transformation(view, validate_level) File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/core/transform.py", line 70, in transformation new_view = transformer(view) File "/home/sybirg/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_micom/_transform.py", line 104, in _15 gr["growth_rates"].to_csv(rd.growth_rates.path_maker(), index=False) TypeError: tuple indices must be integers or slices, not str

Plugin error from micom:

tuple indices must be integers or slices, not str

See above for debug info.

real 149m16.154s user 1804m30.939s sys 7m38.206s

I tried reinstallation qiime2, gurobi, and micom a few times, but It's still not working. How can I solve this problem? I look forward to hearing from you. Thanks! :)

cdiener commented 3 years ago

Hmm, that's odd. Might be related to gurobi being broken for micom. If you have access to cplex I would try that. It will also be much faster.

Can you post the output hot the following two commands:

qiime info
python -c "import micom; micom.show_versions()"

Thanks!

Hansol-cloud commented 3 years ago

Here's the output!

qiime info

System versions Python version: 3.6.13 QIIME 2 release: 2021.2 QIIME 2 version: 2021.2.0 q2cli version: 2021.2.0

Installed plugins alignment: 2021.2.0 composition: 2021.2.0 cutadapt: 2021.2.0 dada2: 2021.2.0 deblur: 2021.2.0 demux: 2021.2.0 diversity: 2021.2.0 diversity-lib: 2021.2.0 emperor: 2021.2.0 feature-classifier: 2021.2.0 feature-table: 2021.2.0 fragment-insertion: 2021.2.0 gneiss: 2021.2.0 longitudinal: 2021.2.0 metadata: 2021.2.0 micom: 0.11.1 phylogeny: 2021.2.0 quality-control: 2021.2.0 quality-filter: 2021.2.0 sample-classifier: 2021.2.0 taxa: 2021.2.0 types: 2021.2.0 vsearch: 2021.2.0

python -c "import micom; micom.show_versions()"

System Information

OS Linux OS-release 5.8.0-48-generic Python 3.6.13

Package Versions

cobra 0.21.0 jinja2 2.11.3 micom 0.22.5 pip 21.0.1 scikit-learn 0.23.1 scipy 1.5.3 setuptools 49.6.0.post20210108 symengine 0.7.2 wheel 0.36.2

Hansol-cloud commented 3 years ago

I tried again after installing cplex(12.10.0.0-academic license), rebuilding the model, but there was a same problem.

Also I followed the python test code you written (https://github.com/micom-dev/q2-micom/issues/1#issuecomment-610576146), and the result was : $ python Python 3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:01) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import micom tax = micom.data.test_taxonomy() com = micom.Community(tax) Building ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 sol = com.cooperative_tradeoff(fraction=1.0) print(sol.members) abundance growth_rate reactions metabolites compartments
Escherichia_coli_1 0.25 0.873922 95 72 Escherichia_coli_2 0.25 0.873922 95 72 Escherichia_coli_3 0.25 0.873922 95 72 Escherichia_coli_4 0.25 0.873922 95 72 medium NaN NaN 20 20

I don't know what's the matter.... Please tell me any files or output you need!

cdiener commented 3 years ago

Did you rebuild the models with qiime micom build ... after installing cplex? Otherwise it will use Gurobi again. I'll try to reproduce the error on my side and get back to you...

Hansol-cloud commented 3 years ago

Yes, I did. And the result came out faster than using gurobi. I also will keep trying in various ways. Thank you for your attention to this matter!

cdiener commented 3 years ago

What is the full output of the qiime micom grow command when using the --verbose flag and cplex? There should already be quite a few errors popping up there.

cdiener commented 3 years ago

Never mind, I could reproduce it. Will investigate what is going on.

cdiener commented 3 years ago

One of the transformers was broken. Deploying a fix right now.

cdiener commented 3 years ago

Thank you for the report. The behavior is now fixed in version 0.11.2. You can update to that version by activating your environment and using pip install "q2-micom>=0.11.2". There is no need to run qiime micom build again, you can skip right to running qiime micom grow after the update. Let me know how that goes.

I added tests for the artifact writing as well so it should hopefully not creep up again.