コード例 #1
0
 def setUp(self):
     ht = Hint()
     cxcr4 = ht.query('CXCR4')['Gene'][0]
     fc = FindConnection(input_obj=cxcr4,
                         output_obj='ChemicalSubstance',
                         intermediate_nodes=None)
     fc.connect(verbose=True)
     self.response = fc.to_reasoner_std()
コード例 #2
0
 def setUpClass(cls):
     ht = Hint()
     cxcr4 = ht.query("CXCR4")["Gene"][0]
     fc = FindConnection(input_obj=cxcr4,
                         output_obj="ChemicalSubstance",
                         intermediate_nodes=None)
     fc.connect(verbose=True)
     cls.response = fc.to_reasoner_std()
コード例 #3
0
                    output_obj=tbi,
                    intermediate_nodes="BiologicalEntity")
# BTE finding connection
fc.connect(verbose=True)

print()
print("Displaying and filter results")
# Displaying and filter results
df = fc.display_table_view()
# because UMLS is not currently well-integrated in our ID-to-object translation system, removing UMLS-only entries here
patternDel = "^UMLS:C\d+"
filter = df.node1_id.str.contains(patternDel)
df = df[~filter]

fc.to_graphml("TBI.graphml")
fc.to_reasoner_std()

print(df.shape)
df.sample(10)

# Which diseases are mentioned the most
mentioned = df.node1_name.value_counts().head(10)
print(mentioned)

print()
print(
    "fetch all articles connecting 'unipolar depression' and 'OBESITY DISORDER'"
)
# fetch all articles connecting 'unipolar depression' and 'OBESITY DISORDER'
articles = []
for info in fc.display_edge_info('unipolar depression',
コード例 #4
0
if os.path.exists(query_path):
    with open(query_path, 'rb') as f_:
        reasoner_std = pickle.load(f_)
else:
    ht = Hint()

    breast_cancer = ht.query('breast cancer')['Disease'][0]
    tamoxifin = ht.query('tamoxifen')['ChemicalSubstance'][0]

    fc = FindConnection(input_obj=breast_cancer,
                        output_obj=tamoxifin,
                        intermediate_nodes='Gene')
    fc.connect(verbose=True)

    reasoner_std = fc.to_reasoner_std()

    #-- Add target node and edge to Query Graph
    reasoner_std['query_graph']['nodes'].append({
        'id': 't1',
        'type': 'PhenotypicFeature',
        'curie': 'CHPDART:SURVIVAL',
        'operator': '>=',
        'value': '365'
    })
    reasoner_std['probability_targets'] = [('Survival', '>=', '365')]
    reasoner_std['reasoner_id'] = 'explorer'
    for i, node in enumerate(reasoner_std['query_graph']['nodes']):
        if node['id'][0] != 't':
            reasoner_std['query_graph']['edges'].append({
                'id': 'et{}'.format(i),