Ejemplo n.º 1
0

def assemble_cx(stmts, save_file):
    cxa = CxAssembler(stmts)
    cxa.make_model(add_indra_json=False)
    cxa.save_model(save_file)
    return cxa


if __name__ == '__main__':
    # Load NDEx credentials
    with open('ndex_cred.json', 'rt') as f:
        ndex_cred = json.load(f)
    # Get the network
    ncp = ndex_cx.process_ndex_network('df1fea48-8cfb-11e7-a10d-0ac135e8bacf',
                                       username=ndex_cred['user'],
                                       password=ndex_cred['password'])
    gene_names = [
        hgnc_client.get_hgnc_name(ag.db_refs['HGNC'])
        for ag in ncp.get_agents()
    ]
    """
    # Get PMIDs for reading
    entrez_pmids = get_pmids(gene_names)
    network_pmids = ncp.get_pmids()
    pmids = list(set(entrez_pmids + network_pmids))
    save_pmids_for_reading(pmids, 'dna_damage_pmids.txt')
    """

    # Build the model
    prior_stmts = build_prior(gene_names, 'prior_stmts.pkl')
Ejemplo n.º 2
0
text_refs = {
    'DOI': '10.1038/s41586-020-2286-9',
    'PMID': '32353859',
    'PMCID': 'PMC7431030'
}


def reground_stmts(stmts):
    for stmt in stmts:
        for agent in stmt.agent_list():
            if agent is not None and agent.name in mappings:
                refs = mappings[agent.name]
                agent.db_refs = refs
                agent.db_refs['TEXT'] = agent.name
        for ev in stmt.evidence:
            ev.pmid = text_refs['PMID']
            # Just to make a copy here
            ev.text_refs = {k: v for k, v in text_refs.items()}
    return stmts


if __name__ == '__main__':
    cxp = ndex_cx.process_ndex_network('43803262-6d69-11ea-bfdc-0ac135e8bacf',
                                       require_grounding=False)
    stmts = reground_stmts(cxp.statements)
    stmts_file = join(dirname(abspath(__file__)), '..', 'stmts',
                      'gordon_ndex_stmts.pkl')
    with open(stmts_file, 'wb') as fh:
        pickle.dump(stmts, fh)
Ejemplo n.º 3
0
def assemble_cx(stmts, save_file):
    cxa = CxAssembler(stmts)
    cxa.make_model(add_indra_json=False)
    cxa.save_model(save_file)
    return cxa


if __name__ == '__main__':
    # Load NDEx credentials
    with open('ndex_cred.json', 'rt') as f:
        ndex_cred = json.load(f)

    # Get the network
    ncp = ndex_cx.process_ndex_network('55cfccd4-966e-11e7-a10d-0ac135e8bacf',
                                       username=ndex_cred['user'],
                                       password=ndex_cred['password'],
                                       require_grounding=False)
    # Add grounding entries for ungrounded nodes/noncanonical gene names
    gnd_map_ext = {
        'PALB2_wt_eto': {
            'HGNC': 'PALB2'
        },
        'PALB2_wt': {
            'HGNC': 'PALB2'
        },
        'CSDA': {
            'HGNC': 'YBX3'
        },
        'COBRA1': {
            'HGNC': 'NELFB'
        },
Ejemplo n.º 4
0
def test_get_cx_from_ndex_unauth():
    # This network should error because unauthorized without username/pwd
    ncp = process_ndex_network('df1fea48-8cfb-11e7-a10d-0ac135e8bacf')
Ejemplo n.º 5
0
def test_get_cx_from_ndex():
    # Ras Machine network
    ncp = process_ndex_network('fc56fe8d-1b60-11e8-b939-0ac135e8bacf')
Ejemplo n.º 6
0
def test_get_cx_from_ndex():
    # Ras Machine network
    ncp = process_ndex_network('50e3dff7-133e-11e6-a039-06603eb7f303')