Beispiel #1
0
def create_test_model(model_name="salmonella"):
    """Returns a cobra model for testing

    model_name: str
        One of 'ecoli', 'textbook', or 'salmonella', or the
        path to a pickled cobra.Model

    """

    if model_name == "ecoli":
        return read_sbml_model(ecoli_sbml)
    elif model_name == "textbook":
        return read_sbml_model(textbook_sbml)
    elif model_name == "mini":
        return read_sbml_model(mini_sbml)

    if model_name == "salmonella":
        model_name = salmonella_pickle
    with open(model_name, "rb") as infile:
        return _load(infile)
Beispiel #2
0
def create_test_model(model_name="salmonella"):
    """Returns a cobra model for testing

    model_name: str
        One of 'ecoli', 'textbook', or 'salmonella', or the
        path to a pickled cobra.Model

    """

    if model_name == "ecoli":
        return read_sbml_model(ecoli_sbml)
    elif model_name == "textbook":
        return read_sbml_model(textbook_sbml)
    elif model_name == "mini":
        return read_sbml_model(mini_sbml)

    if model_name == "salmonella":
        model_name = salmonella_pickle
    with open(model_name, "rb") as infile:
        return _load(infile)
Beispiel #3
0
def create_test_model(model_name="salmonella"):
    """Returns a cobra model for testing

    model_name: str
        One of 'ecoli', 'textbook', or 'salmonella', or the
        path to a pickled cobra.Model

    """
    if model_name == "ecoli":
        ecoli_sbml = join(data_dir, "iJO1366.xml")
        return read_sbml_model(ecoli_sbml)
    elif model_name == "textbook":
        textbook_sbml = join(data_dir, "textbook.xml.gz")
        return read_sbml_model(textbook_sbml)
    elif model_name == "mini":
        mini_sbml = join(data_dir, "mini_fbc2.xml")
        return read_sbml_model(mini_sbml)
    elif model_name == "salmonella":
        salmonella_pickle = join(data_dir, "salmonella.pickle")
        model_name = salmonella_pickle
    with open(model_name, "rb") as infile:
        return _load(infile)
Beispiel #4
0
def load(f, **kwargs):
    return _load(f)
Beispiel #5
0
def solved_model(data_directory):
    model = create_test_model("textbook")
    with open(join(data_directory, "textbook_solution.pickle"),
              "rb") as infile:
        solution = _load(infile)
    return solution, model
Beispiel #6
0
def load(f, **kwargs):
  return _load(f)
Beispiel #7
0
def solved_model(data_directory):
    model = create_test_model("textbook")
    with open(join(data_directory, "textbook_solution.pickle"),
              "rb") as infile:
        model.solution = _load(infile)
    return model
Beispiel #8
0
def load(f, **kwargs): return _load(f)
def loads(s, **kwargs): return _loads(s)