<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collapse_to_genes(graph):
 """Collapse all protein, RNA, and miRNA nodes to their corresponding gene nodes. :param pybel.BELGraph graph: A BEL graph """

    enrich_protein_and_rna_origins(graph)
    collapse_dict = _build_collapse_to_gene_dict(graph)
    collapse_nodes(graph, collapse_dict)