def test_from_source_entity_filter(): # Kinases finder = msa.FromSource(Agent('MEK', db_refs={'FPLX': 'MEK'}), ent_type='kinase', persist=False) oa = finder.get_other_agents(block=True) oa_names = [a.name for a in oa] # RAF1 as a kinase is in the list assert 'MAPK1' in oa_names # RAS, which normally is in the list should not be since it's not a kinase assert 'apoptosis' not in oa_names assert 'RAS' not in oa_names # Transcription factors finder = msa.FromSource(Agent('MEK', db_refs={'FPLX': 'MEK'}), ent_type='transcription factor', persist=False) oa = finder.get_other_agents(block=True) oa_names = [a.name for a in oa] assert 'ESR1' in oa_names assert 'RAF1' not in oa_names # Proteins finder = msa.FromSource(Agent('MEK', db_refs={'FPLX': 'MEK'}), ent_type='protein', persist=False) oa = finder.get_other_agents(block=True) oa_names = [a.name for a in oa] assert 'ERK' in oa_names assert 'MAPK1' in oa_names assert 'apoptosis' not in oa_names assert 'proliferation' not in oa_names
def test_from_source_agent_filter(): cdk12 = Agent('CDK12', db_refs={'HGNC': '24224'}) samhd1 = Agent('SAMHD1', db_refs={'HGNC': '15925'}) ezh2 = Agent('EZH2', db_refs={'HGNC': '3527'}) finder = msa.FromSource(cdk12, filter_agents=[samhd1, ezh2]) stmts = finder.get_statements() assert len(stmts) exp_ags = {'SAMHD1', 'EZH2'} for stmt in stmts: ag_names = {ag.name for ag in stmt.agent_list() if ag is not None} assert ag_names & exp_ags, ag_names - exp_ags summ = finder.summarize() assert 'EZH2' in {a.name for a in summ['other_agents']}, summ desc = finder.describe() assert re.match(r'Overall, I found that CDK12 can affect ' r'EZH2. Here are the statements.*', desc), desc