Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# entities
sentence_text = self.G.nodes[entity_node]['sentence_text']
# Make annotations object containing the fully connected subgraph
# containing these nodes
subgraph = self.connected_subgraph(entity_node)
edge_properties = {}
for edge in subgraph.edges():
edge_properties[edge] = subgraph.edges[edge]
annotations = {'node_properties': subgraph.node,
'edge_properties': edge_properties}
# Make evidence object
epistemics = dict()
evidence = Evidence(source_api='tees',
pmid=self.pmid,
text=sentence_text,
epistemics={'direct': is_direct},
annotations=annotations)
return evidence
continue
# Entries:
# 'acc': '', <-- substrate
# 'sequence': '',
# 'position': '',
# 'code': '',
# 'pmids': '',
# 'kinases': '', <-- enzyme
# 'source': 'HTP|LTP',
# 'species': '',
# 'entry_date': 'yyyy-mm-dd HH:MM:SS.mmmmmm'
substrate = Agent(None, db_refs={'UP': entry['acc']})
used_name, enz = self._get_enzyme(entry['kinases']) if\
entry.get('kinases') else '', None
evidence = Evidence(
source_api='phospho.ELM',
pmid=entry['pmids'],
annotations={
'data_source': 'High-ThroughPut' if
entry['source'].lower == 'htp' else (
'Low-ThroughPut' if entry['source'].lower() == 'ltp'
else None),
'phosphoelm_substrate_name': entry['acc'],
'phosphoelm_kinase_name': entry.get('kinases', None),
'used_kinse_name': used_name,
'entry_date': entry['entry_date'],
'sequence': entry['sequence']
}
)
statements.append(Phosphorylation(
enz=enz,
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
ev : :py:class:`Evidence`
an :py:class:`Evidence` object containing the kinetics of the
"""
kin = get_kinetics(assay)
source_id = assay.get('assay_chembl_id')
if not kin:
return None
annotations = {'kinetics': kin}
chembl_doc_id = str(assay.get('document_chembl_id'))
pmid = get_pmid(chembl_doc_id)
ev = Evidence(source_api='chembl', pmid=pmid, source_id=source_id,
annotations=annotations)
return ev
return []
text = rel_dict.get('Sentence')
annot_keys = ['Relation']
annots = {k: rel_dict.get(k) for k in annot_keys}
ref = rel_dict.get('Source_File')
for cause_idx, effect_idx in itertools.product(causes, effects):
cause = self._events.get(cause_idx)
effect = self._events.get(effect_idx)
if not cause or not effect:
continue
subj = self.get_event(cause)
obj = self.get_event(effect)
ev = Evidence(source_api='sofia', pmid=ref,
annotations=annots, text=text)
stmt = Influence(subj, obj, evidence=[ev])
# Use the polarity of the events, if object does not have a
# polarity, use overall polarity
if stmt.obj.delta.polarity is None:
stmt.obj.delta.set_polarity(pol)
stmt_list.append(stmt)
return stmt_list
enz_up = row['KIN_ACC_ID']
sub_name = row['SUB_GENE']
sub_up = row['SUB_ACC_ID']
if not enz_name or not sub_name or \
isinstance(enz_name, float) or isinstance(sub_name, float):
continue
enz = Agent(enz_name, db_refs={'UP': enz_up})
sub = Agent(sub_name, db_refs={'UP': sub_up})
site = row['SUB_MOD_RSD']
if site[0] in ('S', 'T', 'Y'):
residue = site[0]
position = site[1:]
else:
residue = None
position = None
ev = Evidence('phosphosite')
st = Phosphorylation(enz, sub, residue, position, ev)
stmts.append(st)
logger.info('%d human-human phosphorylations in Phosphosite' % len(stmts))
with open('phosphosite_indra.pkl', 'wb') as fh:
pickle.dump(stmts, fh)
return stmts
def _simple_scorer_update(G, edge):
evidence_list = []
for stmt_data in G.edges[edge]['statements']:
for k, v in stmt_data['source_counts'].items():
if k in db_source_mapping:
s = db_source_mapping[k]
else:
s = k
for _ in range(v):
evidence_list.append(Evidence(source_api=s))
return simple_scorer.score_statement(st=Statement(evidence=evidence_list))
def _make_evidence(self, class_min):
ev = Evidence(source_api='tas', epistemics={'direct': True},
annotations={'class_min': CLASS_MAP[class_min]})
return ev
if time:
context.time = TimeContext(text=time.strip())
loc = event_entry.get('Location')
if loc:
context.geo_location = RefContext(name=loc)
text = event_entry.get('Text')
ref = event_entry.get('Source')
agent = event_entry.get('Agent')
patient = event_entry.get('Patient')
anns = {}
if agent:
anns['agent'] = agent
if patient:
anns['patient'] = patient
ev = Evidence(source_api='sofia', pmid=ref, text=text,
annotations=anns, source_id=event_entry['Event Index'])
pol = event_entry.get('Polarity')
event = Event(concept, context=context, evidence=[ev],
delta=QualitativeDelta(polarity=pol, adjectives=None))
return event