Skip to content

Instantly share code, notes, and snippets.

@zakandrewking
Created March 28, 2016 20:41
Show Gist options
  • Save zakandrewking/31cc254617d15160391f to your computer and use it in GitHub Desktop.
Save zakandrewking/31cc254617d15160391f to your computer and use it in GitHub Desktop.
# inputs
# model, old_gene, new_gene
for reaction in model.genes.get_by_id(old_gene).reactions:
reaction.gene_reaction_rule = re.sub(r'\b' + old_gene + r'\b', new_gene,
reaction.gene_reaction_rule)
remove_genes(model, [g for g in model.genes if len(g.reactions) == 0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment