def _add_gene_associations(self, r_id, r_genes, gene_ids, r_tag):
genes = ET.SubElement(<EOL>r_tag, _tag('<STR_LIT>', FBC_V2))<EOL>if isinstance(r_genes, list):<EOL><INDENT>e = Expression(And(*(Variable(i) for i in r_genes)))<EOL><DEDENT>else:<EOL><INDENT>e = Expression(r_genes)<EOL><DEDENT>gene_stack = [(e.root, genes)]<EOL>while len(gene_stack) > <NUM_LIT:0>:<EOL><INDENT>current, parent = gene_stack.pop()<EOL>if isinstance(current, Or):<EOL><INDENT>gene_tag = ET.SubElement(parent, _tag('<STR_LIT>', FBC_V2))<EOL><DEDENT>elif isinstance(current, And):<EOL><INDENT>gene_tag = ET.SubElement(parent, _tag('<STR_LIT>', FBC_V2))<EOL><DEDENT>elif isinstance(current, Variable):<EOL><INDENT>gene_tag = ET.SubElement(parent, _tag(<EOL>'<STR_LIT>', FBC_V2))<EOL>if current.symbol not in gene_ids:<EOL><INDENT>id = '<STR_LIT>' + util.create_unique_id(<EOL>self._make_safe_id(current.symbol), gene_ids)<EOL>gene_ids[id] = current.symbol<EOL>gene_tag.set(_tag('<STR_LIT>', FBC_V2), id)<EOL><DEDENT><DEDENT>if isinstance(current, (Or, And)):<EOL><INDENT>for item in current:<EOL><INDENT>gene_stack.append((item, gene_tag))<EOL><DEDENT><DEDENT><DEDENT>
Adds all the different kinds of genes into a list.