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/biogrid.py | BiogridProcessor._make_db_refs | def _make_db_refs(self, entrez_id, text_id):
"""Looks up the HGNC ID and name, as well as the Uniprot ID.
Parameters
----------
entrez_id : str
Entrez gene ID.
text_id : str or None
A plain text systematic name, or None if not listed in the
B... | python | def _make_db_refs(self, entrez_id, text_id):
"""Looks up the HGNC ID and name, as well as the Uniprot ID.
Parameters
----------
entrez_id : str
Entrez gene ID.
text_id : str or None
A plain text systematic name, or None if not listed in the
B... | Looks up the HGNC ID and name, as well as the Uniprot ID.
Parameters
----------
entrez_id : str
Entrez gene ID.
text_id : str or None
A plain text systematic name, or None if not listed in the
Biogrid data.
Returns
-------
hg... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L123-L153 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | KamiAssembler.make_model | def make_model(self, policies=None, initial_conditions=True,
reverse_effects=False):
"""Assemble the Kami model from the collected INDRA Statements.
This method assembles a Kami model from the set of INDRA Statements.
The assembled model is both returned and set as the assemb... | python | def make_model(self, policies=None, initial_conditions=True,
reverse_effects=False):
"""Assemble the Kami model from the collected INDRA Statements.
This method assembles a Kami model from the set of INDRA Statements.
The assembled model is both returned and set as the assemb... | Assemble the Kami model from the collected INDRA Statements.
This method assembles a Kami model from the set of INDRA Statements.
The assembled model is both returned and set as the assembler's
model argument.
Parameters
----------
policies : Optional[Union[str, dict]]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L24-L87 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | KamiAssembler._assemble | def _assemble(self):
"""Calls the appropriate assemble method based on policies."""
for stmt in self.statements:
if _is_whitelisted(stmt):
self._dispatch(stmt, 'assemble', self.model) | python | def _assemble(self):
"""Calls the appropriate assemble method based on policies."""
for stmt in self.statements:
if _is_whitelisted(stmt):
self._dispatch(stmt, 'assemble', self.model) | Calls the appropriate assemble method based on policies. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L89-L93 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | KamiAssembler._dispatch | def _dispatch(self, stmt, stage, *args):
"""Construct and call an assembly function.
This function constructs the name of the assembly function based on
the type of statement, the corresponding policy and the stage
of assembly. It then calls that function to perform the assembly
... | python | def _dispatch(self, stmt, stage, *args):
"""Construct and call an assembly function.
This function constructs the name of the assembly function based on
the type of statement, the corresponding policy and the stage
of assembly. It then calls that function to perform the assembly
... | Construct and call an assembly function.
This function constructs the name of the assembly function based on
the type of statement, the corresponding policy and the stage
of assembly. It then calls that function to perform the assembly
task. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L95-L120 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | Nugget.add_agent | def add_agent(self, agent):
"""Add an INDRA Agent and its conditions to the Nugget."""
agent_id = self.add_node(agent.name)
self.add_typing(agent_id, 'agent')
# Handle bound conditions
for bc in agent.bound_conditions:
# Here we make the assumption that the binding si... | python | def add_agent(self, agent):
"""Add an INDRA Agent and its conditions to the Nugget."""
agent_id = self.add_node(agent.name)
self.add_typing(agent_id, 'agent')
# Handle bound conditions
for bc in agent.bound_conditions:
# Here we make the assumption that the binding si... | Add an INDRA Agent and its conditions to the Nugget. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L134-L170 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | Nugget.add_node | def add_node(self, name_base, attrs=None):
"""Add a node with a given base name to the Nugget and return ID."""
if name_base not in self.counters:
node_id = name_base
else:
node_id = '%s_%d' % (name_base, self.counters[name_base])
node = {'id': node_id}
if... | python | def add_node(self, name_base, attrs=None):
"""Add a node with a given base name to the Nugget and return ID."""
if name_base not in self.counters:
node_id = name_base
else:
node_id = '%s_%d' % (name_base, self.counters[name_base])
node = {'id': node_id}
if... | Add a node with a given base name to the Nugget and return ID. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L172-L183 |
sorgerlab/indra | indra/assemblers/kami/assembler.py | Nugget.get_nugget_dict | def get_nugget_dict(self):
"""Return the Nugget as a dictionary."""
nugget_dict = \
{'id': self.id,
'graph': {
'nodes': self.nodes,
'edges': self.edges
},
'attrs': {
'name': self.name,
... | python | def get_nugget_dict(self):
"""Return the Nugget as a dictionary."""
nugget_dict = \
{'id': self.id,
'graph': {
'nodes': self.nodes,
'edges': self.edges
},
'attrs': {
'name': self.name,
... | Return the Nugget as a dictionary. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L193-L206 |
sorgerlab/indra | indra/sources/tees/api.py | process_text | def process_text(text, pmid=None, python2_path=None):
"""Processes the specified plain text with TEES and converts output to
supported INDRA statements. Check for the TEES installation is the
TEES_PATH environment variable, and configuration file; if not found,
checks candidate paths in tees_candidate_p... | python | def process_text(text, pmid=None, python2_path=None):
"""Processes the specified plain text with TEES and converts output to
supported INDRA statements. Check for the TEES installation is the
TEES_PATH environment variable, and configuration file; if not found,
checks candidate paths in tees_candidate_p... | Processes the specified plain text with TEES and converts output to
supported INDRA statements. Check for the TEES installation is the
TEES_PATH environment variable, and configuration file; if not found,
checks candidate paths in tees_candidate_paths. Raises an exception if
TEES cannot be found in any ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L46-L93 |
sorgerlab/indra | indra/sources/tees/api.py | run_on_text | def run_on_text(text, python2_path):
"""Runs TEES on the given text in a temporary directory and returns a
temporary directory with TEES output.
The caller should delete this directory when done with it. This function
runs TEES and produces TEES output files but does not process TEES output
int... | python | def run_on_text(text, python2_path):
"""Runs TEES on the given text in a temporary directory and returns a
temporary directory with TEES output.
The caller should delete this directory when done with it. This function
runs TEES and produces TEES output files but does not process TEES output
int... | Runs TEES on the given text in a temporary directory and returns a
temporary directory with TEES output.
The caller should delete this directory when done with it. This function
runs TEES and produces TEES output files but does not process TEES output
into INDRA statements.
Parameters
----... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L95-L206 |
sorgerlab/indra | indra/sources/tees/api.py | extract_output | def extract_output(output_dir):
"""Extract the text of the a1, a2, and sentence segmentation files from the
TEES output directory. These files are located within a compressed archive.
Parameters
----------
output_dir : str
Directory containing the output of the TEES system
Returns
... | python | def extract_output(output_dir):
"""Extract the text of the a1, a2, and sentence segmentation files from the
TEES output directory. These files are located within a compressed archive.
Parameters
----------
output_dir : str
Directory containing the output of the TEES system
Returns
... | Extract the text of the a1, a2, and sentence segmentation files from the
TEES output directory. These files are located within a compressed archive.
Parameters
----------
output_dir : str
Directory containing the output of the TEES system
Returns
-------
a1_text : str
The t... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L208-L312 |
sorgerlab/indra | indra/sources/eidos/reader.py | _list_to_seq | def _list_to_seq(lst):
"""Return a scala.collection.Seq from a Python list."""
ml = autoclass('scala.collection.mutable.MutableList')()
for element in lst:
ml.appendElem(element)
return ml | python | def _list_to_seq(lst):
"""Return a scala.collection.Seq from a Python list."""
ml = autoclass('scala.collection.mutable.MutableList')()
for element in lst:
ml.appendElem(element)
return ml | Return a scala.collection.Seq from a Python list. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/reader.py#L130-L135 |
sorgerlab/indra | indra/sources/eidos/reader.py | EidosReader.process_text | def process_text(self, text, format='json'):
"""Return a mentions JSON object given text.
Parameters
----------
text : str
Text to be processed.
format : str
The format of the output to produce, one of "json" or "json_ld".
Default: "json"
... | python | def process_text(self, text, format='json'):
"""Return a mentions JSON object given text.
Parameters
----------
text : str
Text to be processed.
format : str
The format of the output to produce, one of "json" or "json_ld".
Default: "json"
... | Return a mentions JSON object given text.
Parameters
----------
text : str
Text to be processed.
format : str
The format of the output to produce, one of "json" or "json_ld".
Default: "json"
Returns
-------
json_dict : dict
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/reader.py#L80-L127 |
sorgerlab/indra | indra/sources/eidos/api.py | process_text | def process_text(text, out_format='json_ld', save_json='eidos_output.json',
webservice=None):
"""Return an EidosProcessor by processing the given text.
This constructs a reader object via Java and extracts mentions
from the text. It then serializes the mentions into JSON and
processes ... | python | def process_text(text, out_format='json_ld', save_json='eidos_output.json',
webservice=None):
"""Return an EidosProcessor by processing the given text.
This constructs a reader object via Java and extracts mentions
from the text. It then serializes the mentions into JSON and
processes ... | Return an EidosProcessor by processing the given text.
This constructs a reader object via Java and extracts mentions
from the text. It then serializes the mentions into JSON and
processes the result with process_json.
Parameters
----------
text : str
The text to be processed.
out_... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L22-L62 |
sorgerlab/indra | indra/sources/eidos/api.py | process_json_file | def process_json_file(file_name):
"""Return an EidosProcessor by processing the given Eidos JSON-LD file.
This function is useful if the output from Eidos is saved as a file and
needs to be processed.
Parameters
----------
file_name : str
The name of the JSON-LD file to be processed.
... | python | def process_json_file(file_name):
"""Return an EidosProcessor by processing the given Eidos JSON-LD file.
This function is useful if the output from Eidos is saved as a file and
needs to be processed.
Parameters
----------
file_name : str
The name of the JSON-LD file to be processed.
... | Return an EidosProcessor by processing the given Eidos JSON-LD file.
This function is useful if the output from Eidos is saved as a file and
needs to be processed.
Parameters
----------
file_name : str
The name of the JSON-LD file to be processed.
Returns
-------
ep : EidosPro... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L65-L87 |
sorgerlab/indra | indra/sources/eidos/api.py | process_json | def process_json(json_dict):
"""Return an EidosProcessor by processing a Eidos JSON-LD dict.
Parameters
----------
json_dict : dict
The JSON-LD dict to be processed.
Returns
-------
ep : EidosProcessor
A EidosProcessor containing the extracted INDRA Statements
in it... | python | def process_json(json_dict):
"""Return an EidosProcessor by processing a Eidos JSON-LD dict.
Parameters
----------
json_dict : dict
The JSON-LD dict to be processed.
Returns
-------
ep : EidosProcessor
A EidosProcessor containing the extracted INDRA Statements
in it... | Return an EidosProcessor by processing a Eidos JSON-LD dict.
Parameters
----------
json_dict : dict
The JSON-LD dict to be processed.
Returns
-------
ep : EidosProcessor
A EidosProcessor containing the extracted INDRA Statements
in its statements attribute. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L108-L126 |
sorgerlab/indra | indra/databases/chembl_client.py | get_drug_inhibition_stmts | def get_drug_inhibition_stmts(drug):
"""Query ChEMBL for kinetics data given drug as Agent get back statements
Parameters
----------
drug : Agent
Agent representing drug with MESH or CHEBI grounding
Returns
-------
stmts : list of INDRA statements
INDRA statements generated... | python | def get_drug_inhibition_stmts(drug):
"""Query ChEMBL for kinetics data given drug as Agent get back statements
Parameters
----------
drug : Agent
Agent representing drug with MESH or CHEBI grounding
Returns
-------
stmts : list of INDRA statements
INDRA statements generated... | Query ChEMBL for kinetics data given drug as Agent get back statements
Parameters
----------
drug : Agent
Agent representing drug with MESH or CHEBI grounding
Returns
-------
stmts : list of INDRA statements
INDRA statements generated by querying ChEMBL for all kinetics data of... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L46-L102 |
sorgerlab/indra | indra/databases/chembl_client.py | send_query | def send_query(query_dict):
"""Query ChEMBL API
Parameters
----------
query_dict : dict
'query' : string of the endpoint to query
'params' : dict of params for the query
Returns
-------
js : dict
dict parsed from json that is unique to the submitted query
"""
... | python | def send_query(query_dict):
"""Query ChEMBL API
Parameters
----------
query_dict : dict
'query' : string of the endpoint to query
'params' : dict of params for the query
Returns
-------
js : dict
dict parsed from json that is unique to the submitted query
"""
... | Query ChEMBL API
Parameters
----------
query_dict : dict
'query' : string of the endpoint to query
'params' : dict of params for the query
Returns
-------
js : dict
dict parsed from json that is unique to the submitted query | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L105-L125 |
sorgerlab/indra | indra/databases/chembl_client.py | query_target | def query_target(target_chembl_id):
"""Query ChEMBL API target by id
Parameters
----------
target_chembl_id : str
Returns
-------
target : dict
dict parsed from json that is unique for the target
"""
query_dict = {'query': 'target',
'params': {'target_chem... | python | def query_target(target_chembl_id):
"""Query ChEMBL API target by id
Parameters
----------
target_chembl_id : str
Returns
-------
target : dict
dict parsed from json that is unique for the target
"""
query_dict = {'query': 'target',
'params': {'target_chem... | Query ChEMBL API target by id
Parameters
----------
target_chembl_id : str
Returns
-------
target : dict
dict parsed from json that is unique for the target | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L128-L145 |
sorgerlab/indra | indra/databases/chembl_client.py | activities_by_target | def activities_by_target(activities):
"""Get back lists of activities in a dict keyed by ChEMBL target id
Parameters
----------
activities : list
response from a query returning activities for a drug
Returns
-------
targ_act_dict : dict
dictionary keyed to ChEMBL target ids... | python | def activities_by_target(activities):
"""Get back lists of activities in a dict keyed by ChEMBL target id
Parameters
----------
activities : list
response from a query returning activities for a drug
Returns
-------
targ_act_dict : dict
dictionary keyed to ChEMBL target ids... | Get back lists of activities in a dict keyed by ChEMBL target id
Parameters
----------
activities : list
response from a query returning activities for a drug
Returns
-------
targ_act_dict : dict
dictionary keyed to ChEMBL target ids with lists of activity ids | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L148-L169 |
sorgerlab/indra | indra/databases/chembl_client.py | get_protein_targets_only | def get_protein_targets_only(target_chembl_ids):
"""Given list of ChEMBL target ids, return dict of SINGLE PROTEIN targets
Parameters
----------
target_chembl_ids : list
list of chembl_ids as strings
Returns
-------
protein_targets : dict
dictionary keyed to ChEMBL target i... | python | def get_protein_targets_only(target_chembl_ids):
"""Given list of ChEMBL target ids, return dict of SINGLE PROTEIN targets
Parameters
----------
target_chembl_ids : list
list of chembl_ids as strings
Returns
-------
protein_targets : dict
dictionary keyed to ChEMBL target i... | Given list of ChEMBL target ids, return dict of SINGLE PROTEIN targets
Parameters
----------
target_chembl_ids : list
list of chembl_ids as strings
Returns
-------
protein_targets : dict
dictionary keyed to ChEMBL target ids with lists of activity ids | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L172-L190 |
sorgerlab/indra | indra/databases/chembl_client.py | get_evidence | def get_evidence(assay):
"""Given an activity, return an INDRA Evidence object.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
ev : :py:class:`Evidence`
an :py:class:`Evidence` object containing the kin... | python | def get_evidence(assay):
"""Given an activity, return an INDRA Evidence object.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
ev : :py:class:`Evidence`
an :py:class:`Evidence` object containing the kin... | Given an activity, return an INDRA Evidence object.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
ev : :py:class:`Evidence`
an :py:class:`Evidence` object containing the kinetics of the | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L193-L215 |
sorgerlab/indra | indra/databases/chembl_client.py | get_kinetics | def get_kinetics(assay):
"""Given an activity, return its kinetics values.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
kin : dict
dictionary of values with units keyed to value types 'IC50', 'EC50',
... | python | def get_kinetics(assay):
"""Given an activity, return its kinetics values.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
kin : dict
dictionary of values with units keyed to value types 'IC50', 'EC50',
... | Given an activity, return its kinetics values.
Parameters
----------
assay : dict
an activity from the activities list returned by a query to the API
Returns
-------
kin : dict
dictionary of values with units keyed to value types 'IC50', 'EC50',
'INH', 'Potency', 'Kd' | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L218-L251 |
sorgerlab/indra | indra/databases/chembl_client.py | get_pmid | def get_pmid(doc_id):
"""Get PMID from document_chembl_id
Parameters
----------
doc_id : str
Returns
-------
pmid : str
"""
url_pmid = 'https://www.ebi.ac.uk/chembl/api/data/document.json'
params = {'document_chembl_id': doc_id}
res = requests.get(url_pmid, params=params)
... | python | def get_pmid(doc_id):
"""Get PMID from document_chembl_id
Parameters
----------
doc_id : str
Returns
-------
pmid : str
"""
url_pmid = 'https://www.ebi.ac.uk/chembl/api/data/document.json'
params = {'document_chembl_id': doc_id}
res = requests.get(url_pmid, params=params)
... | Get PMID from document_chembl_id
Parameters
----------
doc_id : str
Returns
-------
pmid : str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L254-L270 |
sorgerlab/indra | indra/databases/chembl_client.py | get_target_chemblid | def get_target_chemblid(target_upid):
"""Get ChEMBL ID from UniProt upid
Parameters
----------
target_upid : str
Returns
-------
target_chembl_id : str
"""
url = 'https://www.ebi.ac.uk/chembl/api/data/target.json'
params = {'target_components__accession': target_upid}
r = r... | python | def get_target_chemblid(target_upid):
"""Get ChEMBL ID from UniProt upid
Parameters
----------
target_upid : str
Returns
-------
target_chembl_id : str
"""
url = 'https://www.ebi.ac.uk/chembl/api/data/target.json'
params = {'target_components__accession': target_upid}
r = r... | Get ChEMBL ID from UniProt upid
Parameters
----------
target_upid : str
Returns
-------
target_chembl_id : str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L273-L290 |
sorgerlab/indra | indra/databases/chembl_client.py | get_mesh_id | def get_mesh_id(nlm_mesh):
"""Get MESH ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
mesh_id : str
"""
url_nlm2mesh = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi'
params = {'db': 'mesh', 'term': nlm_mesh, 'retmode': 'JSON'}
r = request... | python | def get_mesh_id(nlm_mesh):
"""Get MESH ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
mesh_id : str
"""
url_nlm2mesh = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi'
params = {'db': 'mesh', 'term': nlm_mesh, 'retmode': 'JSON'}
r = request... | Get MESH ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
mesh_id : str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L293-L309 |
sorgerlab/indra | indra/databases/chembl_client.py | get_pcid | def get_pcid(mesh_id):
"""Get PC ID from MESH ID
Parameters
----------
mesh : str
Returns
-------
pcid : str
"""
url_mesh2pcid = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi'
params = {'dbfrom': 'mesh', 'id': mesh_id,
'db': 'pccompound', 'retmode': 'JS... | python | def get_pcid(mesh_id):
"""Get PC ID from MESH ID
Parameters
----------
mesh : str
Returns
-------
pcid : str
"""
url_mesh2pcid = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi'
params = {'dbfrom': 'mesh', 'id': mesh_id,
'db': 'pccompound', 'retmode': 'JS... | Get PC ID from MESH ID
Parameters
----------
mesh : str
Returns
-------
pcid : str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L312-L329 |
sorgerlab/indra | indra/databases/chembl_client.py | get_chembl_id | def get_chembl_id(nlm_mesh):
"""Get ChEMBL ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
chembl_id : str
"""
mesh_id = get_mesh_id(nlm_mesh)
pcid = get_pcid(mesh_id)
url_mesh2pcid = 'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/' + \
... | python | def get_chembl_id(nlm_mesh):
"""Get ChEMBL ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
chembl_id : str
"""
mesh_id = get_mesh_id(nlm_mesh)
pcid = get_pcid(mesh_id)
url_mesh2pcid = 'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/' + \
... | Get ChEMBL ID from NLM MESH
Parameters
----------
nlm_mesh : str
Returns
-------
chembl_id : str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L332-L352 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.get_sentences | def get_sentences(self, root_element, block_tags):
"""Returns a list of plain-text sentences by iterating through
XML tags except for those listed in block_tags."""
sentences = []
for element in root_element:
if not self.any_ends_with(block_tags, element.tag):
... | python | def get_sentences(self, root_element, block_tags):
"""Returns a list of plain-text sentences by iterating through
XML tags except for those listed in block_tags."""
sentences = []
for element in root_element:
if not self.any_ends_with(block_tags, element.tag):
... | Returns a list of plain-text sentences by iterating through
XML tags except for those listed in block_tags. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L33-L49 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.any_ends_with | def any_ends_with(self, string_list, pattern):
"""Returns true iff one of the strings in string_list ends in
pattern."""
try:
s_base = basestring
except:
s_base = str
is_string = isinstance(pattern, s_base)
if not is_string:
return Fal... | python | def any_ends_with(self, string_list, pattern):
"""Returns true iff one of the strings in string_list ends in
pattern."""
try:
s_base = basestring
except:
s_base = str
is_string = isinstance(pattern, s_base)
if not is_string:
return Fal... | Returns true iff one of the strings in string_list ends in
pattern. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L51-L66 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.get_tag_names | def get_tag_names(self):
"""Returns the set of tag names present in the XML."""
root = etree.fromstring(self.xml_full_text.encode('utf-8'))
return self.get_children_tag_names(root) | python | def get_tag_names(self):
"""Returns the set of tag names present in the XML."""
root = etree.fromstring(self.xml_full_text.encode('utf-8'))
return self.get_children_tag_names(root) | Returns the set of tag names present in the XML. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L120-L123 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.get_children_tag_names | def get_children_tag_names(self, xml_element):
"""Returns all tag names of xml element and its children."""
tags = set()
tags.add(self.remove_namespace_from_tag(xml_element.tag))
for element in xml_element.iter(tag=etree.Element):
if element != xml_element:
n... | python | def get_children_tag_names(self, xml_element):
"""Returns all tag names of xml element and its children."""
tags = set()
tags.add(self.remove_namespace_from_tag(xml_element.tag))
for element in xml_element.iter(tag=etree.Element):
if element != xml_element:
n... | Returns all tag names of xml element and its children. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L125-L135 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.string_matches_sans_whitespace | def string_matches_sans_whitespace(self, str1, str2_fuzzy_whitespace):
"""Check if two strings match, modulo their whitespace."""
str2_fuzzy_whitespace = re.sub('\s+', '\s*', str2_fuzzy_whitespace)
return re.search(str2_fuzzy_whitespace, str1) is not None | python | def string_matches_sans_whitespace(self, str1, str2_fuzzy_whitespace):
"""Check if two strings match, modulo their whitespace."""
str2_fuzzy_whitespace = re.sub('\s+', '\s*', str2_fuzzy_whitespace)
return re.search(str2_fuzzy_whitespace, str1) is not None | Check if two strings match, modulo their whitespace. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L137-L140 |
sorgerlab/indra | indra/sources/geneways/find_full_text_sentence.py | FullTextMention.sentence_matches | def sentence_matches(self, sentence_text):
"""Returns true iff the sentence contains this mention's upstream
and downstream participants, and if one of the stemmed verbs in
the sentence is the same as the stemmed action type."""
has_upstream = False
has_downstream = False
... | python | def sentence_matches(self, sentence_text):
"""Returns true iff the sentence contains this mention's upstream
and downstream participants, and if one of the stemmed verbs in
the sentence is the same as the stemmed action type."""
has_upstream = False
has_downstream = False
... | Returns true iff the sentence contains this mention's upstream
and downstream participants, and if one of the stemmed verbs in
the sentence is the same as the stemmed action type. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L142-L169 |
sorgerlab/indra | indra/databases/__init__.py | get_identifiers_url | def get_identifiers_url(db_name, db_id):
"""Return an identifiers.org URL for a given database name and ID.
Parameters
----------
db_name : str
An internal database name: HGNC, UP, CHEBI, etc.
db_id : str
An identifier in the given database.
Returns
-------
url : str
... | python | def get_identifiers_url(db_name, db_id):
"""Return an identifiers.org URL for a given database name and ID.
Parameters
----------
db_name : str
An internal database name: HGNC, UP, CHEBI, etc.
db_id : str
An identifier in the given database.
Returns
-------
url : str
... | Return an identifiers.org URL for a given database name and ID.
Parameters
----------
db_name : str
An internal database name: HGNC, UP, CHEBI, etc.
db_id : str
An identifier in the given database.
Returns
-------
url : str
An identifiers.org URL corresponding to th... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/__init__.py#L6-L110 |
sorgerlab/indra | indra/tools/assemble_corpus.py | dump_statements | def dump_statements(stmts, fname, protocol=4):
"""Dump a list of statements into a pickle file.
Parameters
----------
fname : str
The name of the pickle file to dump statements into.
protocol : Optional[int]
The pickle protocol to use (use 2 for Python 2 compatibility).
Defa... | python | def dump_statements(stmts, fname, protocol=4):
"""Dump a list of statements into a pickle file.
Parameters
----------
fname : str
The name of the pickle file to dump statements into.
protocol : Optional[int]
The pickle protocol to use (use 2 for Python 2 compatibility).
Defa... | Dump a list of statements into a pickle file.
Parameters
----------
fname : str
The name of the pickle file to dump statements into.
protocol : Optional[int]
The pickle protocol to use (use 2 for Python 2 compatibility).
Default: 4 | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L27-L40 |
sorgerlab/indra | indra/tools/assemble_corpus.py | load_statements | def load_statements(fname, as_dict=False):
"""Load statements from a pickle file.
Parameters
----------
fname : str
The name of the pickle file to load statements from.
as_dict : Optional[bool]
If True and the pickle file contains a dictionary of statements, it
is returned a... | python | def load_statements(fname, as_dict=False):
"""Load statements from a pickle file.
Parameters
----------
fname : str
The name of the pickle file to load statements from.
as_dict : Optional[bool]
If True and the pickle file contains a dictionary of statements, it
is returned a... | Load statements from a pickle file.
Parameters
----------
fname : str
The name of the pickle file to load statements from.
as_dict : Optional[bool]
If True and the pickle file contains a dictionary of statements, it
is returned as a dictionary. If False, the statements are alway... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L43-L78 |
sorgerlab/indra | indra/tools/assemble_corpus.py | map_grounding | def map_grounding(stmts_in, **kwargs):
"""Map grounding using the GroundingMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_rename : Optional[bool]
If True, Agents are renamed based on their mapped grounding.
grounding_map... | python | def map_grounding(stmts_in, **kwargs):
"""Map grounding using the GroundingMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_rename : Optional[bool]
If True, Agents are renamed based on their mapped grounding.
grounding_map... | Map grounding using the GroundingMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_rename : Optional[bool]
If True, Agents are renamed based on their mapped grounding.
grounding_map : Optional[dict]
A user supplied grou... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L81-L119 |
sorgerlab/indra | indra/tools/assemble_corpus.py | merge_groundings | def merge_groundings(stmts_in):
"""Gather and merge original grounding information from evidences.
Each Statement's evidences are traversed to find original grounding
information. These groundings are then merged into an overall consensus
grounding dict with as much detail as possible.
The current... | python | def merge_groundings(stmts_in):
"""Gather and merge original grounding information from evidences.
Each Statement's evidences are traversed to find original grounding
information. These groundings are then merged into an overall consensus
grounding dict with as much detail as possible.
The current... | Gather and merge original grounding information from evidences.
Each Statement's evidences are traversed to find original grounding
information. These groundings are then merged into an overall consensus
grounding dict with as much detail as possible.
The current implementation is only applicable to S... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L122-L201 |
sorgerlab/indra | indra/tools/assemble_corpus.py | merge_deltas | def merge_deltas(stmts_in):
"""Gather and merge original Influence delta information from evidence.
This function is only applicable to Influence Statements that have
subj and obj deltas. All other statement types are passed through unchanged.
Polarities and adjectives for subjects and objects respect... | python | def merge_deltas(stmts_in):
"""Gather and merge original Influence delta information from evidence.
This function is only applicable to Influence Statements that have
subj and obj deltas. All other statement types are passed through unchanged.
Polarities and adjectives for subjects and objects respect... | Gather and merge original Influence delta information from evidence.
This function is only applicable to Influence Statements that have
subj and obj deltas. All other statement types are passed through unchanged.
Polarities and adjectives for subjects and objects respectivey are
collected and merged b... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L204-L272 |
sorgerlab/indra | indra/tools/assemble_corpus.py | map_sequence | def map_sequence(stmts_in, **kwargs):
"""Map sequences using the SiteMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_methionine_offset : boolean
Whether to check for off-by-one errors in site position (possibly)
attri... | python | def map_sequence(stmts_in, **kwargs):
"""Map sequences using the SiteMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_methionine_offset : boolean
Whether to check for off-by-one errors in site position (possibly)
attri... | Map sequences using the SiteMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_methionine_offset : boolean
Whether to check for off-by-one errors in site position (possibly)
attributable to site numbering from mature protein... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L275-L331 |
sorgerlab/indra | indra/tools/assemble_corpus.py | run_preassembly | def run_preassembly(stmts_in, **kwargs):
"""Run preassembly on a list of statements.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to preassemble.
return_toplevel : Optional[bool]
If True, only the top-level statements are returned. If False,... | python | def run_preassembly(stmts_in, **kwargs):
"""Run preassembly on a list of statements.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to preassemble.
return_toplevel : Optional[bool]
If True, only the top-level statements are returned. If False,... | Run preassembly on a list of statements.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to preassemble.
return_toplevel : Optional[bool]
If True, only the top-level statements are returned. If False,
all statements are returned irrespectiv... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L334-L398 |
sorgerlab/indra | indra/tools/assemble_corpus.py | run_preassembly_duplicate | def run_preassembly_duplicate(preassembler, beliefengine, **kwargs):
"""Run deduplication stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance
beliefengine : indra.belief.BeliefEngine
A BeliefEngin... | python | def run_preassembly_duplicate(preassembler, beliefengine, **kwargs):
"""Run deduplication stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance
beliefengine : indra.belief.BeliefEngine
A BeliefEngin... | Run deduplication stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance
beliefengine : indra.belief.BeliefEngine
A BeliefEngine instance.
save : Optional[str]
The name of a pickle file to sa... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L401-L426 |
sorgerlab/indra | indra/tools/assemble_corpus.py | run_preassembly_related | def run_preassembly_related(preassembler, beliefengine, **kwargs):
"""Run related stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance which already has a set of unique statements
internally.
belie... | python | def run_preassembly_related(preassembler, beliefengine, **kwargs):
"""Run related stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance which already has a set of unique statements
internally.
belie... | Run related stage of preassembly on a list of statements.
Parameters
----------
preassembler : indra.preassembler.Preassembler
A Preassembler instance which already has a set of unique statements
internally.
beliefengine : indra.belief.BeliefEngine
A BeliefEngine instance.
r... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L429-L499 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_by_type | def filter_by_type(stmts_in, stmt_type, **kwargs):
"""Filter to a given statement type.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
stmt_type : indra.statements.Statement
The class of the statement type to filter for.
Exa... | python | def filter_by_type(stmts_in, stmt_type, **kwargs):
"""Filter to a given statement type.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
stmt_type : indra.statements.Statement
The class of the statement type to filter for.
Exa... | Filter to a given statement type.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
stmt_type : indra.statements.Statement
The class of the statement type to filter for.
Example: indra.statements.Modification
invert : Optional[... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L502-L536 |
sorgerlab/indra | indra/tools/assemble_corpus.py | _remove_bound_conditions | def _remove_bound_conditions(agent, keep_criterion):
"""Removes bound conditions of agent such that keep_criterion is False.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
keep_criterion: function
Evaluates removal_criterion(a) for each agent a in a ... | python | def _remove_bound_conditions(agent, keep_criterion):
"""Removes bound conditions of agent such that keep_criterion is False.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
keep_criterion: function
Evaluates removal_criterion(a) for each agent a in a ... | Removes bound conditions of agent such that keep_criterion is False.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
keep_criterion: function
Evaluates removal_criterion(a) for each agent a in a bound condition
and if it evaluates to False, remove... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L566-L581 |
sorgerlab/indra | indra/tools/assemble_corpus.py | _any_bound_condition_fails_criterion | def _any_bound_condition_fails_criterion(agent, criterion):
"""Returns True if any bound condition fails to meet the specified
criterion.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
criterion: function
Evaluates criterion(a) for each a in a bo... | python | def _any_bound_condition_fails_criterion(agent, criterion):
"""Returns True if any bound condition fails to meet the specified
criterion.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
criterion: function
Evaluates criterion(a) for each a in a bo... | Returns True if any bound condition fails to meet the specified
criterion.
Parameters
----------
agent: Agent
The agent whose bound conditions we evaluate
criterion: function
Evaluates criterion(a) for each a in a bound condition and returns True
if any agents fail to meet t... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L584-L606 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_grounded_only | def filter_grounded_only(stmts_in, **kwargs):
"""Filter to statements that have grounded agents.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
score_threshold : Optional[float]
If scored groundings are available in a list and the h... | python | def filter_grounded_only(stmts_in, **kwargs):
"""Filter to statements that have grounded agents.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
score_threshold : Optional[float]
If scored groundings are available in a list and the h... | Filter to statements that have grounded agents.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
score_threshold : Optional[float]
If scored groundings are available in a list and the highest score
if below this threshold, the Sta... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L609-L658 |
sorgerlab/indra | indra/tools/assemble_corpus.py | _agent_is_gene | def _agent_is_gene(agent, specific_only):
"""Returns whether an agent is for a gene.
Parameters
----------
agent: Agent
The agent to evaluate
specific_only : Optional[bool]
If True, only elementary genes/proteins evaluate as genes and families
will be filtered out. If False,... | python | def _agent_is_gene(agent, specific_only):
"""Returns whether an agent is for a gene.
Parameters
----------
agent: Agent
The agent to evaluate
specific_only : Optional[bool]
If True, only elementary genes/proteins evaluate as genes and families
will be filtered out. If False,... | Returns whether an agent is for a gene.
Parameters
----------
agent: Agent
The agent to evaluate
specific_only : Optional[bool]
If True, only elementary genes/proteins evaluate as genes and families
will be filtered out. If False, families are also included.
Returns
---... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L661-L686 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_genes_only | def filter_genes_only(stmts_in, **kwargs):
"""Filter to statements containing genes only.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
specific_only : Optional[bool]
If True, only elementary genes/proteins will be kept and familie... | python | def filter_genes_only(stmts_in, **kwargs):
"""Filter to statements containing genes only.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
specific_only : Optional[bool]
If True, only elementary genes/proteins will be kept and familie... | Filter to statements containing genes only.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
specific_only : Optional[bool]
If True, only elementary genes/proteins will be kept and families
will be filtered out. If False, families... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L689-L739 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_belief | def filter_belief(stmts_in, belief_cutoff, **kwargs):
"""Filter to statements with belief above a given cutoff.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
belief_cutoff : float
Only statements with belief above the belief_cutoff... | python | def filter_belief(stmts_in, belief_cutoff, **kwargs):
"""Filter to statements with belief above a given cutoff.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
belief_cutoff : float
Only statements with belief above the belief_cutoff... | Filter to statements with belief above a given cutoff.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
belief_cutoff : float
Only statements with belief above the belief_cutoff will be returned.
Here 0 < belief_cutoff < 1.
sa... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L742-L783 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_gene_list | def filter_gene_list(stmts_in, gene_list, policy, allow_families=False,
**kwargs):
"""Return statements that contain genes given in a list.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
gene_list : list[str]
A ... | python | def filter_gene_list(stmts_in, gene_list, policy, allow_families=False,
**kwargs):
"""Return statements that contain genes given in a list.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
gene_list : list[str]
A ... | Return statements that contain genes given in a list.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
gene_list : list[str]
A list of gene symbols to filter for.
policy : str
The policy to apply when filtering for the list of... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L786-L890 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_concept_names | def filter_concept_names(stmts_in, name_list, policy, **kwargs):
"""Return Statements that refer to concepts/agents given as a list of names.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of Statements to filter.
name_list : list[str]
A list of concept/age... | python | def filter_concept_names(stmts_in, name_list, policy, **kwargs):
"""Return Statements that refer to concepts/agents given as a list of names.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of Statements to filter.
name_list : list[str]
A list of concept/age... | Return Statements that refer to concepts/agents given as a list of names.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of Statements to filter.
name_list : list[str]
A list of concept/agent names to filter for.
policy : str
The policy to apply whe... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L893-L959 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_by_db_refs | def filter_by_db_refs(stmts_in, namespace, values, policy, **kwargs):
"""Filter to Statements whose agents are grounded to a matching entry.
Statements are filtered so that the db_refs entry (of the given namespace)
of their Agent/Concept arguments take a value in the given list of values.
Parameters
... | python | def filter_by_db_refs(stmts_in, namespace, values, policy, **kwargs):
"""Filter to Statements whose agents are grounded to a matching entry.
Statements are filtered so that the db_refs entry (of the given namespace)
of their Agent/Concept arguments take a value in the given list of values.
Parameters
... | Filter to Statements whose agents are grounded to a matching entry.
Statements are filtered so that the db_refs entry (of the given namespace)
of their Agent/Concept arguments take a value in the given list of values.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L962-L1039 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_human_only | def filter_human_only(stmts_in, **kwargs):
"""Filter out statements that are grounded, but not to a human gene.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts... | python | def filter_human_only(stmts_in, **kwargs):
"""Filter out statements that are grounded, but not to a human gene.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts... | Filter out statements that are grounded, but not to a human gene.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
remove_bound: Optional[bool]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1042-L1097 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_direct | def filter_direct(stmts_in, **kwargs):
"""Filter to statements that are direct interactions
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Ret... | python | def filter_direct(stmts_in, **kwargs):
"""Filter to statements that are direct interactions
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Ret... | Filter to statements that are direct interactions
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stmts_out : list[indra.st... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1100-L1144 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_no_hypothesis | def filter_no_hypothesis(stmts_in, **kwargs):
"""Filter to statements that are not marked as hypothesis in epistemics.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results... | python | def filter_no_hypothesis(stmts_in, **kwargs):
"""Filter to statements that are not marked as hypothesis in epistemics.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results... | Filter to statements that are not marked as hypothesis in epistemics.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stmts... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1147-L1179 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_evidence_source | def filter_evidence_source(stmts_in, source_apis, policy='one', **kwargs):
"""Filter to statements that have evidence from a given set of sources.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
source_apis : list[str]
A list of sour... | python | def filter_evidence_source(stmts_in, source_apis, policy='one', **kwargs):
"""Filter to statements that have evidence from a given set of sources.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
source_apis : list[str]
A list of sour... | Filter to statements that have evidence from a given set of sources.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
source_apis : list[str]
A list of sources to filter for. Examples: biopax, bel, reach
policy : Optional[str]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1217-L1258 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_top_level | def filter_top_level(stmts_in, **kwargs):
"""Filter to statements that are at the top-level of the hierarchy.
Here top-level statements correspond to most specific ones.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[st... | python | def filter_top_level(stmts_in, **kwargs):
"""Filter to statements that are at the top-level of the hierarchy.
Here top-level statements correspond to most specific ones.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[st... | Filter to statements that are at the top-level of the hierarchy.
Here top-level statements correspond to most specific ones.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1261-L1284 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_inconsequential_mods | def filter_inconsequential_mods(stmts_in, whitelist=None, **kwargs):
"""Filter out Modifications that modify inconsequential sites
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific sites should be
preserved, for instance, to be used as rea... | python | def filter_inconsequential_mods(stmts_in, whitelist=None, **kwargs):
"""Filter out Modifications that modify inconsequential sites
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific sites should be
preserved, for instance, to be used as rea... | Filter out Modifications that modify inconsequential sites
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific sites should be
preserved, for instance, to be used as readouts in a model.
In this case, the given sites can be passed in a white... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1287-L1348 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_inconsequential_acts | def filter_inconsequential_acts(stmts_in, whitelist=None, **kwargs):
"""Filter out Activations that modify inconsequential activities
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific activity types should be
preserved, for instance, to be... | python | def filter_inconsequential_acts(stmts_in, whitelist=None, **kwargs):
"""Filter out Activations that modify inconsequential activities
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific activity types should be
preserved, for instance, to be... | Filter out Activations that modify inconsequential activities
Inconsequential here means that the site is not mentioned / tested
in any other statement. In some cases specific activity types should be
preserved, for instance, to be used as readouts in a model.
In this case, the given activities can be ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1351-L1406 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_mutation_status | def filter_mutation_status(stmts_in, mutations, deletions, **kwargs):
"""Filter statements based on existing mutations/deletions
This filter helps to contextualize a set of statements to a given
cell type. Given a list of deleted genes, it removes statements that refer
to these genes. It also takes a l... | python | def filter_mutation_status(stmts_in, mutations, deletions, **kwargs):
"""Filter statements based on existing mutations/deletions
This filter helps to contextualize a set of statements to a given
cell type. Given a list of deleted genes, it removes statements that refer
to these genes. It also takes a l... | Filter statements based on existing mutations/deletions
This filter helps to contextualize a set of statements to a given
cell type. Given a list of deleted genes, it removes statements that refer
to these genes. It also takes a list of mutations and removes statements
that refer to mutations not relev... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1439-L1503 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_enzyme_kinase | def filter_enzyme_kinase(stmts_in, **kwargs):
"""Filter Phosphorylations to ones where the enzyme is a known kinase.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (... | python | def filter_enzyme_kinase(stmts_in, **kwargs):
"""Filter Phosphorylations to ones where the enzyme is a known kinase.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (... | Filter Phosphorylations to ones where the enzyme is a known kinase.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stmts_o... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1506-L1539 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_transcription_factor | def filter_transcription_factor(stmts_in, **kwargs):
"""Filter out RegulateAmounts where subject is not a transcription factor.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save th... | python | def filter_transcription_factor(stmts_in, **kwargs):
"""Filter out RegulateAmounts where subject is not a transcription factor.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save th... | Filter out RegulateAmounts where subject is not a transcription factor.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stm... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1579-L1612 |
sorgerlab/indra | indra/tools/assemble_corpus.py | filter_uuid_list | def filter_uuid_list(stmts_in, uuids, **kwargs):
"""Filter to Statements corresponding to given UUIDs
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
uuids : list[str]
A list of UUIDs to filter for.
save : Optional[str]
T... | python | def filter_uuid_list(stmts_in, uuids, **kwargs):
"""Filter to Statements corresponding to given UUIDs
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
uuids : list[str]
A list of UUIDs to filter for.
save : Optional[str]
T... | Filter to Statements corresponding to given UUIDs
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
uuids : list[str]
A list of UUIDs to filter for.
save : Optional[str]
The name of a pickle file to save the results (stmts_out)... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1615-L1651 |
sorgerlab/indra | indra/tools/assemble_corpus.py | expand_families | def expand_families(stmts_in, **kwargs):
"""Expand FamPlex Agents to individual genes.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to expand.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
... | python | def expand_families(stmts_in, **kwargs):
"""Expand FamPlex Agents to individual genes.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to expand.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
... | Expand FamPlex Agents to individual genes.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to expand.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stmts_out : list[indra.statement... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1654-L1677 |
sorgerlab/indra | indra/tools/assemble_corpus.py | reduce_activities | def reduce_activities(stmts_in, **kwargs):
"""Reduce the activity types in a list of statements
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to reduce activity types in.
save : Optional[str]
The name of a pickle file to save the results (stm... | python | def reduce_activities(stmts_in, **kwargs):
"""Reduce the activity types in a list of statements
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to reduce activity types in.
save : Optional[str]
The name of a pickle file to save the results (stm... | Reduce the activity types in a list of statements
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to reduce activity types in.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------
stmts_o... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1680-L1704 |
sorgerlab/indra | indra/tools/assemble_corpus.py | strip_agent_context | def strip_agent_context(stmts_in, **kwargs):
"""Strip any context on agents within each statement.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements whose agent context should be stripped.
save : Optional[str]
The name of a pickle file to save th... | python | def strip_agent_context(stmts_in, **kwargs):
"""Strip any context on agents within each statement.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements whose agent context should be stripped.
save : Optional[str]
The name of a pickle file to save th... | Strip any context on agents within each statement.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements whose agent context should be stripped.
save : Optional[str]
The name of a pickle file to save the results (stmts_out) into.
Returns
-------... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1707-L1738 |
sorgerlab/indra | indra/tools/assemble_corpus.py | standardize_names_groundings | def standardize_names_groundings(stmts):
"""Standardize the names of Concepts with respect to an ontology.
NOTE: this function is currently optimized for Influence Statements
obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield
unexpected results for biology-specific Statements.
"""
... | python | def standardize_names_groundings(stmts):
"""Standardize the names of Concepts with respect to an ontology.
NOTE: this function is currently optimized for Influence Statements
obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield
unexpected results for biology-specific Statements.
"""
... | Standardize the names of Concepts with respect to an ontology.
NOTE: this function is currently optimized for Influence Statements
obtained from Eidos, Hume, Sofia and CWMS. It will possibly yield
unexpected results for biology-specific Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1741-L1762 |
sorgerlab/indra | indra/tools/assemble_corpus.py | dump_stmt_strings | def dump_stmt_strings(stmts, fname):
"""Save printed statements in a file.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to save in a text file.
fname : Optional[str]
The name of a text file to save the printed statements into.
"""
wi... | python | def dump_stmt_strings(stmts, fname):
"""Save printed statements in a file.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to save in a text file.
fname : Optional[str]
The name of a text file to save the printed statements into.
"""
wi... | Save printed statements in a file.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to save in a text file.
fname : Optional[str]
The name of a text file to save the printed statements into. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1765-L1777 |
sorgerlab/indra | indra/tools/assemble_corpus.py | rename_db_ref | def rename_db_ref(stmts_in, ns_from, ns_to, **kwargs):
"""Rename an entry in the db_refs of each Agent.
This is particularly useful when old Statements in pickle files
need to be updated after a namespace was changed such as
'BE' to 'FPLX'.
Parameters
----------
stmts_in : list[indra.state... | python | def rename_db_ref(stmts_in, ns_from, ns_to, **kwargs):
"""Rename an entry in the db_refs of each Agent.
This is particularly useful when old Statements in pickle files
need to be updated after a namespace was changed such as
'BE' to 'FPLX'.
Parameters
----------
stmts_in : list[indra.state... | Rename an entry in the db_refs of each Agent.
This is particularly useful when old Statements in pickle files
need to be updated after a namespace was changed such as
'BE' to 'FPLX'.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements whose Agents' db... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1780-L1813 |
sorgerlab/indra | indra/tools/assemble_corpus.py | align_statements | def align_statements(stmts1, stmts2, keyfun=None):
"""Return alignment of two lists of statements by key.
Parameters
----------
stmts1 : list[indra.statements.Statement]
A list of INDRA Statements to align
stmts2 : list[indra.statements.Statement]
A list of INDRA Statements to align... | python | def align_statements(stmts1, stmts2, keyfun=None):
"""Return alignment of two lists of statements by key.
Parameters
----------
stmts1 : list[indra.statements.Statement]
A list of INDRA Statements to align
stmts2 : list[indra.statements.Statement]
A list of INDRA Statements to align... | Return alignment of two lists of statements by key.
Parameters
----------
stmts1 : list[indra.statements.Statement]
A list of INDRA Statements to align
stmts2 : list[indra.statements.Statement]
A list of INDRA Statements to align
keyfun : Optional[function]
A function that t... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1816-L1860 |
sorgerlab/indra | indra/sources/indra_db_rest/util.py | submit_query_request | def submit_query_request(end_point, *args, **kwargs):
"""Low level function to format the query string."""
ev_limit = kwargs.pop('ev_limit', 10)
best_first = kwargs.pop('best_first', True)
tries = kwargs.pop('tries', 2)
# This isn't handled by requests because of the multiple identical agent
# k... | python | def submit_query_request(end_point, *args, **kwargs):
"""Low level function to format the query string."""
ev_limit = kwargs.pop('ev_limit', 10)
best_first = kwargs.pop('best_first', True)
tries = kwargs.pop('tries', 2)
# This isn't handled by requests because of the multiple identical agent
# k... | Low level function to format the query string. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/util.py#L11-L26 |
sorgerlab/indra | indra/sources/indra_db_rest/util.py | submit_statement_request | def submit_statement_request(meth, end_point, query_str='', data=None,
tries=2, **params):
"""Even lower level function to make the request."""
full_end_point = 'statements/' + end_point.lstrip('/')
return make_db_rest_request(meth, full_end_point, query_str, data, params, tries... | python | def submit_statement_request(meth, end_point, query_str='', data=None,
tries=2, **params):
"""Even lower level function to make the request."""
full_end_point = 'statements/' + end_point.lstrip('/')
return make_db_rest_request(meth, full_end_point, query_str, data, params, tries... | Even lower level function to make the request. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/util.py#L29-L33 |
sorgerlab/indra | indra/preassembler/__init__.py | render_stmt_graph | def render_stmt_graph(statements, reduce=True, english=False, rankdir=None,
agent_style=None):
"""Render the statement hierarchy as a pygraphviz graph.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associat... | python | def render_stmt_graph(statements, reduce=True, english=False, rankdir=None,
agent_style=None):
"""Render the statement hierarchy as a pygraphviz graph.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associat... | Render the statement hierarchy as a pygraphviz graph.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associated supporting statements
resulting from building a statement hierarchy with
:py:meth:`combine_related`.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L646-L752 |
sorgerlab/indra | indra/preassembler/__init__.py | flatten_stmts | def flatten_stmts(stmts):
"""Return the full set of unique stms in a pre-assembled stmt graph.
The flattened list of statements returned by this function can be
compared to the original set of unique statements to make sure no
statements have been lost during the preassembly process.
Parameters
... | python | def flatten_stmts(stmts):
"""Return the full set of unique stms in a pre-assembled stmt graph.
The flattened list of statements returned by this function can be
compared to the original set of unique statements to make sure no
statements have been lost during the preassembly process.
Parameters
... | Return the full set of unique stms in a pre-assembled stmt graph.
The flattened list of statements returned by this function can be
compared to the original set of unique statements to make sure no
statements have been lost during the preassembly process.
Parameters
----------
stmts : list of ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L755-L797 |
sorgerlab/indra | indra/preassembler/__init__.py | flatten_evidence | def flatten_evidence(stmts, collect_from=None):
"""Add evidence from *supporting* stmts to evidence for *supported* stmts.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associated supporting statements
resulting from bui... | python | def flatten_evidence(stmts, collect_from=None):
"""Add evidence from *supporting* stmts to evidence for *supported* stmts.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associated supporting statements
resulting from bui... | Add evidence from *supporting* stmts to evidence for *supported* stmts.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
A list of top-level statements with associated supporting statements
resulting from building a statement hierarchy with
:py:meth:`comb... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L800-L872 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler.combine_duplicates | def combine_duplicates(self):
"""Combine duplicates among `stmts` and save result in `unique_stmts`.
A wrapper around the static method :py:meth:`combine_duplicate_stmts`.
"""
if self.unique_stmts is None:
self.unique_stmts = self.combine_duplicate_stmts(self.stmts)
... | python | def combine_duplicates(self):
"""Combine duplicates among `stmts` and save result in `unique_stmts`.
A wrapper around the static method :py:meth:`combine_duplicate_stmts`.
"""
if self.unique_stmts is None:
self.unique_stmts = self.combine_duplicate_stmts(self.stmts)
... | Combine duplicates among `stmts` and save result in `unique_stmts`.
A wrapper around the static method :py:meth:`combine_duplicate_stmts`. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L68-L75 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler._get_stmt_matching_groups | def _get_stmt_matching_groups(stmts):
"""Use the matches_key method to get sets of matching statements."""
def match_func(x): return x.matches_key()
# Remove exact duplicates using a set() call, then make copies:
logger.debug('%d statements before removing object duplicates.' %
... | python | def _get_stmt_matching_groups(stmts):
"""Use the matches_key method to get sets of matching statements."""
def match_func(x): return x.matches_key()
# Remove exact duplicates using a set() call, then make copies:
logger.debug('%d statements before removing object duplicates.' %
... | Use the matches_key method to get sets of matching statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L78-L93 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler.combine_duplicate_stmts | def combine_duplicate_stmts(stmts):
"""Combine evidence from duplicate Statements.
Statements are deemed to be duplicates if they have the same key
returned by the `matches_key()` method of the Statement class. This
generally means that statements must be identical in terms of their
... | python | def combine_duplicate_stmts(stmts):
"""Combine evidence from duplicate Statements.
Statements are deemed to be duplicates if they have the same key
returned by the `matches_key()` method of the Statement class. This
generally means that statements must be identical in terms of their
... | Combine evidence from duplicate Statements.
Statements are deemed to be duplicates if they have the same key
returned by the `matches_key()` method of the Statement class. This
generally means that statements must be identical in terms of their
arguments and can differ only in their ass... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L96-L186 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler._get_stmt_by_group | def _get_stmt_by_group(self, stmt_type, stmts_this_type, eh):
"""Group Statements of `stmt_type` by their hierarchical relations."""
# Dict of stmt group key tuples, indexed by their first Agent
stmt_by_first = collections.defaultdict(lambda: [])
# Dict of stmt group key tuples, indexed ... | python | def _get_stmt_by_group(self, stmt_type, stmts_this_type, eh):
"""Group Statements of `stmt_type` by their hierarchical relations."""
# Dict of stmt group key tuples, indexed by their first Agent
stmt_by_first = collections.defaultdict(lambda: [])
# Dict of stmt group key tuples, indexed ... | Group Statements of `stmt_type` by their hierarchical relations. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L220-L326 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler._generate_id_maps | def _generate_id_maps(self, unique_stmts, poolsize=None,
size_cutoff=100, split_idx=None):
"""Connect statements using their refinement relationships."""
# Check arguments relating to multiprocessing
if poolsize is None:
logger.debug('combine_related: poolsi... | python | def _generate_id_maps(self, unique_stmts, poolsize=None,
size_cutoff=100, split_idx=None):
"""Connect statements using their refinement relationships."""
# Check arguments relating to multiprocessing
if poolsize is None:
logger.debug('combine_related: poolsi... | Connect statements using their refinement relationships. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L328-L426 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler.combine_related | def combine_related(self, return_toplevel=True, poolsize=None,
size_cutoff=100):
"""Connect related statements based on their refinement relationships.
This function takes as a starting point the unique statements (with
duplicates removed) and returns a modified flat lis... | python | def combine_related(self, return_toplevel=True, poolsize=None,
size_cutoff=100):
"""Connect related statements based on their refinement relationships.
This function takes as a starting point the unique statements (with
duplicates removed) and returns a modified flat lis... | Connect related statements based on their refinement relationships.
This function takes as a starting point the unique statements (with
duplicates removed) and returns a modified flat list of statements
containing only those statements which do not represent a refinement of
other existi... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L428-L563 |
sorgerlab/indra | indra/preassembler/__init__.py | Preassembler.find_contradicts | def find_contradicts(self):
"""Return pairs of contradicting Statements.
Returns
-------
contradicts : list(tuple(Statement, Statement))
A list of Statement pairs that are contradicting.
"""
eh = self.hierarchies['entity']
# Make a dict of Statement ... | python | def find_contradicts(self):
"""Return pairs of contradicting Statements.
Returns
-------
contradicts : list(tuple(Statement, Statement))
A list of Statement pairs that are contradicting.
"""
eh = self.hierarchies['entity']
# Make a dict of Statement ... | Return pairs of contradicting Statements.
Returns
-------
contradicts : list(tuple(Statement, Statement))
A list of Statement pairs that are contradicting. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L565-L608 |
sorgerlab/indra | indra/literature/deft_tools.py | get_text_content_for_pmids | def get_text_content_for_pmids(pmids):
"""Get text content for articles given a list of their pmids
Parameters
----------
pmids : list of str
Returns
-------
text_content : list of str
"""
pmc_pmids = set(pmc_client.filter_pmids(pmids, source_type='fulltext'))
pmc_ids = []
... | python | def get_text_content_for_pmids(pmids):
"""Get text content for articles given a list of their pmids
Parameters
----------
pmids : list of str
Returns
-------
text_content : list of str
"""
pmc_pmids = set(pmc_client.filter_pmids(pmids, source_type='fulltext'))
pmc_ids = []
... | Get text content for articles given a list of their pmids
Parameters
----------
pmids : list of str
Returns
-------
text_content : list of str | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L46-L84 |
sorgerlab/indra | indra/literature/deft_tools.py | universal_extract_paragraphs | def universal_extract_paragraphs(xml):
"""Extract paragraphs from xml that could be from different sources
First try to parse the xml as if it came from elsevier. if we do not
have valid elsevier xml this will throw an exception. the text extraction
function in the pmc client may not throw an exceptio... | python | def universal_extract_paragraphs(xml):
"""Extract paragraphs from xml that could be from different sources
First try to parse the xml as if it came from elsevier. if we do not
have valid elsevier xml this will throw an exception. the text extraction
function in the pmc client may not throw an exceptio... | Extract paragraphs from xml that could be from different sources
First try to parse the xml as if it came from elsevier. if we do not
have valid elsevier xml this will throw an exception. the text extraction
function in the pmc client may not throw an exception when parsing elsevier
xml, silently proc... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L87-L114 |
sorgerlab/indra | indra/literature/deft_tools.py | filter_paragraphs | def filter_paragraphs(paragraphs, contains=None):
"""Filter paragraphs to only those containing one of a list of strings
Parameters
----------
paragraphs : list of str
List of plaintext paragraphs from an article
contains : str or list of str
Exclude paragraphs not containing this ... | python | def filter_paragraphs(paragraphs, contains=None):
"""Filter paragraphs to only those containing one of a list of strings
Parameters
----------
paragraphs : list of str
List of plaintext paragraphs from an article
contains : str or list of str
Exclude paragraphs not containing this ... | Filter paragraphs to only those containing one of a list of strings
Parameters
----------
paragraphs : list of str
List of plaintext paragraphs from an article
contains : str or list of str
Exclude paragraphs not containing this string as a token, or
at least one of the strings... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L117-L143 |
sorgerlab/indra | indra/statements/resources.py | get_valid_residue | def get_valid_residue(residue):
"""Check if the given string represents a valid amino acid residue."""
if residue is not None and amino_acids.get(residue) is None:
res = amino_acids_reverse.get(residue.lower())
if res is None:
raise InvalidResidueError(residue)
else:
... | python | def get_valid_residue(residue):
"""Check if the given string represents a valid amino acid residue."""
if residue is not None and amino_acids.get(residue) is None:
res = amino_acids_reverse.get(residue.lower())
if res is None:
raise InvalidResidueError(residue)
else:
... | Check if the given string represents a valid amino acid residue. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L15-L23 |
sorgerlab/indra | indra/statements/resources.py | get_valid_location | def get_valid_location(location):
"""Check if the given location represents a valid cellular component."""
# If we're given None, return None
if location is not None and cellular_components.get(location) is None:
loc = cellular_components_reverse.get(location)
if loc is None:
rai... | python | def get_valid_location(location):
"""Check if the given location represents a valid cellular component."""
# If we're given None, return None
if location is not None and cellular_components.get(location) is None:
loc = cellular_components_reverse.get(location)
if loc is None:
rai... | Check if the given location represents a valid cellular component. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L26-L35 |
sorgerlab/indra | indra/statements/resources.py | _read_activity_types | def _read_activity_types():
"""Read types of valid activities from a resource file."""
this_dir = os.path.dirname(os.path.abspath(__file__))
ac_file = os.path.join(this_dir, os.pardir, 'resources',
'activity_hierarchy.rdf')
g = rdflib.Graph()
with open(ac_file, 'r'):
... | python | def _read_activity_types():
"""Read types of valid activities from a resource file."""
this_dir = os.path.dirname(os.path.abspath(__file__))
ac_file = os.path.join(this_dir, os.pardir, 'resources',
'activity_hierarchy.rdf')
g = rdflib.Graph()
with open(ac_file, 'r'):
... | Read types of valid activities from a resource file. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L38-L52 |
sorgerlab/indra | indra/statements/resources.py | _read_cellular_components | def _read_cellular_components():
"""Read cellular components from a resource file."""
# Here we load a patch file in addition to the current cellular components
# file to make sure we don't error with InvalidLocationError with some
# deprecated cellular location names
this_dir = os.path.dirname(os.p... | python | def _read_cellular_components():
"""Read cellular components from a resource file."""
# Here we load a patch file in addition to the current cellular components
# file to make sure we don't error with InvalidLocationError with some
# deprecated cellular location names
this_dir = os.path.dirname(os.p... | Read cellular components from a resource file. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L58-L86 |
sorgerlab/indra | indra/statements/resources.py | _read_amino_acids | def _read_amino_acids():
"""Read the amino acid information from a resource file."""
this_dir = os.path.dirname(os.path.abspath(__file__))
aa_file = os.path.join(this_dir, os.pardir, 'resources', 'amino_acids.tsv')
amino_acids = {}
amino_acids_reverse = {}
with open(aa_file, 'rt') as fh:
... | python | def _read_amino_acids():
"""Read the amino acid information from a resource file."""
this_dir = os.path.dirname(os.path.abspath(__file__))
aa_file = os.path.join(this_dir, os.pardir, 'resources', 'amino_acids.tsv')
amino_acids = {}
amino_acids_reverse = {}
with open(aa_file, 'rt') as fh:
... | Read the amino acid information from a resource file. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L92-L109 |
sorgerlab/indra | indra/assemblers/pysb/export.py | export_sbgn | def export_sbgn(model):
"""Return an SBGN model string corresponding to the PySB model.
This function first calls generate_equations on the PySB model to obtain
a reaction network (i.e. individual species, reactions). It then iterates
over each reaction and and instantiates its reactants, products, and... | python | def export_sbgn(model):
"""Return an SBGN model string corresponding to the PySB model.
This function first calls generate_equations on the PySB model to obtain
a reaction network (i.e. individual species, reactions). It then iterates
over each reaction and and instantiates its reactants, products, and... | Return an SBGN model string corresponding to the PySB model.
This function first calls generate_equations on the PySB model to obtain
a reaction network (i.e. individual species, reactions). It then iterates
over each reaction and and instantiates its reactants, products, and the
process itself as SBGN... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L9-L82 |
sorgerlab/indra | indra/assemblers/pysb/export.py | export_kappa_im | def export_kappa_im(model, fname=None):
"""Return a networkx graph representing the model's Kappa influence map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa IM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in whi... | python | def export_kappa_im(model, fname=None):
"""Return a networkx graph representing the model's Kappa influence map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa IM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in whi... | Return a networkx graph representing the model's Kappa influence map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa IM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in which
the IM is rendered using pygraphviz.... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L85-L113 |
sorgerlab/indra | indra/assemblers/pysb/export.py | export_kappa_cm | def export_kappa_cm(model, fname=None):
"""Return a networkx graph representing the model's Kappa contact map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa CM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in which... | python | def export_kappa_cm(model, fname=None):
"""Return a networkx graph representing the model's Kappa contact map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa CM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in which... | Return a networkx graph representing the model's Kappa contact map.
Parameters
----------
model : pysb.core.Model
A PySB model to be exported into a Kappa CM.
fname : Optional[str]
A file name, typically with .png or .pdf extension in which
the CM is rendered using pygraphviz.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L116-L138 |
sorgerlab/indra | indra/assemblers/pysb/export.py | _prepare_kappa | def _prepare_kappa(model):
"""Return a Kappa STD with the model loaded."""
import kappy
kappa = kappy.KappaStd()
model_str = export(model, 'kappa')
kappa.add_model_string(model_str)
kappa.project_parse()
return kappa | python | def _prepare_kappa(model):
"""Return a Kappa STD with the model loaded."""
import kappy
kappa = kappy.KappaStd()
model_str = export(model, 'kappa')
kappa.add_model_string(model_str)
kappa.project_parse()
return kappa | Return a Kappa STD with the model loaded. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L141-L148 |
sorgerlab/indra | indra/databases/cbio_client.py | send_request | def send_request(**kwargs):
"""Return a data frame from a web service request to cBio portal.
Sends a web service requrest to the cBio portal with arguments given in
the dictionary data and returns a Pandas data frame on success.
More information about the service here:
http://www.cbioportal.org/w... | python | def send_request(**kwargs):
"""Return a data frame from a web service request to cBio portal.
Sends a web service requrest to the cBio portal with arguments given in
the dictionary data and returns a Pandas data frame on success.
More information about the service here:
http://www.cbioportal.org/w... | Return a data frame from a web service request to cBio portal.
Sends a web service requrest to the cBio portal with arguments given in
the dictionary data and returns a Pandas data frame on success.
More information about the service here:
http://www.cbioportal.org/web_api.jsp
Parameters
----... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L25-L63 |
sorgerlab/indra | indra/databases/cbio_client.py | get_mutations | def get_mutations(study_id, gene_list, mutation_type=None,
case_id=None):
"""Return mutations as a list of genes and list of amino acid changes.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list :... | python | def get_mutations(study_id, gene_list, mutation_type=None,
case_id=None):
"""Return mutations as a list of genes and list of amino acid changes.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list :... | Return mutations as a list of genes and list of amino acid changes.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list : list[str]
A list of genes with their HGNC symbols.
Example: ['BRAF', 'KRAS']
m... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L66-L106 |
sorgerlab/indra | indra/databases/cbio_client.py | get_case_lists | def get_case_lists(study_id):
"""Return a list of the case set ids for a particular study.
TAKE NOTE the "case_list_id" are the same thing as "case_set_id"
Within the data, this string is referred to as a "case_list_id".
Within API calls it is referred to as a 'case_set_id'.
The documentation does ... | python | def get_case_lists(study_id):
"""Return a list of the case set ids for a particular study.
TAKE NOTE the "case_list_id" are the same thing as "case_set_id"
Within the data, this string is referred to as a "case_list_id".
Within API calls it is referred to as a 'case_set_id'.
The documentation does ... | Return a list of the case set ids for a particular study.
TAKE NOTE the "case_list_id" are the same thing as "case_set_id"
Within the data, this string is referred to as a "case_list_id".
Within API calls it is referred to as a 'case_set_id'.
The documentation does not make this explicitly clear.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L109-L133 |
sorgerlab/indra | indra/databases/cbio_client.py | get_profile_data | def get_profile_data(study_id, gene_list,
profile_filter, case_set_filter=None):
"""Return dict of cases and genes and their respective values.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list... | python | def get_profile_data(study_id, gene_list,
profile_filter, case_set_filter=None):
"""Return dict of cases and genes and their respective values.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list... | Return dict of cases and genes and their respective values.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'cellline_ccle_broad' or 'paad_icgc'
gene_list : list[str]
A list of genes with their HGNC symbols.
Example: ['BRAF', 'KRAS']
profile_f... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L136-L193 |
sorgerlab/indra | indra/databases/cbio_client.py | get_num_sequenced | def get_num_sequenced(study_id):
"""Return number of sequenced tumors for given study.
This is useful for calculating mutation statistics in terms of the
prevalence of certain mutations within a type of cancer.
Parameters
----------
study_id : str
The ID of the cBio study.
Exam... | python | def get_num_sequenced(study_id):
"""Return number of sequenced tumors for given study.
This is useful for calculating mutation statistics in terms of the
prevalence of certain mutations within a type of cancer.
Parameters
----------
study_id : str
The ID of the cBio study.
Exam... | Return number of sequenced tumors for given study.
This is useful for calculating mutation statistics in terms of the
prevalence of certain mutations within a type of cancer.
Parameters
----------
study_id : str
The ID of the cBio study.
Example: 'paad_icgc'
Returns
------... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L196-L220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.