def test_get_agent_hgnc(): mek = protein(name='MAP2K1', namespace='HGNC') agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert agent.name == 'MAP2K1' assert agent.db_refs.get('HGNC') == mek_hgnc_id assert agent.db_refs.get('UP') == mek_up_id # Now create an agent with an identifier mek = protein(name='Foo', namespace='HGNC', identifier='6840') agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert agent.name == 'MAP2K1' assert agent.db_refs.get('HGNC') == mek_hgnc_id assert agent.db_refs.get('UP') == mek_up_id
def test_get_agent_up(): mek = protein(namespace='UP', identifier='Q02750') agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert agent.name == 'MAP2K1' assert agent.db_refs.get('HGNC') == mek_hgnc_id assert agent.db_refs.get('UP') == mek_up_id
def test_get_agent_mgi(): node = protein(namespace='MGI', name='Nr1h3') agent = pb._get_agent(node, {}) assert isinstance(agent, Agent) assert agent.name == 'Nr1h3' assert len(agent.db_refs) == 1 assert agent.db_refs.get('MGI') == 'Nr1h3'
def test_get_agent_rgd(): node = protein(namespace='RGD', name='Tp53') agent = pb._get_agent(node, {}) assert isinstance(agent, Agent) assert agent.name == 'Tp53' assert len(agent.db_refs) == 1 assert agent.db_refs.get('RGD') == 'Tp53'
def test_get_agent_with_activity(): mek = protein(name='MAP2K1', namespace='HGNC') agent = pb._get_agent(mek, activity('act')) assert isinstance(agent, Agent) assert isinstance(agent.activity, ActivityCondition) assert agent.activity.activity_type == 'activity' assert agent.activity.is_active
def test_get_agent_complex_none_agent(): """If one of the agents in the complex can't be obtained (e.g., an unhandled namespace), then the complex itself should be None.""" # Prime agent is None mek = protein(name='MAP2K1', namespace='FOO') erk = protein(name='MAPK1', namespace='HGNC', variants=[pmod('Ph', position=185, code='Thr')]) cplx = complex_abundance([mek, erk]) agent = pb._get_agent(cplx) assert agent is None # Bound agent is None mek = protein(name='MAP2K1', namespace='HGNC') erk = protein(name='MAPK1', namespace='FOO', variants=[pmod('Ph', position=185, code='Thr')]) cplx = complex_abundance([mek, erk]) agent = pb._get_agent(cplx) assert agent is None
def test_get_agent_with_translocation(): node_data = protein(name='MAPK1', namespace='HGNC') # Some example edge data edge_data = translocation(from_loc=entity('GOCC', 'intracellular'), to_loc=entity('GOCC', 'extracellular space')) agent = pb._get_agent(node_data, edge_data) assert isinstance(agent, Agent) assert agent.name == 'MAPK1' assert agent.location == 'extracellular space'
def test_get_agent_egid(): node_data = {'function': 'Protein', 'name': '5008', 'namespace': 'EGID'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert agent.name == 'OSM' assert len(agent.db_refs) == 3 assert agent.db_refs['EGID'] == '5008' assert agent.db_refs['HGNC'] == '8506' assert agent.db_refs['UP'] == 'P13725'
def test_get_agent_fusion(): node_data = {'function': 'Protein', 'fusion': { 'partner_5p': {'namespace': 'HGNC', 'name': 'BCR'}, 'range_5p': {'missing': '?'}, 'range_3p': {'missing': '?'}, 'partner_3p': {'namespace': 'HGNC', 'name': 'ABL1'}}} agent = pb._get_agent(node_data) assert agent is None
def test_get_agent_named_complex_go(): # TODO: Handle named complexes and map to FamPlex where possible node_data = { 'cname': '0043509', 'function': 'Complex', 'name': '0043509', 'namespace': 'GOCCID'} agent = pb._get_agent(node_data) assert agent is None
def test_get_agent_with_muts(): mek = protein(name='MAP2K1', namespace='HGNC', variants=[hgvs('p.Val600Glu')]) agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert len(agent.mutations) == 1 mut = agent.mutations[0] assert mut.position == '600' assert mut.residue_from == 'V' assert mut.residue_to == 'E'
def test_get_agent_schem(): node_data = { 'cname': 'Promegestone', 'function': 'Abundance', 'name': 'Promegestone', 'namespace': 'SCHEM'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert agent.name == 'Promegestone' assert len(agent.db_refs) == 1 assert agent.db_refs['SCHEM'] == 'Promegestone'
def test_get_agent_mirna(): node_data = { 'cname': 'MIR218-1', 'function': 'miRNA', 'name': 'MIR218-1', 'namespace': 'HGNC'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert agent.name == 'MIR218-1' assert len(agent.db_refs) == 1 assert agent.db_refs['HGNC'] == '31595'
def test_get_agent_sdis(): node_data = { 'cname': 'metastasis', 'function': 'Pathology', 'name': 'metastasis', 'namespace': 'SDIS'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert agent.name == 'metastasis' assert len(agent.db_refs) == 1 assert agent.db_refs['SDIS'] == 'metastasis'
def test_get_agent_chebi(): node_data = { 'cname': 'nitric oxide', 'function': 'Abundance', 'name': 'nitric oxide', 'namespace': 'CHEBI'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert agent.name == 'nitric oxide' assert len(agent.db_refs) == 1 assert agent.db_refs['CHEBI'] == 'CHEBI:16480'
def test_get_agent_sfam(): node_data = { 'cname': 'PRKC Family', 'function': 'Protein', 'name': 'PRKC Family', 'namespace': 'SFAM'} agent = pb._get_agent(node_data) assert isinstance(agent, Agent) assert len(agent.db_refs) == 2 assert agent.db_refs['SFAM'] == 'PRKC Family' assert agent.db_refs['FPLX'] == 'PKC' assert agent.name == 'PKC'
def test_get_agent_with_mods(): mek = protein(name='MAP2K1', namespace='HGNC', variants=[pmod('Ph')]) agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert len(agent.mods) == 1 mod = agent.mods[0] assert mod.mod_type == 'phosphorylation' assert not mod.residue assert not mod.position mek = protein(name='MAP2K1', namespace='HGNC', variants=[pmod('Ph', code='Ser')]) agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert len(agent.mods) == 1 mod = agent.mods[0] assert mod.mod_type == 'phosphorylation' assert mod.residue == 'S' assert not mod.position mek = protein(name='MAP2K1', namespace='HGNC', variants=[pmod('Ph', position=218)]) agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert len(agent.mods) == 1 mod = agent.mods[0] assert mod.mod_type == 'phosphorylation' assert not mod.residue assert mod.position == '218' mek = protein(name='MAP2K1', namespace='HGNC', variants=[pmod('Ph', position=218, code='Ser')]) agent = pb._get_agent(mek, {}) assert isinstance(agent, Agent) assert len(agent.mods) == 1 mod = agent.mods[0] assert mod.mod_type == 'phosphorylation' assert mod.residue == 'S' assert mod.position == '218'
def test_get_agent_complex(): mek = protein(name='MAP2K1', namespace='HGNC') erk = protein(name='MAPK1', namespace='HGNC', variants=[pmod('Ph', position=185, code='Thr')]) cplx = complex_abundance([mek, erk]) agent = pb._get_agent(cplx) assert isinstance(agent, Agent) assert agent.name == 'MAP2K1' assert len(agent.bound_conditions) == 1 bc = agent.bound_conditions[0] assert isinstance(bc, BoundCondition) assert bc.is_bound is True bc_agent = bc.agent assert bc_agent.name == 'MAPK1' assert len(bc_agent.mods) == 1 assert bc_agent.mods[0].mod_type == 'phosphorylation' assert bc_agent.mods[0].residue == 'T' assert bc_agent.mods[0].position == '185'
def test_get_agent_up_no_id(): mek = protein(name='MAP2K1', namespace='UP') agent = pb._get_agent(mek, {}) assert agent is None
def test_get_agent_meshpp(): apoptosis = bioprocess(name='Apoptosis', namespace='MESHPP') agent = pb._get_agent(apoptosis) assert isinstance(agent, Agent) assert agent.name == 'Apoptosis' assert agent.db_refs == {}
def test_get_agent_meshd(): hyperoxia = bioprocess(name='Hyperoxia', namespace='MESHD') agent = pb._get_agent(hyperoxia) assert isinstance(agent, Agent) assert agent.name == 'Hyperoxia' assert agent.db_refs == {}