def get_gene_associations(model):
    """Create gene association for class :class:`.GeneDeletionStrategy`.

    Return a dict mapping reaction IDs to
    :class:`psamm.expression.boolean.Expression` objects,
    representing relationships between reactions and related genes. This helper
    function should be called when creating :class:`.GeneDeletionStrategy`
    objects.

    Args:
        model: :class:`psamm.datasource.native.NativeModel`.
    """

    for reaction in model.reactions:
        assoc = None
        if reaction.genes is None:
            continue
        elif isinstance(reaction.genes, string_types):
            assoc = boolean.Expression(reaction.genes)
        else:
            variables = [boolean.Variable(g) for g in reaction.genes]
            assoc = boolean.Expression(boolean.And(*variables))
        yield reaction.id, assoc
def get_gene_associations ( model ) : for reaction in model . reactions : assoc = None if reaction . genes is None : continue elif isinstance ( reaction . genes , string_types ) : assoc = boolean . Expression ( reaction . genes ) else : variables = [ boolean . Variable ( g ) for g in reaction . genes ] assoc = boolean . Expression ( boolean . And ( * variables ) ) yield reaction . id , assoc
Create gene association for class :class:`.GeneDeletionStrategy`.

    Return a dict mapping reaction IDs to
    :class:`psamm.expression.boolean.Expression` objects,
    representing relationships between reactions and related genes. This helper
    function should be called when creating :class:`.GeneDeletionStrategy`
    objects.

    Args:
        model: :class:`psamm.datasource.native.NativeModel`.