def append_relations_graph(df: pd.DataFrame, graph: BELGraph): """Append FamPlex relations to the graph.""" graph.namespace_url.update(NAMESPACES) for index, (ns1, n1, rel, ns2, n2) in df.iterrows(): if ns1 == "UP": continue sub = protein(ns1, n1) if rel == 'isa': obj = protein(ns2, n2) graph.add_is_a(sub, obj) else: # partof obj = named_complex_abundance(ns2, n2) graph.add_has_member(obj, sub)
def test_component_list(self): s = 'complex(SCOMP:"C1 Complex") hasComponents list(p(HGNC:C1QB), p(HGNC:C1S))' result = self.parser.relation.parseString(s) expected_result_list = [[COMPLEX, 'SCOMP', 'C1 Complex'], 'hasComponents', [[PROTEIN, 'HGNC', 'C1QB'], [PROTEIN, 'HGNC', 'C1S']]] self.assertEqual(expected_result_list, result.asList()) sub = named_complex_abundance('SCOMP', 'C1 Complex') self.assert_has_node(sub) child_1 = hgnc('C1QB') self.assert_has_node(child_1) self.assert_has_edge(sub, child_1, **{RELATION: HAS_COMPONENT}) child_2 = hgnc('C1S') self.assert_has_node(child_2) self.assert_has_edge(sub, child_2, **{RELATION: HAS_COMPONENT})
def test_component_list(self): s = 'complex(FPLX:C1) hasComponents list(p(HGNC:C1QB), p(HGNC:C1S))' result = self.parser.relation.parseString(s) expected_result_list = [[COMPLEX, ['FPLX', 'C1']], 'hasComponents', [ [PROTEIN, ['HGNC', 'C1QB']], [PROTEIN, ['HGNC', 'C1S']], ]] self.assertEqual(expected_result_list, result.asList()) sub = named_complex_abundance('FPLX', 'C1') self.assert_has_node(sub) child_1 = hgnc(name='C1QB') self.assert_has_node(child_1) self.assert_has_edge(child_1, sub, **{RELATION: PART_OF}) child_2 = hgnc(name='C1S') self.assert_has_node(child_2) self.assert_has_edge(child_2, sub, **{RELATION: PART_OF})
example_graph.namespace_url['HGNC'] = '' example_graph.namespace_pattern['DBSNP'] = r'^rs\d+$' example_graph.annotation_url['Species'] = '' example_graph.annotation_pattern['Number'] = r'^\d+$' example_graph.annotation_list['Confidence'] = {'High', 'Low'} ptk2 = protein(namespace='HGNC', name='PTK2', variants=[pmod('Ph', 'Tyr', 925)]) mapk1 = protein(namespace='HGNC', name='MAPK1') mapk3 = protein(namespace='HGNC', name='MAPK3') grb2 = protein(namespace='HGNC', name='GRB2') sos1 = protein(namespace='HGNC', name='SOS1') ptk2_rgb2_sos1 = complex_abundance([mapk1, grb2, sos1]) ras_family = protein(namespace='SFAM', name='RAS Family') pi3k_complex = named_complex_abundance(namespace='SFAM', name='p85/p110 PI3Kinase Complex') kinase_activity = activity('kin') catalytic_activity = activity('cat') gtp_activity = activity('gtp') c1 = '10446041' e1 = "FAK also combines with, and may activate, phosphoinositide 3-OH kinase (PI 3-kinase), either directly or " \ "through the Src kinase (13). Finally, there is evidence that Src phosphorylates FAK at Tyr925, creating a" \ " binding site for the complex of the adapter Grb2 and Ras guanosine 5'-triphosphate exchange factor mSOS (10)." \ " These interactions link FAK to signaling pathways that modify the cytoskeleton and activate mitogen-activated" \ " protein kinase (MAPK) cascades (Fig. 3A)." e1 = str(hash(e1)) """
def test_named_complex_abundance(self): node = named_complex_abundance(namespace='SCOMP', name='Calcineurin Complex') self.assertEqual('complex(SCOMP:"Calcineurin Complex")', str(node))