def test_siteactor(self): """Generate sh2 pY bnd interactions.""" # General phosphorylation state. phos = State("phosphorylation", True) unphos = State("phosphorylation", False) # General SH2 regions. sh2 = Region(name="SH2") sh2n = Region(name="SH2", order=1) sh2c = Region(name="SH2", order=2) inters = [] enz_uniprot = 'P00519' sub_uniprot = 'P00533' rsd = 'Y1092' location = int(rsd[1:]) strt = location - 4 stop = location + 4 site_name = 'b%i' % location m = Modification(enzyme=Protoform(enz_uniprot), substrate=SiteActor(protoform=Protoform(sub_uniprot), site=Site(name=site_name, start=strt, end=stop)), target=Residue(aa="Y", loc=location, state=unphos), value=True) inters.append(m) corpus = KamiCorpus("test") corpus.add_interactions(inters, anatomize=True)
def test_multiple_bnd_templates(self): dummy_partner = SiteActor( protoform=Protoform("C"), region=Region(name="C_RegionActor"), site=Site(name="C_SiteActor")) enzyme = SiteActor( protoform=Protoform("A", bound_to=[dummy_partner]), region=Region(name="A_RegionActor", bound_to=[dummy_partner]), site=Site(name="A_SiteActor", bound_to=[dummy_partner])) substrate = SiteActor( protoform=Protoform("B", bound_to=[dummy_partner]), region=Region(name="B_RegionActor", bound_to=[dummy_partner]), site=Site(name="B_SiteActor", bound_to=[dummy_partner])) mod = Modification( enzyme, substrate, target=Residue("Y", 100, State("phosphorylation", False)), value=True) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = ModGenerator(identifier) n, _, _, _ = generator.generate(mod)
def test_regionactor(self): # Phosphorylated and unphosphrylated states. phos = State("phosphorylation", True) unphos = State("phosphorylation", False) inters = [] # Phosphorylation with RegionActor as substrate. m = Modification(enzyme=Protoform("P00519"), substrate=RegionActor( Protoform("P00533", regions=[ Region(name='PVPEyINQS', start=280, end=290), Region(name="L receptor", start=57, end=167, states=[phos]) ]), Region(start=1000, end=1500)), target=Residue(aa="Y", loc=1092, state=unphos), value=True) inters.append(m) corpus = KamiCorpus("test") corpus.add_interactions(inters, anatomize=True) print_graph(corpus.get_nugget("test_nugget_1"))
def test_complicated_site_actor(self): m = Modification(enzyme=SiteActor(protoform=Protoform( "P00519", sites=[Site(name="bob", start=120, end=150)], regions=[Region(name="alice", start=100, end=200)], residues=[Residue("Y", 122)]), site=Site(name="jack", start=550, end=600, residues=[Residue("T")]), region=Region( name="Pkinase", start=500, end=800, sites=[Site(name="billy")])), substrate=SiteActor(protoform=Protoform("P00533"), site=Site(name="target"), region=Region(name="bla")), target=Residue("Y", 100, State("phosphorylation", False)), value=True) corpus = KamiCorpus("test") corpus.add_interactions([m], anatomize=True) print_graph(corpus.get_nugget("test_nugget_1")) print(ag_to_edge_list(corpus))
def test_complex_mod_nugget(self): """Complex modification interaction example.""" enzyme_agent = Protoform("P04049") enzyme_region = Region(start=100, end=200, name="lala") enzyme = RegionActor(enzyme_agent, enzyme_region) state = State("phosphorylation", True) reg_residue = Residue("S", 550, state) substrate_region = Region(start=500, end=600, residues=[reg_residue]) substrate_residues = [ Residue("T", 100), Residue("S", 56, State("phosphorylation", True)) ] substrate_state = State("activity", True) next_level_bound = RegionActor(Protoform("P04637"), Region(start=224, end=234)) substrate_bound = Protoform("P12931", bound_to=[next_level_bound]) substrate = Protoform("P00533", regions=[substrate_region], residues=substrate_residues, states=[substrate_state], bound_to=[substrate_bound]) mod_target = Residue("S", "33", State("phosphorylation", False)) mod2 = Modification(enzyme, substrate, mod_target, True) self.corpus.add_interaction(mod2, add_agents=True, anatomize=False)
def test_mod_generator(self): """Test generation of a modification nugget graph.""" enzyme_gene = Protoform("A") enzyme_region_actor = RegionActor( protoform=enzyme_gene, region=Region("Pkinase")) enzyme_site_actor = SiteActor( protoform=enzyme_gene, region=Region("Pkinase"), site=Site("tail")) substrate_gene = Protoform("B") substrate_region_actor = RegionActor( protoform=substrate_gene, region=Region("SH2")) substrate_site_actor = SiteActor( protoform=substrate_gene, region=Region("SH2"), site=Site("finger")) residue_mod_target = Residue("Y", 100, State("activity", False)) state_mod_target = State("activity", False) mod1 = Modification( enzyme=enzyme_gene, substrate=substrate_gene, target=state_mod_target ) mod2 = Modification( enzyme=enzyme_region_actor, substrate=substrate_gene, target=state_mod_target ) mod3 = Modification( enzyme=enzyme_site_actor, substrate=substrate_gene, target=state_mod_target ) mod4 = Modification( enzyme=enzyme_site_actor, substrate=substrate_region_actor, target=state_mod_target ) mod5 = Modification( enzyme=enzyme_site_actor, substrate=substrate_site_actor, target=residue_mod_target ) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = ModGenerator(identifier) n, _, _, _ = generator.generate(mod5) print_graph(n.graph)
def test_region_generator(self): """Test generation of graph components for a Region object.""" kinase_region = Region( name="Pkinase", start=300, end=500, states=[State("activity", True)], residues=[Residue("Y", 1000)], ) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene try: self.generator.generate_region( nugget, kinase_region, self.default_ag_gene) raise ValueError("Invalid residue was not caught!") except KamiError: pass kinase_region = Region( name="Pkinase", start=300, end=500, states=[State("activity", True)], residues=[Residue("Y", 350, State("phosphorylation", True))], sites=[ # Site(name="bob", residues=[Residue("Y", 350)]), Site(name="alice", start=1000, end=2000) ] ) try: self.generator.generate_region( nugget, kinase_region, self.default_ag_gene) raise ValueError("Invalid site was not caught!") except KamiError: pass nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene kinase_region = Region( name="Pkinase", start=300, end=500, states=[State("activity", True)], residues=[Residue("Y", 350, State("phosphorylation", True))], sites=[ Site(name="alice", start=350, end=450) ] ) kinase_region_id = self.generator.generate_region( nugget, kinase_region, self.default_ag_gene) assert(len(nugget.nodes()) == 5)
def test_ligandmod_generation(self): """Test generation of a transmodification nugget graph.""" enzyme_gene = Protoform("A") enzyme_region_actor = RegionActor( protoform=enzyme_gene, region=Region("Pkinase")) substrate = Protoform("B") automod = LigandModification( enzyme_region_actor, substrate, Residue("Y", 100, State("phosphorylation", True)), value=True, enzyme_bnd_region=Region("EbndRegion"), substrate_bnd_region=Region("SbndRegion"), substrate_bnd_site=Site("SbndSite")) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = LigandModGenerator(identifier) n, _, _, _ = generator.generate(automod) print_graph(n.graph) inter = LigandModification( enzyme=RegionActor(protoform=Protoform(uniprotid="P30530", hgnc_symbol="AXL"), region=Region(name="Tyr_kinase", interproid="IPR020635", start=536, end=807)), substrate=SiteActor(protoform=Protoform(uniprotid="P06239", hgnc_symbol="LCK"), site=Site(name="pY394", start=391, end=397)), target=Residue(aa="Y", loc=394, state=State("phosphorylation", False)), value=True, rate=10, enzyme_bnd_region=Region(name="Tyr_kinase", interproid="IPR020635", start=536, end=807), substrate_bnd_site=Site(name='pY394', start=391, end=397) ) corpus = KamiCorpus("test") corpus.add_interaction(inter, anatomize=False) print_graph(corpus.get_nugget('test_nugget_1'))
def __init__(self): """Initialize with common hierarchy.""" self.hierarchy = KamiCorpus("test") protoform = Protoform("A") self.gene_id = self.hierarchy.add_protoform(protoform) named_region = Region("Kinase") interval_region = Region(start=100, end=200) named_ordered_region1 = Region("SH2", order=1) named_ordered_region2 = Region("SH2", order=2) self.named_region = self.hierarchy.add_region(named_region, self.gene_id) self.interval_region = self.hierarchy.add_region( interval_region, self.gene_id) self.named_ordered_region1 = self.hierarchy.add_region( named_ordered_region1, self.gene_id) self.named_ordered_region2 = self.hierarchy.add_region( named_ordered_region2, self.gene_id) named_site = Site("ATP binding") interval_site = Site(start=100, end=200) named_ordered_site1 = Site("pY", order=1) named_ordered_site2 = Site("pY", order=2) self.named_site = self.hierarchy.add_site(named_site, self.gene_id) self.interval_site = self.hierarchy.add_site(interval_site, self.gene_id) self.named_ordered_site1 = self.hierarchy.add_site( named_ordered_site1, self.gene_id) self.named_ordered_site2 = self.hierarchy.add_site( named_ordered_site2, self.gene_id) residue = Residue("Y", 150) residue_no_loc = Residue("T") self.residue = self.hierarchy.add_residue(residue, self.gene_id) self.residue_no_loc = self.hierarchy.add_residue( residue_no_loc, self.gene_id) residue_state = State("activity", True) site_state = State("activity", True) region_state = State("activity", True) gene_state = State("activity", True) self.residue_state = self.hierarchy.add_state(residue_state, self.residue) self.site_state = self.hierarchy.add_state(site_state, self.named_site) self.region_state = self.hierarchy.add_state(region_state, self.named_region) self.gene_state = self.hierarchy.add_state(gene_state, self.gene_id)
def test_automodification(self): automod = SelfModification(enzyme=self.enzyme_site_actor, target=self.residue_mod_target, value=True, substrate_region=Region("SH2")) print(automod) print(automod.__repr__())
def test_non_empty_hierarchy(self): """.""" model = KamiCorpus("test") plcg1_pY1253 = Protoform("P19174", synonyms=["PLCG1"], residues=[ Residue("Y", 1253, state=State( "phosphorylation", True)) ]) sh2 = Region(name="SH2") abl1 = Protoform("P00519", synonyms=["ABL1"]) abl1_sh2 = RegionActor(abl1, sh2) bnd = Binding(plcg1_pY1253, abl1_sh2) model.add_interactions([bnd], model) assert (model.empty() is False) model.export_json("test_non_empty_hierarchy.json") new_model = KamiCorpus.load_json("test", "test_non_empty_hierarchy.json") assert (isinstance(new_model, KamiCorpus)) assert (("test_action_graph", "meta_model") in new_model._hierarchy.edges())
def test_transmodification(self): mod = LigandModification(enzyme=self.enzyme_site_actor, substrate=self.substrate_region_actor, target=self.residue_mod_target, substrate_bnd_region=Region("SH2"), enzyme_bnd_site=Site("pY")) print(mod) print(mod.__repr__())
def test_advanced_site_actor(self): # General phosphorylation state. phos = State("phosphorylation", True) unphos = State("phosphorylation", False) # General SH2 regions. sh2 = Region(name="SH2") sh2n = Region(name="SH2", order=1) sh2c = Region(name="SH2", order=2) # Test site. s1 = Site(name="test_site") inters = [] # Modification using SiteActor. m = Modification(enzyme=Protoform("P00519", hgnc_symbol="ABL1"), substrate=SiteActor(protoform=Protoform( "P00519", hgnc_symbol="ABL1"), site=Site(name="site800", start=796, end=804)), target=Residue("Y", 800, State("phosphorylation", False)), value=True) inters.append(m) m = Modification(enzyme=Protoform("P00519", hgnc_symbol="ABL1"), substrate=SiteActor(protoform=Protoform( "P00533", hgnc_symbol="EGFR"), site=Site(name="site800", start=796, end=804)), target=Residue("Y", 800, State("phosphorylation", False)), value=True) inters.append(m) # Binding using SiteActor. b = Binding( SiteActor(protoform=Protoform("P00533", hgnc_symbol="EGFR"), site=Site(name="site800", start=796, end=804)), RegionActor(protoform=Protoform("P62993", hgnc_symbol="GRB2"), region=sh2)) inters.append(b) corpus = KamiCorpus("test") corpus.add_interactions(inters, anatomize=True)
def test_gene_generator(self): """Test generation of graph components for a Protoform object.""" nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene gene1 = Protoform("B") self.generator.generate_gene(nugget, gene1) self.generator.generate_gene( nugget, gene1) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene gene2 = Protoform( "P00519", synonyms=["ABL1"], states=[State("active", True), State("active", False)], residues=[ Residue("Y", 100, State("phosphorylation", True)), Residue("T", 100, State("phosphorylation", True)), Residue("S", 500), Residue("T") ], sites=[ Site("bob"), Site(start=100, end=300, name="super_site", residues=[Residue("T", 150)]) ], regions=[ Region(name="sh2"), Region( start=0, end=1000, name="big_region", states=[State("activity", True)]) ], bound_to=[gene1], ) gene_id, _ = self.generator.generate_gene(nugget, gene2) # check it is consistent assert(len(nugget.nodes()) == 17) assert(len(nugget.edges()) == 16) assert(gene_id in nugget.graph.nodes()) assert("P00519" in nugget.graph.get_node(gene_id)['uniprotid'])
def __init__(self): uniprotid = "P00533" simple_region = Region("SH2") regions = [simple_region] sites = [Site("pY")] residues = [ Residue("Y", 100), Residue("S", 155, State("phosphorylation", True)) ] states = [State("activity", True), State("phosphorylation", True)] bounds = [ SiteActor(protoform=Protoform("Q07890"), site=Site("binding_site")), Protoform("P00519") ] self.protoform = Protoform( uniprotid, regions=regions, residues=residues, sites=sites, states=states, bound_to=bounds, hgnc_symbol="EGFR", synonyms=["EGFR", "Epidermal growth factor receptor"]) self.enzyme_gene = Protoform("Q07890") self.enzyme_site_actor = SiteActor(protoform=self.enzyme_gene, region=Region("Pkinase"), site=Site("tail")) self.substrate_gene = Protoform("P00519") self.substrate_region_actor = RegionActor( protoform=self.substrate_gene, region=Region("SH2")) self.residue_mod_target = Residue("Y", 100, State("activity", False))
def test_region_actor_generator(self): """Test generation of graph components for a RegionActor object.""" region_actor = RegionActor( protoform=Protoform("B"), region=Region("SH2")) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene (gene_id, region_id, _) =\ self.generator.generate_region_actor(nugget, region_actor) assert((region_id, gene_id) in nugget.edges())
def test_selfmod_generation(self): """Test generation of an automodification nugget graph.""" enzyme_gene = Protoform("A") enzyme_region_actor = RegionActor( protoform=enzyme_gene, region=Region("Pkinase")) automod = SelfModification( enzyme_region_actor, Residue("Y", 100, State("phosphorylation", True)), value=True, substrate_region=Region("Region"), substrate_site=Site("Site")) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = SelfModGenerator(identifier) n, _, _, _ = generator.generate(automod) print_graph(n.graph)
def test_record_manual_rewrites(self): # Perform a bunch of manual updates self.corpus.add_mod() self.corpus.add_bnd() gene_node = self.corpus.add_protoform(Protoform("P00533")) region_node = self.corpus.add_region( Region("Protein kinase", start=100, end=200), gene_node) self.corpus.add_site(Site("Lala1"), gene_node) site_node = self.corpus.add_site(Site("Lala2"), region_node) residue_node = self.corpus.add_residue(Residue("S", 100), site_node) self.corpus.add_state(State("phosphorylation", True), residue_node)
def test_multiple_sh2(self): """.""" phos = State("phosphorylation", True) sh2n = Region(name="SH2", order=1) sh2c = Region(name="SH2", order=2) pik3r1 = Protoform("P27986", synonyms=["PIK3R1", "PI3K1"]) pik3r1_sh2n = RegionActor(pik3r1, sh2n) pik3r1_sh2c = RegionActor(pik3r1, sh2c) frs2_py196 = Protoform("Q8WU20", synonyms=["FRS2"], residues=[Residue("Y", 196, phos)]) frs2_py349 = Protoform("Q8WU20", synonyms=["FRS2"], residues=[Residue("Y", 349, phos)]) bnds = [] bnds.append(Binding(frs2_py196, pik3r1_sh2n)) bnds.append(Binding(frs2_py349, pik3r1_sh2c)) corpus = KamiCorpus("test") corpus.add_interactions(bnds, anatomize=True)
def test_bnd_generation(self): """Test generation of a binding nugget graph.""" left = SiteActor(Protoform("A"), Site("pY"), Region("Reg")) right = Protoform("B") bnd = Binding(left, right) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = BndGenerator(identifier) n, _, _, _ = generator.generate(bnd) print_graph(n.graph)
def test_site_residue_reconnect(self): sh2 = Region(name="SH2") b = Binding( SiteActor(protoform=Protoform(uniprotid="P00533", hgnc_symbol="EGFR", residues=[ Residue("Y", 1092, state=State( "phosphorylation", True)) ]), site=Site(name="motif1092", start=1088, end=1096)), RegionActor(protoform=Protoform("P62993", hgnc_symbol="GRB2"), region=sh2)) corpus = KamiCorpus("test") corpus.add_interaction(b)
def test_sites(self): # Create genes. egfr = Protoform("P00533") grb2 = Protoform("P62993") # Create a RegionActor and a SiteActor fo GRB2. grb2_sh2 = RegionActor(protoform=grb2, region=Region(name="SH2")) grb2_site = SiteActor(protoform=grb2, site=Site(name="pY")) inters = [] # This works (RegionActor). # inters.append(BinaryBinding([egfr], [grb2_sh2])) # This does not work (SiteActor) inters.append(Binding(egfr, grb2_site)) corpus = KamiCorpus("test") corpus.add_interactions(inters, anatomize=True) print_graph(corpus.get_nugget("test_nugget_1"))
def __init__(self): """Initialize test class with a model.""" self.model = KamiCorpus("test") egfr = Protoform("P00533") fgfr1 = Protoform("P11362") fgfr1_pysite = SiteActor( Protoform("P11362"), Site("pY", residues=[Residue("Y", 463, State("phosphorylation", True))])) abl1_sh2 = RegionActor(Protoform("P00519"), Region("SH2")) target = Residue("Y", 463, State("phosphorylation", False)) modification = Modification(enzyme=egfr, substrate=fgfr1, target=target) binding = Binding(abl1_sh2, fgfr1_pysite) self.model.add_interactions([modification, binding])
def test_anonymous_mod_generation(self): """Test generation of an anonymous modification nugget graph.""" protoform = Protoform("A") region_actor = RegionActor( protoform=protoform, region=Region("Pkinase")) mod = AnonymousModification( region_actor, Residue("Y", 100, State("phosphorylation", False)), value=True) corpus = KamiCorpus("test") identifier = EntityIdentifier( corpus.action_graph, corpus.get_action_graph_typing()) generator = AnonymousModGenerator(identifier) n, _, _, _ = generator.generate(mod) print_graph(n.graph)
def test_bookkeeping(self): interactions = [] i1 = LigandModification( RegionActor(Protoform("P00533"), Region(start=712, end=979)), Protoform("P00533"), Residue("Y", 1092, state=State("phosphorylation", False))) interactions.append(i1) i2 = Modification( Protoform("P00519"), Protoform("P00533"), Residue("S", 800, state=State("phosphorylation", False))) interactions.append(i2) i3 = Binding(Protoform("P00424"), SiteActor(Protoform("P00533"), Site(start=799, end=900))) interactions.append(i3) corpus = KamiCorpus("test") corpus.add_interactions(interactions)
def test_simple_mod_nugget(self): """Simple modification interaction example.""" enz_res = Residue("S", 100, State("phospho", True)) enz_reg = Region(start=150, end=170, states=[State("activity", True)]) enzyme_entity = Protoform("P00533", regions=[enz_reg], residues=[enz_res]) sub_bound_1 = Protoform("P28482", states=[State("activity", True)]) sub_bound_2 = Protoform("P28482", states=[State("activity", True)]) substrate_entity = Protoform("P04049", bound_to=[sub_bound_1, sub_bound_2]) mod_state = State("activity", False) value = True mod1 = Modification(enzyme_entity, substrate_entity, mod_state, value) # Create corresponding nugget in the corpus self.corpus.add_interaction(mod1, add_agents=True, anatomize=False)
def test_is_bnd_generator(self): """Test generation of graph components for a bound condition.""" protoform = Protoform("A") site_actor = SiteActor(protoform=Protoform("A"), site=Site("pY")) region_actor = RegionActor( protoform=Protoform("A"), region=Region("Pkinase")) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene site = Site( "lala", bound_to=[protoform, protoform] ) site_id, _ =\ self.generator.generate_site( nugget, site, self.default_ag_gene, self.default_ag_gene) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene site = Site( "lala", bound_to=[site_actor] ) site_id, _ =\ self.generator.generate_site( nugget, site, self.default_ag_gene, self.default_ag_gene) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene site = Site( "lala", bound_to=[region_actor] ) self.generator.generate_site( nugget, site, self.default_ag_gene, self.default_ag_gene)
def test_site_actor_generator(self): """Test generation of graph components for a SiteActor object.""" # no region site_actor = SiteActor( protoform=Protoform("B"), site=Site("pY")) nugget = KamiGraph() nugget.reference_typing[self.default_ag_gene] = self.default_ag_gene (gene_id, site_id, region_id, _) =\ self.generator.generate_site_actor(nugget, site_actor) assert((site_id, gene_id) in nugget.edges()) # with a region in the middle site_actor_with_region = SiteActor( protoform=Protoform("B"), site=Site("pY"), region=Region("kinase")) (gene_id, site_id, region_id, _) =\ self.generator.generate_site_actor(nugget, site_actor_with_region) assert((site_id, region_id) in nugget.edges()) assert((region_id, gene_id) in nugget.edges())
def test_identify_region(self): """Test region identification.""" identifier = EntityIdentifier(self.hierarchy.action_graph, self.hierarchy.get_action_graph_typing()) res = identifier.identify_region(Region("Protein kinase"), self.gene_id) assert (res == self.named_region) res = identifier.identify_region(Region(start=101, end=199), self.gene_id) assert (res == self.interval_region) res = identifier.identify_region(Region("SH2"), self.gene_id) assert (res is None) res = identifier.identify_region(Region("SH2", order=1), self.gene_id) assert (res == self.named_ordered_region1) res = identifier.identify_region(Region("SH2", order=5), self.gene_id) assert (res is None) res = identifier.identify_region( Region("SH2", start=101, end=185, order=2), self.gene_id) assert (res == self.interval_region)
def __init__(self): """Initialize tests.""" # Create an empty KAMI corpus self.nxcorpus = KamiCorpus("EGFR_signalling") try: h = Neo4jHierarchy(uri="bolt://localhost:7687", user="******", password="******") h._clear() self.neo4jcorpus = KamiCorpus("egfr", backend="neo4j", uri="bolt://localhost:7687", user="******", password="******") except: warnings.warn("Neo4j is down, skipping Neo4j-related tests") self.neo4jcorpus = None # Create an interaction object egfr = Protoform("P00533") egf = Protoform("P01133") kinase = Region(name="Protein kinase", start=712, end=979, states=[State("activity", True)]) egfr_kinase = RegionActor(protoform=egfr, region=kinase) interaction1 = LigandModification( enzyme=egfr_kinase, substrate=egfr, target=Residue("Y", 1092, state=State("phosphorylation", False)), value=True, rate=1, desc="Phosphorylation of EGFR homodimer") # Aggregate the interaction object to the corpus self.nxcorpus.add_interaction(interaction1) self.neo4jcorpus.add_interaction(interaction1) grb2 = Protoform("P62993", states=[State("activity", True)]) grb2_sh2 = RegionActor(protoform=grb2, region=Region(name="SH2")) shc1 = Protoform("P29353") shc1_pY = SiteActor( protoform=shc1, site=Site( name="pY", residues=[Residue("Y", 317, State("phosphorylation", True))])) interaction1 = Binding(grb2_sh2, shc1_pY) grb2_sh2_with_residues = RegionActor(protoform=grb2, region=Region( name="SH2", residues=[ Residue("S", 90, test=True), Residue("D", 90, test=False) ])) egfr_pY = SiteActor( protoform=egfr, site=Site( name="pY", residues=[Residue("Y", 1092, State("phosphorylation", True))])) interaction2 = Binding(grb2_sh2_with_residues, egfr_pY) axl_PK = RegionActor(protoform=Protoform("P30530", hgnc_symbol="AXL"), region=Region("Protein kinase", start=536, end=807)) interaction3 = SelfModification(axl_PK, target=Residue( "Y", 821, State("phosphorylation", False)), value=True) interaction4 = AnonymousModification(RegionActor(protoform=Protoform( "P30530", hgnc_symbol="AXL", residues=[ Residue("Y", 703, state=State("phosphorylation", True)), Residue("Y", 779, state=State("phosphorylation", True)) ]), region=Region( "Protein kinase", start=536, end=807)), target=State("activity", False), value=True) egf_egfr = Protoform(egfr.uniprotid, bound_to=[egf]) interaction5 = Binding(egf_egfr, egf_egfr) interaction6 = Unbinding(egf_egfr, egf_egfr) interaction7 = LigandModification( egfr_kinase, shc1, target=Residue("Y", 317, State("phosphorylation", False)), value=True, enzyme_bnd_region=Region("egfr_BND"), enzyme_bnd_site=Site("egfr_BND"), substrate_bnd_region=Region("shc1_BND"), substrate_bnd_site=Site("sch1_BND")) interactions = [ interaction1, interaction2, interaction3, interaction4, interaction5, interaction6, interaction7 ] self.nxcorpus.add_interactions(interactions) self.neo4jcorpus.add_interactions(interactions) # Create a protein definition for GRB2 # protoform = Protoform( # "P62993", # regions=[Region( # name="SH2", # residues=[ # Residue("S", 90, test=True), # Residue("D", 90, test=False)])]) # ashl = Product("Ash-L", residues=[Residue("S", 90)]) # s90d = Product("S90D", residues=[Residue("D", 90)]) # grb3 = Product("Grb3", removed_components={"regions": [Region("SH2")]}) # self.grb2_definition = Definition(protoform, [ashl, s90d, grb3]) # self.model = self.nxcorpus.instantiate( # "EGFR_signalling_GRB2", [self.grb2_definition], # default_bnd_rate=0.1, # default_brk_rate=0.1, # default_mod_rate=0.1) self.query1 = (""" MATCH (:protoform)<--(r1:REGION)-->(i:interaction)-*-(n4:protoform) RETURN p1, i, p2; """)