repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.find_event_with_outgoing_edges | def find_event_with_outgoing_edges(self, event_name, desired_relations):
"""Gets a list of event nodes with the specified event_name and
outgoing edges annotated with each of the specified relations.
Parameters
----------
event_name : str
Look for event nodes with th... | python | def find_event_with_outgoing_edges(self, event_name, desired_relations):
"""Gets a list of event nodes with the specified event_name and
outgoing edges annotated with each of the specified relations.
Parameters
----------
event_name : str
Look for event nodes with th... | Gets a list of event nodes with the specified event_name and
outgoing edges annotated with each of the specified relations.
Parameters
----------
event_name : str
Look for event nodes with this name
desired_relations : list[str]
Look for event nodes with ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L154-L186 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.get_related_node | def get_related_node(self, node, relation):
"""Looks for an edge from node to some other node, such that the edge
is annotated with the given relation. If there exists such an edge,
returns the name of the node it points to. Otherwise, returns None."""
G = self.G
for edge in G.ed... | python | def get_related_node(self, node, relation):
"""Looks for an edge from node to some other node, such that the edge
is annotated with the given relation. If there exists such an edge,
returns the name of the node it points to. Otherwise, returns None."""
G = self.G
for edge in G.ed... | Looks for an edge from node to some other node, such that the edge
is annotated with the given relation. If there exists such an edge,
returns the name of the node it points to. Otherwise, returns None. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L188-L199 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.get_entity_text_for_relation | def get_entity_text_for_relation(self, node, relation):
"""Looks for an edge from node to some other node, such that the edge is
annotated with the given relation. If there exists such an edge, and
the node at the other edge is an entity, return that entity's text.
Otherwise, returns Non... | python | def get_entity_text_for_relation(self, node, relation):
"""Looks for an edge from node to some other node, such that the edge is
annotated with the given relation. If there exists such an edge, and
the node at the other edge is an entity, return that entity's text.
Otherwise, returns Non... | Looks for an edge from node to some other node, such that the edge is
annotated with the given relation. If there exists such an edge, and
the node at the other edge is an entity, return that entity's text.
Otherwise, returns None. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L201-L215 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.process_increase_expression_amount | def process_increase_expression_amount(self):
"""Looks for Positive_Regulation events with a specified Cause
and a Gene_Expression theme, and processes them into INDRA statements.
"""
statements = []
pwcs = self.find_event_parent_with_event_child(
'Positive_regul... | python | def process_increase_expression_amount(self):
"""Looks for Positive_Regulation events with a specified Cause
and a Gene_Expression theme, and processes them into INDRA statements.
"""
statements = []
pwcs = self.find_event_parent_with_event_child(
'Positive_regul... | Looks for Positive_Regulation events with a specified Cause
and a Gene_Expression theme, and processes them into INDRA statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L217-L239 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.process_phosphorylation_statements | def process_phosphorylation_statements(self):
"""Looks for Phosphorylation events in the graph and extracts them into
INDRA statements.
In particular, looks for a Positive_regulation event node with a child
Phosphorylation event node.
If Positive_regulation has an outgoing Caus... | python | def process_phosphorylation_statements(self):
"""Looks for Phosphorylation events in the graph and extracts them into
INDRA statements.
In particular, looks for a Positive_regulation event node with a child
Phosphorylation event node.
If Positive_regulation has an outgoing Caus... | Looks for Phosphorylation events in the graph and extracts them into
INDRA statements.
In particular, looks for a Positive_regulation event node with a child
Phosphorylation event node.
If Positive_regulation has an outgoing Cause edge, that's the subject
If Phosphorylation has... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L265-L309 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.process_binding_statements | def process_binding_statements(self):
"""Looks for Binding events in the graph and extracts them into INDRA
statements.
In particular, looks for a Binding event node with outgoing edges
with relations Theme and Theme2 - the entities these edges point to
are the two constituents ... | python | def process_binding_statements(self):
"""Looks for Binding events in the graph and extracts them into INDRA
statements.
In particular, looks for a Binding event node with outgoing edges
with relations Theme and Theme2 - the entities these edges point to
are the two constituents ... | Looks for Binding events in the graph and extracts them into INDRA
statements.
In particular, looks for a Binding event node with outgoing edges
with relations Theme and Theme2 - the entities these edges point to
are the two constituents of the Complex INDRA statement. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L311-L338 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.node_to_evidence | def node_to_evidence(self, entity_node, is_direct):
"""Computes an evidence object for a statement.
We assume that the entire event happens within a single statement, and
get the text of the sentence by getting the text of the sentence
containing the provided node that corresponds to on... | python | def node_to_evidence(self, entity_node, is_direct):
"""Computes an evidence object for a statement.
We assume that the entire event happens within a single statement, and
get the text of the sentence by getting the text of the sentence
containing the provided node that corresponds to on... | Computes an evidence object for a statement.
We assume that the entire event happens within a single statement, and
get the text of the sentence by getting the text of the sentence
containing the provided node that corresponds to one of the entities
participanting in the event.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L340-L375 |
sorgerlab/indra | indra/sources/tees/processor.py | TEESProcessor.connected_subgraph | def connected_subgraph(self, node):
"""Returns the subgraph containing the given node, its ancestors, and
its descendants.
Parameters
----------
node : str
We want to create the subgraph containing this node.
Returns
-------
subgraph : networ... | python | def connected_subgraph(self, node):
"""Returns the subgraph containing the given node, its ancestors, and
its descendants.
Parameters
----------
node : str
We want to create the subgraph containing this node.
Returns
-------
subgraph : networ... | Returns the subgraph containing the given node, its ancestors, and
its descendants.
Parameters
----------
node : str
We want to create the subgraph containing this node.
Returns
-------
subgraph : networkx.DiGraph
The subgraph containing ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/processor.py#L377-L412 |
sorgerlab/indra | indra/sources/trips/api.py | process_text | def process_text(text, save_xml_name='trips_output.xml', save_xml_pretty=True,
offline=False, service_endpoint='drum'):
"""Return a TripsProcessor by processing text.
Parameters
----------
text : str
The text to be processed.
save_xml_name : Optional[str]
The name o... | python | def process_text(text, save_xml_name='trips_output.xml', save_xml_pretty=True,
offline=False, service_endpoint='drum'):
"""Return a TripsProcessor by processing text.
Parameters
----------
text : str
The text to be processed.
save_xml_name : Optional[str]
The name o... | Return a TripsProcessor by processing text.
Parameters
----------
text : str
The text to be processed.
save_xml_name : Optional[str]
The name of the file to save the returned TRIPS extraction knowledge
base XML. Default: trips_output.xml
save_xml_pretty : Optional[bool]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/api.py#L18-L80 |
sorgerlab/indra | indra/sources/trips/api.py | process_xml_file | def process_xml_file(file_name):
"""Return a TripsProcessor by processing a TRIPS EKB XML file.
Parameters
----------
file_name : str
Path to a TRIPS extraction knowledge base (EKB) file to be processed.
Returns
-------
tp : TripsProcessor
A TripsProcessor containing the ex... | python | def process_xml_file(file_name):
"""Return a TripsProcessor by processing a TRIPS EKB XML file.
Parameters
----------
file_name : str
Path to a TRIPS extraction knowledge base (EKB) file to be processed.
Returns
-------
tp : TripsProcessor
A TripsProcessor containing the ex... | Return a TripsProcessor by processing a TRIPS EKB XML file.
Parameters
----------
file_name : str
Path to a TRIPS extraction knowledge base (EKB) file to be processed.
Returns
-------
tp : TripsProcessor
A TripsProcessor containing the extracted INDRA Statements
in tp.s... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/api.py#L83-L99 |
sorgerlab/indra | indra/sources/trips/api.py | process_xml | def process_xml(xml_string):
"""Return a TripsProcessor by processing a TRIPS EKB XML string.
Parameters
----------
xml_string : str
A TRIPS extraction knowledge base (EKB) string to be processed.
http://trips.ihmc.us/parser/api.html
Returns
-------
tp : TripsProcessor
... | python | def process_xml(xml_string):
"""Return a TripsProcessor by processing a TRIPS EKB XML string.
Parameters
----------
xml_string : str
A TRIPS extraction knowledge base (EKB) string to be processed.
http://trips.ihmc.us/parser/api.html
Returns
-------
tp : TripsProcessor
... | Return a TripsProcessor by processing a TRIPS EKB XML string.
Parameters
----------
xml_string : str
A TRIPS extraction knowledge base (EKB) string to be processed.
http://trips.ihmc.us/parser/api.html
Returns
-------
tp : TripsProcessor
A TripsProcessor containing the ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/api.py#L102-L134 |
sorgerlab/indra | indra/belief/wm_scorer.py | load_eidos_curation_table | def load_eidos_curation_table():
"""Return a pandas table of Eidos curation data."""
url = 'https://raw.githubusercontent.com/clulab/eidos/master/' + \
'src/main/resources/org/clulab/wm/eidos/english/confidence/' + \
'rule_summary.tsv'
# Load the table of scores from the URL above into a dat... | python | def load_eidos_curation_table():
"""Return a pandas table of Eidos curation data."""
url = 'https://raw.githubusercontent.com/clulab/eidos/master/' + \
'src/main/resources/org/clulab/wm/eidos/english/confidence/' + \
'rule_summary.tsv'
# Load the table of scores from the URL above into a dat... | Return a pandas table of Eidos curation data. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/wm_scorer.py#L11-L21 |
sorgerlab/indra | indra/belief/wm_scorer.py | get_eidos_bayesian_scorer | def get_eidos_bayesian_scorer(prior_counts=None):
"""Return a BayesianScorer based on Eidos curation counts."""
table = load_eidos_curation_table()
subtype_counts = {'eidos': {r: [c, i] for r, c, i in
zip(table['RULE'], table['Num correct'],
ta... | python | def get_eidos_bayesian_scorer(prior_counts=None):
"""Return a BayesianScorer based on Eidos curation counts."""
table = load_eidos_curation_table()
subtype_counts = {'eidos': {r: [c, i] for r, c, i in
zip(table['RULE'], table['Num correct'],
ta... | Return a BayesianScorer based on Eidos curation counts. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/wm_scorer.py#L24-L35 |
sorgerlab/indra | indra/belief/wm_scorer.py | get_eidos_scorer | def get_eidos_scorer():
"""Return a SimpleScorer based on Eidos curated precision estimates."""
table = load_eidos_curation_table()
# Get the overall precision
total_num = table['COUNT of RULE'].sum()
weighted_sum = table['COUNT of RULE'].dot(table['% correct'])
precision = weighted_sum / total... | python | def get_eidos_scorer():
"""Return a SimpleScorer based on Eidos curated precision estimates."""
table = load_eidos_curation_table()
# Get the overall precision
total_num = table['COUNT of RULE'].sum()
weighted_sum = table['COUNT of RULE'].dot(table['% correct'])
precision = weighted_sum / total... | Return a SimpleScorer based on Eidos curated precision estimates. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/wm_scorer.py#L38-L57 |
sorgerlab/indra | indra/sources/trrust/api.py | process_from_web | def process_from_web():
"""Return a TrrustProcessor based on the online interaction table.
Returns
-------
TrrustProcessor
A TrrustProcessor object that has a list of INDRA Statements in its
statements attribute.
"""
logger.info('Downloading table from %s' % trrust_human_url)
... | python | def process_from_web():
"""Return a TrrustProcessor based on the online interaction table.
Returns
-------
TrrustProcessor
A TrrustProcessor object that has a list of INDRA Statements in its
statements attribute.
"""
logger.info('Downloading table from %s' % trrust_human_url)
... | Return a TrrustProcessor based on the online interaction table.
Returns
-------
TrrustProcessor
A TrrustProcessor object that has a list of INDRA Statements in its
statements attribute. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trrust/api.py#L18-L33 |
sorgerlab/indra | indra/sources/rlimsp/api.py | process_from_webservice | def process_from_webservice(id_val, id_type='pmcid', source='pmc',
with_grounding=True):
"""Return an output from RLIMS-p for the given PubMed ID or PMC ID.
Parameters
----------
id_val : str
A PMCID, with the prefix PMC, or pmid, with no prefix, of the paper to
... | python | def process_from_webservice(id_val, id_type='pmcid', source='pmc',
with_grounding=True):
"""Return an output from RLIMS-p for the given PubMed ID or PMC ID.
Parameters
----------
id_val : str
A PMCID, with the prefix PMC, or pmid, with no prefix, of the paper to
... | Return an output from RLIMS-p for the given PubMed ID or PMC ID.
Parameters
----------
id_val : str
A PMCID, with the prefix PMC, or pmid, with no prefix, of the paper to
be "read".
id_type : str
Either 'pmid' or 'pmcid'. The default is 'pmcid'.
source : str
Either '... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/api.py#L21-L59 |
sorgerlab/indra | indra/sources/rlimsp/api.py | process_from_json_file | def process_from_json_file(filename, doc_id_type=None):
"""Process RLIMSP extractions from a bulk-download JSON file.
Parameters
----------
filename : str
Path to the JSON file.
doc_id_type : Optional[str]
In some cases the RLIMS-P paragraph info doesn't contain 'pmid' or
'p... | python | def process_from_json_file(filename, doc_id_type=None):
"""Process RLIMSP extractions from a bulk-download JSON file.
Parameters
----------
filename : str
Path to the JSON file.
doc_id_type : Optional[str]
In some cases the RLIMS-P paragraph info doesn't contain 'pmid' or
'p... | Process RLIMSP extractions from a bulk-download JSON file.
Parameters
----------
filename : str
Path to the JSON file.
doc_id_type : Optional[str]
In some cases the RLIMS-P paragraph info doesn't contain 'pmid' or
'pmcid' explicitly, instead if contains a 'docId' key. This param... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/api.py#L62-L88 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.export_dict | def export_dict(self):
"Convert this into an ordinary dict (of dicts)."
return {k: v.export_dict() if isinstance(v, self.__class__) else v
for k, v in self.items()} | python | def export_dict(self):
"Convert this into an ordinary dict (of dicts)."
return {k: v.export_dict() if isinstance(v, self.__class__) else v
for k, v in self.items()} | Convert this into an ordinary dict (of dicts). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L53-L56 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.get | def get(self, key):
"Find the first value within the tree which has the key."
if key in self.keys():
return self[key]
else:
res = None
for v in self.values():
# This could get weird if the actual expected returned value
# is Non... | python | def get(self, key):
"Find the first value within the tree which has the key."
if key in self.keys():
return self[key]
else:
res = None
for v in self.values():
# This could get weird if the actual expected returned value
# is Non... | Find the first value within the tree which has the key. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L58-L72 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.get_path | def get_path(self, key):
"Like `get`, but also return the path taken to the value."
if key in self.keys():
return (key,), self[key]
else:
key_path, res = (None, None)
for sub_key, v in self.items():
if isinstance(v, self.__class__):
... | python | def get_path(self, key):
"Like `get`, but also return the path taken to the value."
if key in self.keys():
return (key,), self[key]
else:
key_path, res = (None, None)
for sub_key, v in self.items():
if isinstance(v, self.__class__):
... | Like `get`, but also return the path taken to the value. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L74-L89 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.gets | def gets(self, key):
"Like `get`, but return all matches, not just the first."
result_list = []
if key in self.keys():
result_list.append(self[key])
for v in self.values():
if isinstance(v, self.__class__):
sub_res_list = v.gets(key)
... | python | def gets(self, key):
"Like `get`, but return all matches, not just the first."
result_list = []
if key in self.keys():
result_list.append(self[key])
for v in self.values():
if isinstance(v, self.__class__):
sub_res_list = v.gets(key)
... | Like `get`, but return all matches, not just the first. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L91-L104 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.get_paths | def get_paths(self, key):
"Like `gets`, but include the paths, like `get_path` for all matches."
result_list = []
if key in self.keys():
result_list.append(((key,), self[key]))
for sub_key, v in self.items():
if isinstance(v, self.__class__):
sub_r... | python | def get_paths(self, key):
"Like `gets`, but include the paths, like `get_path` for all matches."
result_list = []
if key in self.keys():
result_list.append(((key,), self[key]))
for sub_key, v in self.items():
if isinstance(v, self.__class__):
sub_r... | Like `gets`, but include the paths, like `get_path` for all matches. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L106-L119 |
sorgerlab/indra | indra/util/nested_dict.py | NestedDict.get_leaves | def get_leaves(self):
"""Get the deepest entries as a flat set."""
ret_set = set()
for val in self.values():
if isinstance(val, self.__class__):
ret_set |= val.get_leaves()
elif isinstance(val, dict):
ret_set |= set(val.values())
... | python | def get_leaves(self):
"""Get the deepest entries as a flat set."""
ret_set = set()
for val in self.values():
if isinstance(val, self.__class__):
ret_set |= val.get_leaves()
elif isinstance(val, dict):
ret_set |= set(val.values())
... | Get the deepest entries as a flat set. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/nested_dict.py#L121-L135 |
sorgerlab/indra | indra/sources/reach/processor.py | _read_reach_rule_regexps | def _read_reach_rule_regexps():
"""Load in a file with the regular expressions corresponding to each
reach rule. Why regular expression matching?
The rule name in found_by has instances of some reach rules for each
possible event type
(activation, binding, etc). This makes for too many different typ... | python | def _read_reach_rule_regexps():
"""Load in a file with the regular expressions corresponding to each
reach rule. Why regular expression matching?
The rule name in found_by has instances of some reach rules for each
possible event type
(activation, binding, etc). This makes for too many different typ... | Load in a file with the regular expressions corresponding to each
reach rule. Why regular expression matching?
The rule name in found_by has instances of some reach rules for each
possible event type
(activation, binding, etc). This makes for too many different types of
rules for practical curation ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L812-L829 |
sorgerlab/indra | indra/sources/reach/processor.py | determine_reach_subtype | def determine_reach_subtype(event_name):
"""Returns the category of reach rule from the reach rule instance.
Looks at a list of regular
expressions corresponding to reach rule types, and returns the longest
regexp that matches, or None if none of them match.
Parameters
----------
evidence ... | python | def determine_reach_subtype(event_name):
"""Returns the category of reach rule from the reach rule instance.
Looks at a list of regular
expressions corresponding to reach rule types, and returns the longest
regexp that matches, or None if none of them match.
Parameters
----------
evidence ... | Returns the category of reach rule from the reach rule instance.
Looks at a list of regular
expressions corresponding to reach rule types, and returns the longest
regexp that matches, or None if none of them match.
Parameters
----------
evidence : indra.statements.Evidence
A reach evid... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L835-L862 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.print_event_statistics | def print_event_statistics(self):
"""Print the number of events in the REACH output by type."""
logger.info('All events by type')
logger.info('-------------------')
for k, v in self.all_events.items():
logger.info('%s, %s' % (k, len(v)))
logger.info('-----------------... | python | def print_event_statistics(self):
"""Print the number of events in the REACH output by type."""
logger.info('All events by type')
logger.info('-------------------')
for k, v in self.all_events.items():
logger.info('%s, %s' % (k, len(v)))
logger.info('-----------------... | Print the number of events in the REACH output by type. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L52-L58 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_all_events | def get_all_events(self):
"""Gather all event IDs in the REACH output by type.
These IDs are stored in the self.all_events dict.
"""
self.all_events = {}
events = self.tree.execute("$.events.frames")
if events is None:
return
for e in events:
... | python | def get_all_events(self):
"""Gather all event IDs in the REACH output by type.
These IDs are stored in the self.all_events dict.
"""
self.all_events = {}
events = self.tree.execute("$.events.frames")
if events is None:
return
for e in events:
... | Gather all event IDs in the REACH output by type.
These IDs are stored in the self.all_events dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L60-L75 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_modifications | def get_modifications(self):
"""Extract Modification INDRA Statements."""
# Find all event frames that are a type of protein modification
qstr = "$.events.frames[(@.type is 'protein-modification')]"
res = self.tree.execute(qstr)
if res is None:
return
# Extrac... | python | def get_modifications(self):
"""Extract Modification INDRA Statements."""
# Find all event frames that are a type of protein modification
qstr = "$.events.frames[(@.type is 'protein-modification')]"
res = self.tree.execute(qstr)
if res is None:
return
# Extrac... | Extract Modification INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L87-L173 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_regulate_amounts | def get_regulate_amounts(self):
"""Extract RegulateAmount INDRA Statements."""
qstr = "$.events.frames[(@.type is 'transcription')]"
res = self.tree.execute(qstr)
all_res = []
if res is not None:
all_res += list(res)
qstr = "$.events.frames[(@.type is 'amount'... | python | def get_regulate_amounts(self):
"""Extract RegulateAmount INDRA Statements."""
qstr = "$.events.frames[(@.type is 'transcription')]"
res = self.tree.execute(qstr)
all_res = []
if res is not None:
all_res += list(res)
qstr = "$.events.frames[(@.type is 'amount'... | Extract RegulateAmount INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L175-L224 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_complexes | def get_complexes(self):
"""Extract INDRA Complex Statements."""
qstr = "$.events.frames[@.type is 'complex-assembly']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics.get('... | python | def get_complexes(self):
"""Extract INDRA Complex Statements."""
qstr = "$.events.frames[@.type is 'complex-assembly']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics.get('... | Extract INDRA Complex Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L226-L258 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_activation | def get_activation(self):
"""Extract INDRA Activation Statements."""
qstr = "$.events.frames[@.type is 'activation']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics.get('neg... | python | def get_activation(self):
"""Extract INDRA Activation Statements."""
qstr = "$.events.frames[@.type is 'activation']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics.get('neg... | Extract INDRA Activation Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L260-L292 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor.get_translocation | def get_translocation(self):
"""Extract INDRA Translocation Statements."""
qstr = "$.events.frames[@.type is 'translocation']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics... | python | def get_translocation(self):
"""Extract INDRA Translocation Statements."""
qstr = "$.events.frames[@.type is 'translocation']"
res = self.tree.execute(qstr)
if res is None:
return
for r in res:
epistemics = self._get_epistemics(r)
if epistemics... | Extract INDRA Translocation Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L294-L324 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor._get_mod_conditions | def _get_mod_conditions(self, mod_term):
"""Return a list of ModConditions given a mod term dict."""
site = mod_term.get('site')
if site is not None:
mods = self._parse_site_text(site)
else:
mods = [Site(None, None)]
mcs = []
for mod in mods:
... | python | def _get_mod_conditions(self, mod_term):
"""Return a list of ModConditions given a mod term dict."""
site = mod_term.get('site')
if site is not None:
mods = self._parse_site_text(site)
else:
mods = [Site(None, None)]
mcs = []
for mod in mods:
... | Return a list of ModConditions given a mod term dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L469-L489 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor._get_entity_coordinates | def _get_entity_coordinates(self, entity_term):
"""Return sentence coordinates for a given entity.
Given an entity term return the associated sentence coordinates as
a tuple of the form (int, int). Returns None if for any reason the
sentence coordinates cannot be found.
"""
... | python | def _get_entity_coordinates(self, entity_term):
"""Return sentence coordinates for a given entity.
Given an entity term return the associated sentence coordinates as
a tuple of the form (int, int). Returns None if for any reason the
sentence coordinates cannot be found.
"""
... | Return sentence coordinates for a given entity.
Given an entity term return the associated sentence coordinates as
a tuple of the form (int, int). Returns None if for any reason the
sentence coordinates cannot be found. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L491-L529 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor._get_section | def _get_section(self, event):
"""Get the section of the paper that the event is from."""
sentence_id = event.get('sentence')
section = None
if sentence_id:
qstr = "$.sentences.frames[(@.frame_id is \'%s\')]" % sentence_id
res = self.tree.execute(qstr)
... | python | def _get_section(self, event):
"""Get the section of the paper that the event is from."""
sentence_id = event.get('sentence')
section = None
if sentence_id:
qstr = "$.sentences.frames[(@.frame_id is \'%s\')]" % sentence_id
res = self.tree.execute(qstr)
... | Get the section of the paper that the event is from. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L610-L644 |
sorgerlab/indra | indra/sources/reach/processor.py | ReachProcessor._get_controller_agent | def _get_controller_agent(self, arg):
"""Return a single or a complex controller agent."""
controller_agent = None
controller = arg.get('arg')
# There is either a single controller here
if controller is not None:
controller_agent, coords = self._get_agent_from_entity(... | python | def _get_controller_agent(self, arg):
"""Return a single or a complex controller agent."""
controller_agent = None
controller = arg.get('arg')
# There is either a single controller here
if controller is not None:
controller_agent, coords = self._get_agent_from_entity(... | Return a single or a complex controller agent. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L646-L663 |
sorgerlab/indra | indra/sources/eidos/processor.py | _sanitize | def _sanitize(text):
"""Return sanitized Eidos text field for human readability."""
d = {'-LRB-': '(', '-RRB-': ')'}
return re.sub('|'.join(d.keys()), lambda m: d[m.group(0)], text) | python | def _sanitize(text):
"""Return sanitized Eidos text field for human readability."""
d = {'-LRB-': '(', '-RRB-': ')'}
return re.sub('|'.join(d.keys()), lambda m: d[m.group(0)], text) | Return sanitized Eidos text field for human readability. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L380-L383 |
sorgerlab/indra | indra/sources/eidos/processor.py | _get_time_stamp | def _get_time_stamp(entry):
"""Return datetime object from a timex constraint start/end entry.
Example string format to convert: 2018-01-01T00:00
"""
if not entry or entry == 'Undef':
return None
try:
dt = datetime.datetime.strptime(entry, '%Y-%m-%dT%H:%M')
except Exception as e... | python | def _get_time_stamp(entry):
"""Return datetime object from a timex constraint start/end entry.
Example string format to convert: 2018-01-01T00:00
"""
if not entry or entry == 'Undef':
return None
try:
dt = datetime.datetime.strptime(entry, '%Y-%m-%dT%H:%M')
except Exception as e... | Return datetime object from a timex constraint start/end entry.
Example string format to convert: 2018-01-01T00:00 | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L386-L398 |
sorgerlab/indra | indra/sources/eidos/processor.py | ref_context_from_geoloc | def ref_context_from_geoloc(geoloc):
"""Return a RefContext object given a geoloc entry."""
text = geoloc.get('text')
geoid = geoloc.get('geoID')
rc = RefContext(name=text, db_refs={'GEOID': geoid})
return rc | python | def ref_context_from_geoloc(geoloc):
"""Return a RefContext object given a geoloc entry."""
text = geoloc.get('text')
geoid = geoloc.get('geoID')
rc = RefContext(name=text, db_refs={'GEOID': geoid})
return rc | Return a RefContext object given a geoloc entry. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L401-L406 |
sorgerlab/indra | indra/sources/eidos/processor.py | time_context_from_timex | def time_context_from_timex(timex):
"""Return a TimeContext object given a timex entry."""
time_text = timex.get('text')
constraint = timex['intervals'][0]
start = _get_time_stamp(constraint.get('start'))
end = _get_time_stamp(constraint.get('end'))
duration = constraint['duration']
tc = Tim... | python | def time_context_from_timex(timex):
"""Return a TimeContext object given a timex entry."""
time_text = timex.get('text')
constraint = timex['intervals'][0]
start = _get_time_stamp(constraint.get('start'))
end = _get_time_stamp(constraint.get('end'))
duration = constraint['duration']
tc = Tim... | Return a TimeContext object given a timex entry. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L409-L418 |
sorgerlab/indra | indra/sources/eidos/processor.py | find_args | def find_args(event, arg_type):
"""Return IDs of all arguments of a given type"""
args = event.get('arguments', {})
obj_tags = [arg for arg in args if arg['type'] == arg_type]
if obj_tags:
return [o['value']['@id'] for o in obj_tags]
else:
return [] | python | def find_args(event, arg_type):
"""Return IDs of all arguments of a given type"""
args = event.get('arguments', {})
obj_tags = [arg for arg in args if arg['type'] == arg_type]
if obj_tags:
return [o['value']['@id'] for o in obj_tags]
else:
return [] | Return IDs of all arguments of a given type | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L430-L437 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.extract_causal_relations | def extract_causal_relations(self):
"""Extract causal relations as Statements."""
# Get the extractions that are labeled as directed and causal
relations = [e for e in self.doc.extractions if
'DirectedRelation' in e['labels'] and
'Causal' in e['labels']]... | python | def extract_causal_relations(self):
"""Extract causal relations as Statements."""
# Get the extractions that are labeled as directed and causal
relations = [e for e in self.doc.extractions if
'DirectedRelation' in e['labels'] and
'Causal' in e['labels']]... | Extract causal relations as Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L27-L38 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.get_evidence | def get_evidence(self, relation):
"""Return the Evidence object for the INDRA Statment."""
provenance = relation.get('provenance')
# First try looking up the full sentence through provenance
text = None
context = None
if provenance:
sentence_tag = provenance[... | python | def get_evidence(self, relation):
"""Return the Evidence object for the INDRA Statment."""
provenance = relation.get('provenance')
# First try looking up the full sentence through provenance
text = None
context = None
if provenance:
sentence_tag = provenance[... | Return the Evidence object for the INDRA Statment. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L119-L181 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.get_negation | def get_negation(event):
"""Return negation attached to an event.
Example: "states": [{"@type": "State", "type": "NEGATION",
"text": "n't"}]
"""
states = event.get('states', [])
if not states:
return []
negs = [state for state in ... | python | def get_negation(event):
"""Return negation attached to an event.
Example: "states": [{"@type": "State", "type": "NEGATION",
"text": "n't"}]
"""
states = event.get('states', [])
if not states:
return []
negs = [state for state in ... | Return negation attached to an event.
Example: "states": [{"@type": "State", "type": "NEGATION",
"text": "n't"}] | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L184-L196 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.get_hedging | def get_hedging(event):
"""Return hedging markers attached to an event.
Example: "states": [{"@type": "State", "type": "HEDGE",
"text": "could"}
"""
states = event.get('states', [])
if not states:
return []
hedgings = [state for s... | python | def get_hedging(event):
"""Return hedging markers attached to an event.
Example: "states": [{"@type": "State", "type": "HEDGE",
"text": "could"}
"""
states = event.get('states', [])
if not states:
return []
hedgings = [state for s... | Return hedging markers attached to an event.
Example: "states": [{"@type": "State", "type": "HEDGE",
"text": "could"} | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L199-L211 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.get_groundings | def get_groundings(entity):
"""Return groundings as db_refs for an entity."""
def get_grounding_entries(grounding):
if not grounding:
return None
entries = []
values = grounding.get('values', [])
# Values could still have been a None entry... | python | def get_groundings(entity):
"""Return groundings as db_refs for an entity."""
def get_grounding_entries(grounding):
if not grounding:
return None
entries = []
values = grounding.get('values', [])
# Values could still have been a None entry... | Return groundings as db_refs for an entity. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L243-L276 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.get_concept | def get_concept(entity):
"""Return Concept from an Eidos entity."""
# Use the canonical name as the name of the Concept
name = entity['canonicalName']
db_refs = EidosProcessor.get_groundings(entity)
concept = Concept(name, db_refs=db_refs)
return concept | python | def get_concept(entity):
"""Return Concept from an Eidos entity."""
# Use the canonical name as the name of the Concept
name = entity['canonicalName']
db_refs = EidosProcessor.get_groundings(entity)
concept = Concept(name, db_refs=db_refs)
return concept | Return Concept from an Eidos entity. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L279-L285 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.time_context_from_ref | def time_context_from_ref(self, timex):
"""Return a time context object given a timex reference entry."""
# If the timex has a value set, it means that it refers to a DCT or
# a TimeExpression e.g. "value": {"@id": "_:DCT_1"} and the parameters
# need to be taken from there
value... | python | def time_context_from_ref(self, timex):
"""Return a time context object given a timex reference entry."""
# If the timex has a value set, it means that it refers to a DCT or
# a TimeExpression e.g. "value": {"@id": "_:DCT_1"} and the parameters
# need to be taken from there
value... | Return a time context object given a timex reference entry. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L287-L298 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosProcessor.geo_context_from_ref | def geo_context_from_ref(self, ref):
"""Return a ref context object given a location reference entry."""
value = ref.get('value')
if value:
# Here we get the RefContext from the stashed geoloc dictionary
rc = self.doc.geolocs.get(value['@id'])
return rc
... | python | def geo_context_from_ref(self, ref):
"""Return a ref context object given a location reference entry."""
value = ref.get('value')
if value:
# Here we get the RefContext from the stashed geoloc dictionary
rc = self.doc.geolocs.get(value['@id'])
return rc
... | Return a ref context object given a location reference entry. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L300-L307 |
sorgerlab/indra | indra/sources/eidos/processor.py | EidosDocument.time_context_from_dct | def time_context_from_dct(dct):
"""Return a time context object given a DCT entry."""
time_text = dct.get('text')
start = _get_time_stamp(dct.get('start'))
end = _get_time_stamp(dct.get('end'))
duration = dct.get('duration')
tc = TimeContext(text=time_text, start=start, e... | python | def time_context_from_dct(dct):
"""Return a time context object given a DCT entry."""
time_text = dct.get('text')
start = _get_time_stamp(dct.get('start'))
end = _get_time_stamp(dct.get('end'))
duration = dct.get('duration')
tc = TimeContext(text=time_text, start=start, e... | Return a time context object given a DCT entry. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/processor.py#L369-L377 |
sorgerlab/indra | indra/statements/util.py | make_hash | def make_hash(s, n_bytes):
"""Make the hash from a matches key."""
raw_h = int(md5(s.encode('utf-8')).hexdigest()[:n_bytes], 16)
# Make it a signed int.
return 16**n_bytes//2 - raw_h | python | def make_hash(s, n_bytes):
"""Make the hash from a matches key."""
raw_h = int(md5(s.encode('utf-8')).hexdigest()[:n_bytes], 16)
# Make it a signed int.
return 16**n_bytes//2 - raw_h | Make the hash from a matches key. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/util.py#L12-L16 |
sorgerlab/indra | indra/sources/tees/parse_tees.py | parse_a1 | def parse_a1(a1_text):
"""Parses an a1 file, the file TEES outputs that lists the entities in
the extracted events.
Parameters
----------
a1_text : str
Text of the TEES a1 output file, specifying the entities
Returns
-------
entities : Dictionary mapping TEES identifiers to TEE... | python | def parse_a1(a1_text):
"""Parses an a1 file, the file TEES outputs that lists the entities in
the extracted events.
Parameters
----------
a1_text : str
Text of the TEES a1 output file, specifying the entities
Returns
-------
entities : Dictionary mapping TEES identifiers to TEE... | Parses an a1 file, the file TEES outputs that lists the entities in
the extracted events.
Parameters
----------
a1_text : str
Text of the TEES a1 output file, specifying the entities
Returns
-------
entities : Dictionary mapping TEES identifiers to TEESEntity objects
descri... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/parse_tees.py#L71-L115 |
sorgerlab/indra | indra/sources/tees/parse_tees.py | parse_a2 | def parse_a2(a2_text, entities, tees_sentences):
"""Extracts events from a TEES a2 output into a networkx directed graph.
Parameters
----------
a2_text : str
Text of the TEES a2 file output, specifying the event graph
sentences_xml_gz : str
Filename with the TEES sentence segmentati... | python | def parse_a2(a2_text, entities, tees_sentences):
"""Extracts events from a TEES a2 output into a networkx directed graph.
Parameters
----------
a2_text : str
Text of the TEES a2 file output, specifying the event graph
sentences_xml_gz : str
Filename with the TEES sentence segmentati... | Extracts events from a TEES a2 output into a networkx directed graph.
Parameters
----------
a2_text : str
Text of the TEES a2 file output, specifying the event graph
sentences_xml_gz : str
Filename with the TEES sentence segmentation in a gzipped xml format
Returns
-------
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/parse_tees.py#L118-L224 |
sorgerlab/indra | indra/sources/tees/parse_tees.py | parse_output | def parse_output(a1_text, a2_text, sentence_segmentations):
"""Parses the output of the TEES reader and returns a networkx graph
with the event information.
Parameters
----------
a1_text : str
Contents of the TEES a1 output, specifying the entities
a1_text : str
Contents of the ... | python | def parse_output(a1_text, a2_text, sentence_segmentations):
"""Parses the output of the TEES reader and returns a networkx graph
with the event information.
Parameters
----------
a1_text : str
Contents of the TEES a1 output, specifying the entities
a1_text : str
Contents of the ... | Parses the output of the TEES reader and returns a networkx graph
with the event information.
Parameters
----------
a1_text : str
Contents of the TEES a1 output, specifying the entities
a1_text : str
Contents of the TEES a2 output, specifying the event graph
sentence_segmentatio... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/parse_tees.py#L272-L301 |
sorgerlab/indra | indra/sources/tees/parse_tees.py | tees_parse_networkx_to_dot | def tees_parse_networkx_to_dot(G, output_file, subgraph_nodes):
"""Converts TEES extractions stored in a networkx graph into a graphviz
.dot file.
Parameters
----------
G : networkx.DiGraph
Graph with TEES extractions returned by run_and_parse_tees
output_file : str
Output file ... | python | def tees_parse_networkx_to_dot(G, output_file, subgraph_nodes):
"""Converts TEES extractions stored in a networkx graph into a graphviz
.dot file.
Parameters
----------
G : networkx.DiGraph
Graph with TEES extractions returned by run_and_parse_tees
output_file : str
Output file ... | Converts TEES extractions stored in a networkx graph into a graphviz
.dot file.
Parameters
----------
G : networkx.DiGraph
Graph with TEES extractions returned by run_and_parse_tees
output_file : str
Output file to which to write .dot file
subgraph_nodes : list[str]
Only... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/parse_tees.py#L303-L354 |
sorgerlab/indra | indra/sources/cwms/processor.py | CWMSProcessor._get_event | def _get_event(self, event, find_str):
"""Get a concept referred from the event by the given string."""
# Get the term with the given element id
element = event.find(find_str)
if element is None:
return None
element_id = element.attrib.get('id')
element_term =... | python | def _get_event(self, event, find_str):
"""Get a concept referred from the event by the given string."""
# Get the term with the given element id
element = event.find(find_str)
if element is None:
return None
element_id = element.attrib.get('id')
element_term =... | Get a concept referred from the event by the given string. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/processor.py#L115-L152 |
sorgerlab/indra | indra/sources/cwms/processor.py | CWMSProcessor._extract_time_loc | def _extract_time_loc(self, term):
"""Get the location from a term (CC or TERM)"""
loc = term.find('location')
if loc is None:
loc_context = None
else:
loc_id = loc.attrib.get('id')
loc_term = self.tree.find("*[@id='%s']" % loc_id)
text = l... | python | def _extract_time_loc(self, term):
"""Get the location from a term (CC or TERM)"""
loc = term.find('location')
if loc is None:
loc_context = None
else:
loc_id = loc.attrib.get('id')
loc_term = self.tree.find("*[@id='%s']" % loc_id)
text = l... | Get the location from a term (CC or TERM) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/processor.py#L154-L199 |
sorgerlab/indra | indra/assemblers/cag/assembler.py | CAGAssembler.make_model | def make_model(self, grounding_ontology='UN', grounding_threshold=None):
"""Return a networkx MultiDiGraph representing a causal analysis graph.
Parameters
----------
grounding_ontology : Optional[str]
The ontology from which the grounding should be taken
(e.g. U... | python | def make_model(self, grounding_ontology='UN', grounding_threshold=None):
"""Return a networkx MultiDiGraph representing a causal analysis graph.
Parameters
----------
grounding_ontology : Optional[str]
The ontology from which the grounding should be taken
(e.g. U... | Return a networkx MultiDiGraph representing a causal analysis graph.
Parameters
----------
grounding_ontology : Optional[str]
The ontology from which the grounding should be taken
(e.g. UN, FAO)
grounding_threshold : Optional[float]
Minimum threshold ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cag/assembler.py#L49-L124 |
sorgerlab/indra | indra/assemblers/cag/assembler.py | CAGAssembler.export_to_cytoscapejs | def export_to_cytoscapejs(self):
"""Return CAG in format readable by CytoscapeJS.
Return
------
dict
A JSON-like dict representing the graph for use with
CytoscapeJS.
"""
def _create_edge_data_dict(e):
"""Return a dict from a MultiDiGr... | python | def export_to_cytoscapejs(self):
"""Return CAG in format readable by CytoscapeJS.
Return
------
dict
A JSON-like dict representing the graph for use with
CytoscapeJS.
"""
def _create_edge_data_dict(e):
"""Return a dict from a MultiDiGr... | Return CAG in format readable by CytoscapeJS.
Return
------
dict
A JSON-like dict representing the graph for use with
CytoscapeJS. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cag/assembler.py#L203-L248 |
sorgerlab/indra | indra/assemblers/cag/assembler.py | CAGAssembler.generate_jupyter_js | def generate_jupyter_js(self, cyjs_style=None, cyjs_layout=None):
"""Generate Javascript from a template to run in Jupyter notebooks.
Parameters
----------
cyjs_style : Optional[dict]
A dict that sets CytoscapeJS style as specified in
https://github.com/cytoscape... | python | def generate_jupyter_js(self, cyjs_style=None, cyjs_layout=None):
"""Generate Javascript from a template to run in Jupyter notebooks.
Parameters
----------
cyjs_style : Optional[dict]
A dict that sets CytoscapeJS style as specified in
https://github.com/cytoscape... | Generate Javascript from a template to run in Jupyter notebooks.
Parameters
----------
cyjs_style : Optional[dict]
A dict that sets CytoscapeJS style as specified in
https://github.com/cytoscape/cytoscape.js/blob/master/documentation/md/style.md.
cyjs_layout : O... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cag/assembler.py#L250-L289 |
sorgerlab/indra | indra/assemblers/cag/assembler.py | CAGAssembler._node_name | def _node_name(self, concept):
"""Return a standardized name for a node given a Concept."""
if (# grounding threshold is specified
self.grounding_threshold is not None
# The particular eidos ontology grounding (un/wdi/fao) is present
and concept.db_refs[self.grounding... | python | def _node_name(self, concept):
"""Return a standardized name for a node given a Concept."""
if (# grounding threshold is specified
self.grounding_threshold is not None
# The particular eidos ontology grounding (un/wdi/fao) is present
and concept.db_refs[self.grounding... | Return a standardized name for a node given a Concept. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cag/assembler.py#L291-L303 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | namespace_from_uri | def namespace_from_uri(uri):
"""Return the entity namespace from the URI. Examples:
http://www.openbel.org/bel/p_HGNC_RAF1 -> HGNC
http://www.openbel.org/bel/p_RGD_Raf1 -> RGD
http://www.openbel.org/bel/p_PFH_MEK1/2_Family -> PFH
"""
patterns = ['http://www.openbel.org/bel/[pragm]_([A-Za-z]+)_.*... | python | def namespace_from_uri(uri):
"""Return the entity namespace from the URI. Examples:
http://www.openbel.org/bel/p_HGNC_RAF1 -> HGNC
http://www.openbel.org/bel/p_RGD_Raf1 -> RGD
http://www.openbel.org/bel/p_PFH_MEK1/2_Family -> PFH
"""
patterns = ['http://www.openbel.org/bel/[pragm]_([A-Za-z]+)_.*... | Return the entity namespace from the URI. Examples:
http://www.openbel.org/bel/p_HGNC_RAF1 -> HGNC
http://www.openbel.org/bel/p_RGD_Raf1 -> RGD
http://www.openbel.org/bel/p_PFH_MEK1/2_Family -> PFH | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L21-L35 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | term_from_uri | def term_from_uri(uri):
"""Removes prepended URI information from terms."""
if uri is None:
return None
# This insures that if we get a Literal with an integer value (as we
# do for modification positions), it will get converted to a string,
# not an integer.
if isinstance(uri, rdflib.Li... | python | def term_from_uri(uri):
"""Removes prepended URI information from terms."""
if uri is None:
return None
# This insures that if we get a Literal with an integer value (as we
# do for modification positions), it will get converted to a string,
# not an integer.
if isinstance(uri, rdflib.Li... | Removes prepended URI information from terms. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L37-L66 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_modifications | def get_modifications(self):
"""Extract INDRA Modification Statements from BEL.
Two SPARQL patterns are used for extracting Modifications from BEL:
- q_phospho1 assumes that the subject is an AbundanceActivity, which
increases/decreases a ModifiedProteinAbundance.
Examples... | python | def get_modifications(self):
"""Extract INDRA Modification Statements from BEL.
Two SPARQL patterns are used for extracting Modifications from BEL:
- q_phospho1 assumes that the subject is an AbundanceActivity, which
increases/decreases a ModifiedProteinAbundance.
Examples... | Extract INDRA Modification Statements from BEL.
Two SPARQL patterns are used for extracting Modifications from BEL:
- q_phospho1 assumes that the subject is an AbundanceActivity, which
increases/decreases a ModifiedProteinAbundance.
Examples:
kinaseActivity(proteinA... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L116-L222 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_activating_mods | def get_activating_mods(self):
"""Extract INDRA ActiveForm Statements with a single mod from BEL.
The SPARQL pattern used for extraction from BEL looks for a
ModifiedProteinAbundance as subject and an Activiy of a
ProteinAbundance as object.
Examples:
proteinAbunda... | python | def get_activating_mods(self):
"""Extract INDRA ActiveForm Statements with a single mod from BEL.
The SPARQL pattern used for extraction from BEL looks for a
ModifiedProteinAbundance as subject and an Activiy of a
ProteinAbundance as object.
Examples:
proteinAbunda... | Extract INDRA ActiveForm Statements with a single mod from BEL.
The SPARQL pattern used for extraction from BEL looks for a
ModifiedProteinAbundance as subject and an Activiy of a
ProteinAbundance as object.
Examples:
proteinAbundance(HGNC:INSR,proteinModification(P,Y))
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L225-L279 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_complexes | def get_complexes(self):
"""Extract INDRA Complex Statements from BEL.
The SPARQL query used to extract Complexes looks for ComplexAbundance
terms and their constituents. This pattern is distinct from other
patterns in this processor in that it queries for terms, not
full statem... | python | def get_complexes(self):
"""Extract INDRA Complex Statements from BEL.
The SPARQL query used to extract Complexes looks for ComplexAbundance
terms and their constituents. This pattern is distinct from other
patterns in this processor in that it queries for terms, not
full statem... | Extract INDRA Complex Statements from BEL.
The SPARQL query used to extract Complexes looks for ComplexAbundance
terms and their constituents. This pattern is distinct from other
patterns in this processor in that it queries for terms, not
full statements.
Examples:
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L281-L344 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_activating_subs | def get_activating_subs(self):
"""Extract INDRA ActiveForm Statements based on a mutation from BEL.
The SPARQL pattern used to extract ActiveForms due to mutations look
for a ProteinAbundance as a subject which has a child encoding the
amino acid substitution. The object of the statemen... | python | def get_activating_subs(self):
"""Extract INDRA ActiveForm Statements based on a mutation from BEL.
The SPARQL pattern used to extract ActiveForms due to mutations look
for a ProteinAbundance as a subject which has a child encoding the
amino acid substitution. The object of the statemen... | Extract INDRA ActiveForm Statements based on a mutation from BEL.
The SPARQL pattern used to extract ActiveForms due to mutations look
for a ProteinAbundance as a subject which has a child encoding the
amino acid substitution. The object of the statement is an
ActivityType of the same P... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L346-L421 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_activation | def get_activation(self):
"""Extract INDRA Inhibition/Activation Statements from BEL.
The SPARQL query used to extract Activation Statements looks for
patterns in which the subject is is an ActivityType
(of a ProtainAbundance) or an Abundance (of a small molecule).
The object ha... | python | def get_activation(self):
"""Extract INDRA Inhibition/Activation Statements from BEL.
The SPARQL query used to extract Activation Statements looks for
patterns in which the subject is is an ActivityType
(of a ProtainAbundance) or an Abundance (of a small molecule).
The object ha... | Extract INDRA Inhibition/Activation Statements from BEL.
The SPARQL query used to extract Activation Statements looks for
patterns in which the subject is is an ActivityType
(of a ProtainAbundance) or an Abundance (of a small molecule).
The object has to be the ActivityType (typically o... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L423-L524 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_transcription | def get_transcription(self):
"""Extract Increase/DecreaseAmount INDRA Statements from BEL.
Three distinct SPARQL patterns are used to extract amount
regulations from BEL.
- q_tscript1 searches for a subject which is a Transcription
ActivityType of a ProteinAbundance and an ob... | python | def get_transcription(self):
"""Extract Increase/DecreaseAmount INDRA Statements from BEL.
Three distinct SPARQL patterns are used to extract amount
regulations from BEL.
- q_tscript1 searches for a subject which is a Transcription
ActivityType of a ProteinAbundance and an ob... | Extract Increase/DecreaseAmount INDRA Statements from BEL.
Three distinct SPARQL patterns are used to extract amount
regulations from BEL.
- q_tscript1 searches for a subject which is a Transcription
ActivityType of a ProteinAbundance and an object which is
an RNAAbundance ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L526-L652 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_conversions | def get_conversions(self):
"""Extract Conversion INDRA Statements from BEL.
The SPARQL query used to extract Conversions searches for
a subject (controller) which is an AbundanceActivity
which directlyIncreases a Reaction with a given list of
Reactants and Products.
Ex... | python | def get_conversions(self):
"""Extract Conversion INDRA Statements from BEL.
The SPARQL query used to extract Conversions searches for
a subject (controller) which is an AbundanceActivity
which directlyIncreases a Reaction with a given list of
Reactants and Products.
Ex... | Extract Conversion INDRA Statements from BEL.
The SPARQL query used to extract Conversions searches for
a subject (controller) which is an AbundanceActivity
which directlyIncreases a Reaction with a given list of
Reactants and Products.
Examples:
catalyticActivity... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L654-L725 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_all_direct_statements | def get_all_direct_statements(self):
"""Get all directlyIncreases/Decreases BEL statements.
This method stores the results of the query in self.all_direct_stmts
as a list of strings. The SPARQL query used to find direct BEL
statements searches for all statements whose predicate is eithe... | python | def get_all_direct_statements(self):
"""Get all directlyIncreases/Decreases BEL statements.
This method stores the results of the query in self.all_direct_stmts
as a list of strings. The SPARQL query used to find direct BEL
statements searches for all statements whose predicate is eithe... | Get all directlyIncreases/Decreases BEL statements.
This method stores the results of the query in self.all_direct_stmts
as a list of strings. The SPARQL query used to find direct BEL
statements searches for all statements whose predicate is either
DirectyIncreases or DirectlyDecreases. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L727-L749 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_all_indirect_statements | def get_all_indirect_statements(self):
"""Get all indirect increases/decreases BEL statements.
This method stores the results of the query in self.all_indirect_stmts
as a list of strings. The SPARQL query used to find indirect BEL
statements searches for all statements whose predicate i... | python | def get_all_indirect_statements(self):
"""Get all indirect increases/decreases BEL statements.
This method stores the results of the query in self.all_indirect_stmts
as a list of strings. The SPARQL query used to find indirect BEL
statements searches for all statements whose predicate i... | Get all indirect increases/decreases BEL statements.
This method stores the results of the query in self.all_indirect_stmts
as a list of strings. The SPARQL query used to find indirect BEL
statements searches for all statements whose predicate is either
Increases or Decreases. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L751-L772 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.get_degenerate_statements | def get_degenerate_statements(self):
"""Get all degenerate BEL statements.
Stores the results of the query in self.degenerate_stmts.
"""
logger.info("Checking for 'degenerate' statements...\n")
# Get rules of type protein X -> activity Y
q_stmts = prefixes + """
... | python | def get_degenerate_statements(self):
"""Get all degenerate BEL statements.
Stores the results of the query in self.degenerate_stmts.
"""
logger.info("Checking for 'degenerate' statements...\n")
# Get rules of type protein X -> activity Y
q_stmts = prefixes + """
... | Get all degenerate BEL statements.
Stores the results of the query in self.degenerate_stmts. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L774-L827 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.print_statement_coverage | def print_statement_coverage(self):
"""Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted."""
if not self.all_direct_stmts:
self.get_all_direct_statements()
if not self.degenerate_stmts:
... | python | def print_statement_coverage(self):
"""Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted."""
if not self.all_direct_stmts:
self.get_all_direct_statements()
if not self.degenerate_stmts:
... | Display how many of the direct statements have been converted.
Also prints how many are considered 'degenerate' and not converted. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L829-L871 |
sorgerlab/indra | indra/sources/bel/rdf_processor.py | BelRdfProcessor.print_statements | def print_statements(self):
"""Print all extracted INDRA Statements."""
logger.info('--- Direct INDRA statements ----------')
for i, stmt in enumerate(self.statements):
logger.info("%s: %s" % (i, stmt))
logger.info('--- Indirect INDRA statements ----------')
for i, st... | python | def print_statements(self):
"""Print all extracted INDRA Statements."""
logger.info('--- Direct INDRA statements ----------')
for i, stmt in enumerate(self.statements):
logger.info("%s: %s" % (i, stmt))
logger.info('--- Indirect INDRA statements ----------')
for i, st... | Print all extracted INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/rdf_processor.py#L873-L880 |
sorgerlab/indra | indra/sources/medscan/api.py | process_directory_statements_sorted_by_pmid | def process_directory_statements_sorted_by_pmid(directory_name):
"""Processes a directory filled with CSXML files, first normalizing the
character encoding to utf-8, and then processing into INDRA statements
sorted by pmid.
Parameters
----------
directory_name : str
The name of a direct... | python | def process_directory_statements_sorted_by_pmid(directory_name):
"""Processes a directory filled with CSXML files, first normalizing the
character encoding to utf-8, and then processing into INDRA statements
sorted by pmid.
Parameters
----------
directory_name : str
The name of a direct... | Processes a directory filled with CSXML files, first normalizing the
character encoding to utf-8, and then processing into INDRA statements
sorted by pmid.
Parameters
----------
directory_name : str
The name of a directory filled with csxml files to process
Returns
-------
pmid... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/medscan/api.py#L9-L30 |
sorgerlab/indra | indra/sources/medscan/api.py | process_directory | def process_directory(directory_name, lazy=False):
"""Processes a directory filled with CSXML files, first normalizing the
character encodings to utf-8, and then processing into a list of INDRA
statements.
Parameters
----------
directory_name : str
The name of a directory filled with cs... | python | def process_directory(directory_name, lazy=False):
"""Processes a directory filled with CSXML files, first normalizing the
character encodings to utf-8, and then processing into a list of INDRA
statements.
Parameters
----------
directory_name : str
The name of a directory filled with cs... | Processes a directory filled with CSXML files, first normalizing the
character encodings to utf-8, and then processing into a list of INDRA
statements.
Parameters
----------
directory_name : str
The name of a directory filled with csxml files to process
lazy : bool
If True, the ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/medscan/api.py#L33-L58 |
sorgerlab/indra | indra/sources/medscan/api.py | process_file_sorted_by_pmid | def process_file_sorted_by_pmid(file_name):
"""Processes a file and returns a dictionary mapping pmids to a list of
statements corresponding to that pmid.
Parameters
----------
file_name : str
A csxml file to process
Returns
-------
s_dict : dict
Dictionary mapping pmid... | python | def process_file_sorted_by_pmid(file_name):
"""Processes a file and returns a dictionary mapping pmids to a list of
statements corresponding to that pmid.
Parameters
----------
file_name : str
A csxml file to process
Returns
-------
s_dict : dict
Dictionary mapping pmid... | Processes a file and returns a dictionary mapping pmids to a list of
statements corresponding to that pmid.
Parameters
----------
file_name : str
A csxml file to process
Returns
-------
s_dict : dict
Dictionary mapping pmids to a list of statements corresponding to
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/medscan/api.py#L61-L81 |
sorgerlab/indra | indra/sources/medscan/api.py | process_file | def process_file(filename, interval=None, lazy=False):
"""Process a CSXML file for its relevant information.
Consider running the fix_csxml_character_encoding.py script in
indra/sources/medscan to fix any encoding issues in the input file before
processing.
Attributes
----------
filename :... | python | def process_file(filename, interval=None, lazy=False):
"""Process a CSXML file for its relevant information.
Consider running the fix_csxml_character_encoding.py script in
indra/sources/medscan to fix any encoding issues in the input file before
processing.
Attributes
----------
filename :... | Process a CSXML file for its relevant information.
Consider running the fix_csxml_character_encoding.py script in
indra/sources/medscan to fix any encoding issues in the input file before
processing.
Attributes
----------
filename : str
The csxml file, containing Medscan XML, to proces... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/medscan/api.py#L84-L114 |
sorgerlab/indra | indra/explanation/reporting.py | stmts_from_path | def stmts_from_path(path, model, stmts):
"""Return source Statements corresponding to a path in a model.
Parameters
----------
path : list[tuple[str, int]]
A list of tuples where the first element of the tuple is the
name of a rule, and the second is the associated polarity along
... | python | def stmts_from_path(path, model, stmts):
"""Return source Statements corresponding to a path in a model.
Parameters
----------
path : list[tuple[str, int]]
A list of tuples where the first element of the tuple is the
name of a rule, and the second is the associated polarity along
... | Return source Statements corresponding to a path in a model.
Parameters
----------
path : list[tuple[str, int]]
A list of tuples where the first element of the tuple is the
name of a rule, and the second is the associated polarity along
a path.
model : pysb.core.Model
A ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/reporting.py#L3-L29 |
sorgerlab/indra | indra/sources/bel/processor.py | extract_context | def extract_context(annotations, annot_manager):
"""Return a BioContext object extracted from the annotations.
The entries that are extracted into the BioContext are popped from the
annotations.
Parameters
----------
annotations : dict
PyBEL annotations dict
annot_manager : Annotat... | python | def extract_context(annotations, annot_manager):
"""Return a BioContext object extracted from the annotations.
The entries that are extracted into the BioContext are popped from the
annotations.
Parameters
----------
annotations : dict
PyBEL annotations dict
annot_manager : Annotat... | Return a BioContext object extracted from the annotations.
The entries that are extracted into the BioContext are popped from the
annotations.
Parameters
----------
annotations : dict
PyBEL annotations dict
annot_manager : AnnotationManager
An annotation manager to get name/db ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/processor.py#L492-L549 |
sorgerlab/indra | indra/util/plot_formatting.py | format_axis | def format_axis(ax, label_padding=2, tick_padding=0, yticks_position='left'):
"""Set standardized axis formatting for figure."""
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position(yticks_position)
ax.yaxis.set_tick_params(which='both', direction='out', labelsize=fontsize,
... | python | def format_axis(ax, label_padding=2, tick_padding=0, yticks_position='left'):
"""Set standardized axis formatting for figure."""
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position(yticks_position)
ax.yaxis.set_tick_params(which='both', direction='out', labelsize=fontsize,
... | Set standardized axis formatting for figure. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/plot_formatting.py#L17-L28 |
sorgerlab/indra | indra/assemblers/html/assembler.py | tag_text | def tag_text(text, tag_info_list):
"""Apply start/end tags to spans of the given text.
Parameters
----------
text : str
Text to be tagged
tag_info_list : list of tuples
Each tuple refers to a span of the given text. Fields are `(start_ix,
end_ix, substring, start_tag, close... | python | def tag_text(text, tag_info_list):
"""Apply start/end tags to spans of the given text.
Parameters
----------
text : str
Text to be tagged
tag_info_list : list of tuples
Each tuple refers to a span of the given text. Fields are `(start_ix,
end_ix, substring, start_tag, close... | Apply start/end tags to spans of the given text.
Parameters
----------
text : str
Text to be tagged
tag_info_list : list of tuples
Each tuple refers to a span of the given text. Fields are `(start_ix,
end_ix, substring, start_tag, close_tag)`, where substring, start_tag,
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/html/assembler.py#L291-L346 |
sorgerlab/indra | indra/assemblers/html/assembler.py | HtmlAssembler.make_model | def make_model(self):
"""Return the assembled HTML content as a string.
Returns
-------
str
The assembled HTML as a string.
"""
stmts_formatted = []
stmt_rows = group_and_sort_statements(self.statements,
s... | python | def make_model(self):
"""Return the assembled HTML content as a string.
Returns
-------
str
The assembled HTML as a string.
"""
stmts_formatted = []
stmt_rows = group_and_sort_statements(self.statements,
s... | Return the assembled HTML content as a string.
Returns
-------
str
The assembled HTML as a string. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/html/assembler.py#L99-L142 |
sorgerlab/indra | indra/assemblers/html/assembler.py | HtmlAssembler.append_warning | def append_warning(self, msg):
"""Append a warning message to the model to expose issues."""
assert self.model is not None, "You must already have run make_model!"
addendum = ('\t<span style="color:red;">(CAUTION: %s occurred when '
'creating this page.)</span>' % msg)
... | python | def append_warning(self, msg):
"""Append a warning message to the model to expose issues."""
assert self.model is not None, "You must already have run make_model!"
addendum = ('\t<span style="color:red;">(CAUTION: %s occurred when '
'creating this page.)</span>' % msg)
... | Append a warning message to the model to expose issues. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/html/assembler.py#L144-L150 |
sorgerlab/indra | indra/assemblers/html/assembler.py | HtmlAssembler.save_model | def save_model(self, fname):
"""Save the assembled HTML into a file.
Parameters
----------
fname : str
The path to the file to save the HTML into.
"""
if self.model is None:
self.make_model()
with open(fname, 'wb') as fh:
fh.w... | python | def save_model(self, fname):
"""Save the assembled HTML into a file.
Parameters
----------
fname : str
The path to the file to save the HTML into.
"""
if self.model is None:
self.make_model()
with open(fname, 'wb') as fh:
fh.w... | Save the assembled HTML into a file.
Parameters
----------
fname : str
The path to the file to save the HTML into. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/html/assembler.py#L152-L164 |
sorgerlab/indra | indra/assemblers/html/assembler.py | HtmlAssembler._format_evidence_text | def _format_evidence_text(stmt):
"""Returns evidence metadata with highlighted evidence text.
Parameters
----------
stmt : indra.Statement
The Statement with Evidence to be formatted.
Returns
-------
list of dicts
List of dictionaries cor... | python | def _format_evidence_text(stmt):
"""Returns evidence metadata with highlighted evidence text.
Parameters
----------
stmt : indra.Statement
The Statement with Evidence to be formatted.
Returns
-------
list of dicts
List of dictionaries cor... | Returns evidence metadata with highlighted evidence text.
Parameters
----------
stmt : indra.Statement
The Statement with Evidence to be formatted.
Returns
-------
list of dicts
List of dictionaries corresponding to each Evidence object in the
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/html/assembler.py#L167-L241 |
sorgerlab/indra | indra/sources/reach/api.py | process_pmc | def process_pmc(pmc_id, offline=False, output_fname=default_output_fname):
"""Return a ReachProcessor by processing a paper with a given PMC id.
Uses the PMC client to obtain the full text. If it's not available,
None is returned.
Parameters
----------
pmc_id : str
The ID of a PubmedCe... | python | def process_pmc(pmc_id, offline=False, output_fname=default_output_fname):
"""Return a ReachProcessor by processing a paper with a given PMC id.
Uses the PMC client to obtain the full text. If it's not available,
None is returned.
Parameters
----------
pmc_id : str
The ID of a PubmedCe... | Return a ReachProcessor by processing a paper with a given PMC id.
Uses the PMC client to obtain the full text. If it's not available,
None is returned.
Parameters
----------
pmc_id : str
The ID of a PubmedCentral article. The string may start with PMC but
passing just the ID also ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L41-L74 |
sorgerlab/indra | indra/sources/reach/api.py | process_pubmed_abstract | def process_pubmed_abstract(pubmed_id, offline=False,
output_fname=default_output_fname, **kwargs):
"""Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
-----... | python | def process_pubmed_abstract(pubmed_id, offline=False,
output_fname=default_output_fname, **kwargs):
"""Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
-----... | Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
----------
pubmed_id : str
The ID of a Pubmed article. The string may start with PMID but
passing just the ID also works... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L77-L115 |
sorgerlab/indra | indra/sources/reach/api.py | process_text | def process_text(text, citation=None, offline=False,
output_fname=default_output_fname, timeout=None):
"""Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to ... | python | def process_text(text, citation=None, offline=False,
output_fname=default_output_fname, timeout=None):
"""Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to ... | Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to be used in the evidence for the extracted INDRA
Statements. This is used when the text to be processed comes from
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L118-L187 |
sorgerlab/indra | indra/sources/reach/api.py | process_nxml_str | def process_nxml_str(nxml_str, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : ... | python | def process_nxml_str(nxml_str, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : ... | Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : str
The NXML string to be processed.
citation : Optional[str]
A PubMed ID passed to be used in the eviden... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L190-L261 |
sorgerlab/indra | indra/sources/reach/api.py | process_nxml_file | def process_nxml_file(file_name, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name ... | python | def process_nxml_file(file_name, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name ... | Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name : str
The name of the NXML file to be processed.
citation : Optional[str]
A PubMed ID passed to be used in t... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L264-L293 |
sorgerlab/indra | indra/sources/reach/api.py | process_json_file | def process_json_file(file_name, citation=None):
"""Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: http... | python | def process_json_file(file_name, citation=None):
"""Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: http... | Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: https://github.com/clulab/reach
Parameters
--------... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L296-L322 |
sorgerlab/indra | indra/sources/reach/api.py | process_json_str | def process_json_str(json_str, citation=None):
"""Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
Th... | python | def process_json_str(json_str, citation=None):
"""Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
Th... | Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
The json string to be processed.
citation : Optional... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L325-L369 |
sorgerlab/indra | indra/tools/reading/wait_for_complete.py | make_parser | def make_parser():
"""Generate the parser for this script."""
parser = ArgumentParser(
'wait_for_complete.py',
usage='%(prog)s [-h] queue_name [options]',
description=('Wait for a set of batch jobs to complete, and monitor '
'them as they run.'),
epilog=('Job... | python | def make_parser():
"""Generate the parser for this script."""
parser = ArgumentParser(
'wait_for_complete.py',
usage='%(prog)s [-h] queue_name [options]',
description=('Wait for a set of batch jobs to complete, and monitor '
'them as they run.'),
epilog=('Job... | Generate the parser for this script. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/wait_for_complete.py#L4-L66 |
sorgerlab/indra | indra/literature/__init__.py | id_lookup | def id_lookup(paper_id, idtype):
"""Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.... | python | def id_lookup(paper_id, idtype):
"""Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.... | Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.
idtype : str
Type of the ID... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/__init__.py#L19-L71 |
sorgerlab/indra | indra/literature/__init__.py | get_full_text | def get_full_text(paper_id, idtype, preferred_content_type='text/xml'):
"""Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from P... | python | def get_full_text(paper_id, idtype, preferred_content_type='text/xml'):
"""Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from P... | Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from PubMed as a fallback.
Parameters
----------
paper_id : string
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/__init__.py#L74-L244 |
sorgerlab/indra | indra/sources/reach/reader.py | ReachReader.get_api_ruler | def get_api_ruler(self):
"""Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object).
"""
if self.api_ruler is None:
try:
... | python | def get_api_ruler(self):
"""Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object).
"""
if self.api_ruler is None:
try:
... | Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/reader.py#L55-L69 |
sorgerlab/indra | indra/sources/biogrid.py | _download_biogrid_data | def _download_biogrid_data(url):
"""Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipp... | python | def _download_biogrid_data(url):
"""Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipp... | Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipped). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L156-L185 |
sorgerlab/indra | indra/sources/biogrid.py | BiogridProcessor._make_agent | def _make_agent(self, entrez_id, text_id):
"""Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
... | python | def _make_agent(self, entrez_id, text_id):
"""Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
... | Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
agent : indra.statements.Agent
A grounded ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L97-L121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.