Ejemplo n.º 1
0
def test_issue2():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    node = ob.add_node('omim_disease',
                       'OMIM:603933',
                       desc='sickle-cell anemia',
                       seed_node_bool=True)
    expand_omim_disease(ob, node)
Ejemplo n.º 2
0
def test_description_uniprot():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    node = ob.add_node('uniprot_protein', 'P68871', desc='HBB', seed_node_bool=True)
    print(ob.__str__())
    expand_uniprot_protein(ob, node)
    ob.neo4j_set_url()  # use default url
    ob.neo4j_set_auth()  # use default username/password
    ob.neo4j_push()
Ejemplo n.º 3
0
def test_microrna():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    ob.add_node('omim_disease', 'OMIM:613074', desc='deafness', seed_node_bool=True)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 4
0
def test_issue3():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    disease_node = ob.add_node('disont_disease',
                               'DOID:9352',
                               desc='foo',
                               seed_node_bool=True)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
Ejemplo n.º 5
0
 def test_disease_to_go():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'affects': True})
     bne = BioNetExpander(ob)
     node = bne.add_node_smart('disease', 'DOID:906', seed_node_bool=True, desc='peroxisomal disease')
     bne.expand_disease(node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 6
0
 def test_go_bp_microrna():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'targets': True})
     bne = BioNetExpander(ob)
     microrna_node = bne.add_node_smart('microRNA', 'NCBIGene:406991', seed_node_bool=True, desc='test microrna')
     bne.expand_microrna(microrna_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 7
0
 def test_go_term():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'targets': True})
     bne = BioNetExpander(ob)
     go_node = bne.add_node_smart('biological_process', 'GO:1904685', seed_node_bool=True, desc='test biological process')
     bne.expand_biological_process(go_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 8
0
 def test_metabolite_to_protein():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'physically_interacts_with': True})
     bne = BioNetExpander(ob)
     node = bne.add_node_smart('metabolite', 'KEGG:C00190', seed_node_bool=True, desc='UDP-D-xylose')
     bne.expand_metabolite(node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 9
0
 def test_go_bp_protein():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'targets': True})
     bne = BioNetExpander(ob)
     protein_node = bne.add_node_smart('protein', 'Q75MH2', seed_node_bool=True, desc='IL6')
     bne.expand_protein(protein_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 10
0
def test_issue6():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    ob.add_node('omim_disease',
                'OMIM:605027',
                desc='LYMPHOMA, NON-HODGKIN, FAMILIAL',
                seed_node_bool=True)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
Ejemplo n.º 11
0
def test_issue7():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    ob.add_node('omim_disease',
                'OMIM:605275',
                desc='NOONAN SYNDROME 2; NS2',
                seed_node_bool=True)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
    expand_all_nodes(ob)
Ejemplo n.º 12
0
 def test_anatomy_to_go():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'capable_of': True})
     bne = BioNetExpander(ob)
     node = bne.add_node_smart('anatomical_entity', 'UBERON:0000171', seed_node_bool=True, desc='respiration organ')
     bne.expand_disease(node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 13
0
 def test_mondo_liver():
     ob = Orangeboard(debug=False)
     ob.set_dict_reltype_dirs({'gene_associated_with_condition': True,
                               'has_phenotype': True})
     bne = BioNetExpander(ob)
     node = bne.add_node_smart('disease', 'MONDO:0005359', seed_node_bool=True, desc='drug-induced liver injury')
     bne.expand_disease(node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 14
0
def test_add_mim():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    node = ob.add_node('omim_disease', 'OMIM:603903', desc='sickle-cell anemia', seed_node_bool=True)
    expand_omim_disease(ob, node)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 15
0
def test_description_disont2():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    node = ob.add_node('disont_disease', 'DOID:9352', desc='foobar', seed_node_bool=True)
    expand_disont_disease(ob, node)
    ob.neo4j_set_url()  # use default url
    ob.neo4j_set_auth()  # use default username/password
    ob.neo4j_push()
Ejemplo n.º 16
0
def test_anatomy_1():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    mir96 = ob.add_node('ncbigene_microrna', 'NCBIGene:407053', desc='MIR96', seed_node_bool=True)

    expand_ncbigene_microrna(ob, mir96)
    ob.neo4j_set_url()  # use default url
    ob.neo4j_set_auth()  # use default username/password
    ob.neo4j_push()
Ejemplo n.º 17
0
def test_expand_pharos_drug():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    lovastatin = ob.add_node('pharos_drug', 'lovastatin', desc='lovastatin', seed_node_bool=True)

    expand_pharos_drug(ob, lovastatin)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 18
0
def test_anatomy_3():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    mkd = ob.add_node('phenont_phenotype', 'HP:0000003', desc='Multicystic kidney dysplasia', seed_node_bool=True)

    expand_phenont_phenotype(ob, mkd)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 19
0
def test_anatomy_2():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    hmox1 = ob.add_node('uniprot_protein', 'P09601', desc='HMOX1', seed_node_bool=True)

    expand_uniprot_protein(ob, hmox1)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 20
0
 def test_issue_228():
     ob = Orangeboard(debug=False)
     bne = BioNetExpander(ob)
     bne.add_node_smart('disease', 'MONDO:0005359', seed_node_bool=True, desc='drug-induced liver injury')
     bne.add_node_smart('protein', 'Q59F02', seed_node_bool=True, desc='PMM2')
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 21
0
 def test_issue_269():
     ob = Orangeboard(debug=False)
     bne = BioNetExpander(ob)
     chem_node = bne.add_node_smart('chemical_substance',
                                    'CHEMBL521', seed_node_bool=True,
                                    desc='Ibuprofen')
     bne.expand_chemical_substance(chem_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 22
0
 def test_issue_235():
     ob = Orangeboard(debug=False)
     bne = BioNetExpander(ob)
     omim_node = bne.add_node_smart('disease',
                                    'OMIM:105150', seed_node_bool=True,
                                    desc='CEREBRAL AMYLOID ANGIOPATHY, CST3-RELATED')
     bne.expand_genetic_condition(omim_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 23
0
 def test_issue_237():
     ob = Orangeboard(debug=False)
     bne = BioNetExpander(ob)
     chem_node = bne.add_node_smart('chemical_substance',
                                    'KWHRDNMACVLHCE-UHFFFAOYSA-N', seed_node_bool=True,
                                    desc='ciprofloxacin')
     bne.expand_chemical_substance(chem_node)
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 24
0
 def test_double_proteins():
     ob = Orangeboard(debug=False)
     bne = BioNetExpander(ob)
     bne.add_node_smart('protein', 'Q59F02', seed_node_bool=True, desc='PMM2')
     bne.add_node_smart('protein', 'H3BV55', seed_node_bool=True, desc='PMM2')
     bne.add_node_smart('protein', 'A0A0S2Z4J6', seed_node_bool=True, desc='PMM2')
     bne.add_node_smart('protein', 'H3BV34', seed_node_bool=True, desc='PMM2')
     ob.neo4j_set_url()
     ob.neo4j_set_auth()
     ob.neo4j_push()
Ejemplo n.º 25
0
def make_rels_file(filename='rels.csv', separator=','):
    assert ':' not in separator
    query_result = run_cypher('match (n)-[r]-(m) return n.UUID, m.UUID, r')
    rels_file = open(filename, 'w')
    for record in query_result:
        source_node_uuid = record[0]
        target_node_uuid = record[1]
        rel = record[2]
        rel_properties = rel.properties
        reltype = rel.type
        reltype_dir = BioNetExpander.MASTER_REL_IS_DIRECTED[reltype]
        sourcedb = rel_properties['sourcedb']
        rel_key = Orangeboard.make_rel_dict_key(source_node_uuid, target_node_uuid, reltype_dir)
        if rel_key not in rels_set:
            rels_set.add(rel_key)
            rels_file.write('rel' + separator + source_node_uuid + separator + target_node_uuid + separator + sourcedb + ':' + reltype + '\n')
    rels_file.close()
Ejemplo n.º 26
0
def test_issue9():
    ob = Orangeboard(master_rel_is_directed, debug=True)
    node1 = ob.add_node('uniprot_protein', 'P16887', desc='HBB')
    node2 = ob.add_node('uniprot_protein', 'P09601', desc='HMOX1')
    ob.add_rel('interacts_with', 'reactome', node1, node2)
    ob.neo4j_set_url()
    ob.neo4j_set_auth()
    ob.neo4j_push()
Ejemplo n.º 27
0
def bigtest():
    genetic_condition_mim_id = 'OMIM:603903'  # sickle-cell anemia
    target_disease_disont_id = 'DOID:12365'  # malaria
    ## cerebral malaria:  'DOID:014069'

    # genetic_condition_mim_id = 'OMIM:219700' # cystic fibrosis
    # target_disease_disont_id = 'DOID:1498' # cholera

    # genetic_condition_mim_id = 'OMIM:305900' # glucose-6-phosphate dehydrogenase (G6PD)
    # target_disease_disont_id = 'DOID:12365'   # malaria

    # genetic_condition_mim_id = 'OMIM:607786' # proprotein convertase, subtilisin/kexin-type, 9 (PCSK9)
    # target_disease_disont_id = 'DOID:13810'   # familial hypercholesterolemia

    # genetic_condition_mim_id = 'OMIM:184745' # kit ligard
    # target_disease_disont_id = 'DOID:2841' # asthma

    ob = Orangeboard(master_rel_is_directed, debug=True)

    ## add the initial target disease into the Orangeboard, as a 'disease ontology' node
    disease_node = ob.add_node('disont_disease',
                               target_disease_disont_id,
                               desc='malaria',
                               seed_node_bool=True)

    print('----------- first round of expansion ----------')
    expand_all_nodes(ob)

    print('----------- second round of expansion ----------')
    expand_all_nodes(ob)

    print('----------- third round of expansion ----------')
    expand_all_nodes(ob)

    print('total number of nodes: ' + str(ob.count_nodes()))
    print('total number of edges: ' + str(ob.count_rels()))

    ## add the initial genetic condition into the Orangeboard, as a 'MIM' node
    mim_node = ob.add_node('omim_disease',
                           genetic_condition_mim_id,
                           desc='sickle-cell anemia',
                           seed_node_bool=True)

    print('----------- first round of expansion ----------')
    expand_all_nodes(ob)

    print('----------- second round of expansion ----------')
    expand_all_nodes(ob)

    print('----------- third round of expansion ----------')
    expand_all_nodes(ob)

    print('total number of nodes: ' + str(ob.count_nodes()))
    print('total number of edges: ' + str(ob.count_rels()))

    # push the entire graph to neo4j
    ob.neo4j_set_url()  # use default url
    ob.neo4j_set_auth()  # use default username/password
    ob.neo4j_push()
Ejemplo n.º 28
0
from BioNetExpander import BioNetExpander
from QueryNCBIeUtils import QueryNCBIeUtils
from QuerySciGraph import QuerySciGraph
from QueryDisont import QueryDisont
from ParsePhenont import ParsePhenont
from QueryChEMBL import QueryChEMBL

import pandas
import timeit
import argparse

## configure requests package to use the "orangeboard.sqlite" cache
requests_cache.install_cache('orangeboard')

## create an Orangeboard object
ob = Orangeboard(debug=True)

## configure the Orangeboard for Neo4j connectivity
ob.neo4j_set_url()
ob.neo4j_set_auth()

master_rel_is_directed = {
    'disease_affects': True,
    'is_member_of': True,
    'is_parent_of': True,
    'gene_assoc_with': True,
    'phenotype_assoc_with': True,
    'interacts_with': False,
    'controls_expression_of': True,
    'is_expressed_in': True,
    'targets': True
Ejemplo n.º 29
0
import requests_cache
import sys
from Orangeboard import Orangeboard
from BioNetExpander import BioNetExpander
import pandas
import os
import re

#requests_cache.install_cache('orangeboard')
# specifiy the path of orangeboard database
pathlist = os.path.realpath(__file__).split(os.path.sep)
RTXindex = pathlist.index("RTX")
dbpath = os.path.sep.join([*pathlist[:(RTXindex + 1)], 'data', 'orangeboard'])
requests_cache.install_cache(dbpath)

ob = Orangeboard(debug=True)
ob.neo4j_set_url()
ob.neo4j_set_auth()

bne = BioNetExpander(ob)

q1_diseases_dict = {
    'DOID:11476': 'osteoporosis',
    'DOID:526': 'HIV infectious disease',
    'DOID:1498': 'cholera',
    'DOID:4325': 'Ebola hemmorhagic fever',
    'DOID:12365': 'malaria',
    'DOID:10573': 'Osteomalacia',
    'DOID:13810': 'hypercholesterolemia',
    'DOID:9352': 'type 2 diabetes mellitus',
    'DOID:2841': 'asthma',
Ejemplo n.º 30
0
        return list(map(__get_in_degree, path.nodes))

    def get_all_out_degrees_in_path(self, path):
        # `MATCH (s)-[r]->() WHERE s.UUID IN $uuid_lst RETURN count(r)` does not preserve the order of $uuid_lst
        # So here make a query for each node in the path
        def __get_out_degree(node):
            query = "MATCH (s)-[r]->() WHERE s.UUID = $uuid RETURN count(r) AS out_degree"
            stmt_resp = self.orangeboard.neo4j_run_cypher_query(
                query, parameters={'uuid': node.properties['UUID']})
            return stmt_resp.single()['out_degree']

        return list(map(__get_out_degree, path.nodes))


if __name__ == '__main__':
    ob = Orangeboard(debug=False)

    master_rel_is_directed = {
        'disease_affects': True,
        'is_member_of': True,
        'is_parent_of': True,
        'gene_assoc_with': True,
        'phenotype_assoc_with': True,
        'interacts_with': False,
        'controls_expression_of': True,
        'is_expressed_in': True,
        'targets': True
    }

    ob.set_dict_reltype_dirs(master_rel_is_directed)
    ob.neo4j_set_url()