Skip to content

Fixed error handling in MetabolicNetwork.from_sbml #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions dingo/MetabolicNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@

# Licensed under GNU LGPL.3, see LICENCE file

import numpy as np
import sys
from typing import Dict

import cobra
from dingo.loading_models import read_json_file, read_mat_file, read_sbml_file, parse_cobra_model
from dingo.pyoptinterface_based_impl import fba,fva,inner_ball,remove_redundant_facets
import numpy as np

from dingo.loading_models import (parse_cobra_model, read_json_file,
read_mat_file, read_sbml_file)
from dingo.pyoptinterface_based_impl import (fba, fva, inner_ball,
remove_redundant_facets)


class MetabolicNetwork:
def __init__(self, tuple_args):
Expand Down Expand Up @@ -75,7 +80,7 @@ def from_mat(cls, arg):

@classmethod
def from_sbml(cls, arg):
if (not isinstance(arg, str)) and ((arg[-3:] == "xml") or (arg[-4] == "sbml")):
if (not isinstance(arg, str)) or not ((arg[-3:] == "xml") or (arg[-4:] == "sbml")):
raise Exception(
"An unknown input format given to initialize a metabolic network object."
)
Expand Down