You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I been trying to work on some metagenome analysis with cobrapy. And to analyze some of the features in the metabolic network Cobrapy is often recommended. I store all my models in a sbml file and therefore I must read them. The issue is that when I am reading them there is A LOT of outputs in the terminal that at the end reduce the speed of the overall code (per my knowledge).
So, what I would think is that the read_sbml_model could have a verbose option which enables to ignore outputs that are not Errors
Solution
One solution that I would think of is condition the logs to the terminal by defining, for example:
if verbose == 1:
LOGGER.warning # for example
to ignore logger warnings, that often doesn't affect the overall run if the user knows before hand the model.
Alternatives
I considered using os.devnull
with open(os.devnull, 'w') as devnull, open(log_file, 'a') as log_f:
with redirect_stdout(devnull), redirect_stderr(devnull):
But I think would be more elegant if the solution was in the COBRApy.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
On a side note, SBML parsing will not raise warnings until there are issues with the file. So, unless you need to use some legacy models that you know will be parsed correctly, seeing a lot of warnings will usually indicate potential issues down the line or will require manual fixes to the models.
Checklist
Problem
I been trying to work on some metagenome analysis with cobrapy. And to analyze some of the features in the metabolic network Cobrapy is often recommended. I store all my models in a sbml file and therefore I must read them. The issue is that when I am reading them there is A LOT of outputs in the terminal that at the end reduce the speed of the overall code (per my knowledge).
So, what I would think is that the read_sbml_model could have a verbose option which enables to ignore outputs that are not
Errors
Solution
One solution that I would think of is condition the logs to the terminal by defining, for example:
if verbose == 1:
LOGGER.warning # for example
to ignore logger warnings, that often doesn't affect the overall run if the user knows before hand the model.
Alternatives
I considered using os.devnull
with open(os.devnull, 'w') as devnull, open(log_file, 'a') as log_f:
with redirect_stdout(devnull), redirect_stderr(devnull):
But I think would be more elegant if the solution was in the COBRApy.
Anything else?
No response
The text was updated successfully, but these errors were encountered: