klamt-lab / autopacmen

Retrieves kcat data and adds protein allocation constraints to stoichiometric metabolic models according to the sMOMENT method
Apache License 2.0
12 stars 7 forks source link

modeling_create_smoment_model cannot handle 'NoneType' objects #1

Closed handancetin closed 2 years ago

handancetin commented 4 years ago

Hello,

This might be a bit early to report an issue, however I am really interested in the construction of an enzyme constrained model for yeast using autopacmen. Even though I am not very familiar with the python environment, I was able to follow your manual up to some point (thank you for the clear explanations!), unfortunately I've encountered several small errors that you might want to fix since you consider the autopacmen as an extension for cobrapy:

(skip bullets for the main question)

This was the point that I could not continue further because I got several errors in modeling_create_smoment_model. As you can see from the title, it throws an error for my model:

File "~/autopacmen/autopacmen/submodules/helper_general.py", line 243, in get_float_cell_value
    cell_value = cell_value.replace(",", ".")
AttributeError: 'NoneType' object has no attribute 'replace'

I have obtained this error using Python 3.7.5 on Linux (Ubuntu 18.04.4 LTS). I have tried to modify get_float_cell_value to bypass replace for NoneType objects, unfortunately my solutions failed in the downstream (mostly in the function add_prot_pool_reaction). As I mentioned before, I am not good at Python programming, so my solutions can be considered weak. There are several metabolites and enzymes in my model that no information available in the databases (retrival scripts showed NA's and warnings for them). I believe these should not cause a problem, therefore I am asking for a solution.

Sorry if I am not clear or went wrong. I hope these small problems I reported above help you to enhance autopacmen and you can provide a generalized solution for my problem soon.

Thank you in advance, Handan

Paulocracy commented 4 years ago

Hello Handan \o/

Thank you for reporting the helpful issue :D

Regarding the minor bullet point issues:

  1. The data_parse_ scripts should only throw an error if the given output file path contains a non-existing folder (please correct me if the scripts show a different behavior). I just didn't think of mentioning it as it is typical Python file operation behavior, and I just added the information to the manual.
  2. That's indeed a typo, I corrected it in the manual and the associated code documentation.
  3. That's indeed a mistake in the code, I added the corresponding argument.
  4. & 5. I just corrected these typos in the code, too.

All these changes can be found in today's new autopacmen release.

Regarding the major issue:

The error arises when at least one value in missing in one of the given model-associated XLSX files. In order to see where the error occurs, it would be helpful if you could report the full error stack trace, i.e. all other error lines before the one that you included in the issue.

Kind regards :-) P.S.B.

Paulocracy commented 2 years ago

Closing due to inactivity (of which I'm also guilty of :3) and since the remaining issue was probably related to an already fixed faulty generation of initial spreadsheets.