@transformation<EOL>def collapse_to_protein_interactions(graph: BELGraph) -> BELGraph:
rv: BELGraph = graph.copy()<EOL>collapse_to_genes(rv)<EOL>def is_edge_ppi(_: BELGraph, u: BaseEntity, v: BaseEntity, __: str) -> bool:<EOL><INDENT>"""<STR_LIT>"""<EOL>return isinstance(u, Gene) and isinstance(v, Gene)<EOL><DEDENT>return get_subgraph_by_edge_filter(rv, edge_predicates=[has_polarity, is_edge_ppi])<EOL>
Collapse to a graph made of only causal gene/protein edges.