Ejemplo n.º 1
0
def convert_to_gillespy_model(path):
    if os.path.exists(path):
        try:
            gpy_model, errors = convert(path)
            return gpy_model, errors
        except:
            return None, []
    else:
        raise StochSSFileNotFoundError("Could not find the sbml file: " + path,
                                       None)
Ejemplo n.º 2
0
def import_SBML(filename, name=None, gillespy_model=None):
    """
    SBML to GillesPy model converter. NOTE: non-mass-action rates
    in terms of concentrations may not be converted for population
    simulation. Use caution when importing SBML.

    Attributes
    ----------
    filename : str
        Path to the SBML file for conversion.
    name : str
        Name of the resulting model.
    gillespy_model : gillespy.Model
        If desired, the SBML model may be added to an existing GillesPy model.
    """

    try:
        from gillespy2.sbml.SBMLimport import convert
    except ImportError:
        raise ImportError('SBML conversion not imported successfully')

    return convert(filename, model_name=name, gillespy_model=gillespy_model)