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_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
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...
[ "def", "_make_db_refs", "(", "self", ",", "entrez_id", ",", "text_id", ")", ":", "db_refs", "=", "{", "}", "if", "text_id", "!=", "'-'", "and", "text_id", "is", "not", "None", ":", "db_refs", "[", "'TEXT'", "]", "=", "text_id", "hgnc_id", "=", "hgnc_cl...
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...
[ "Looks", "up", "the", "HGNC", "ID", "and", "name", "as", "well", "as", "the", "Uniprot", "ID", "." ]
train
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...
[ "def", "make_model", "(", "self", ",", "policies", "=", "None", ",", "initial_conditions", "=", "True", ",", "reverse_effects", "=", "False", ")", ":", "self", ".", "processed_policies", "=", "self", ".", "process_policies", "(", "policies", ")", "ppa", "=",...
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]] ...
[ "Assemble", "the", "Kami", "model", "from", "the", "collected", "INDRA", "Statements", "." ]
train
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)
[ "def", "_assemble", "(", "self", ")", ":", "for", "stmt", "in", "self", ".", "statements", ":", "if", "_is_whitelisted", "(", "stmt", ")", ":", "self", ".", "_dispatch", "(", "stmt", ",", "'assemble'", ",", "self", ".", "model", ")" ]
Calls the appropriate assemble method based on policies.
[ "Calls", "the", "appropriate", "assemble", "method", "based", "on", "policies", "." ]
train
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 ...
[ "def", "_dispatch", "(", "self", ",", "stmt", ",", "stage", ",", "*", "args", ")", ":", "class_name", "=", "stmt", ".", "__class__", ".", "__name__", "policy", "=", "self", ".", "processed_policies", "[", "stmt", ".", "uuid", "]", "func_name", "=", "'%...
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.
[ "Construct", "and", "call", "an", "assembly", "function", "." ]
train
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...
[ "def", "add_agent", "(", "self", ",", "agent", ")", ":", "agent_id", "=", "self", ".", "add_node", "(", "agent", ".", "name", ")", "self", ".", "add_typing", "(", "agent_id", ",", "'agent'", ")", "# Handle bound conditions", "for", "bc", "in", "agent", "...
Add an INDRA Agent and its conditions to the Nugget.
[ "Add", "an", "INDRA", "Agent", "and", "its", "conditions", "to", "the", "Nugget", "." ]
train
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...
[ "def", "add_node", "(", "self", ",", "name_base", ",", "attrs", "=", "None", ")", ":", "if", "name_base", "not", "in", "self", ".", "counters", ":", "node_id", "=", "name_base", "else", ":", "node_id", "=", "'%s_%d'", "%", "(", "name_base", ",", "self"...
Add a node with a given base name to the Nugget and return ID.
[ "Add", "a", "node", "with", "a", "given", "base", "name", "to", "the", "Nugget", "and", "return", "ID", "." ]
train
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, ...
[ "def", "get_nugget_dict", "(", "self", ")", ":", "nugget_dict", "=", "{", "'id'", ":", "self", ".", "id", ",", "'graph'", ":", "{", "'nodes'", ":", "self", ".", "nodes", ",", "'edges'", ":", "self", ".", "edges", "}", ",", "'attrs'", ":", "{", "'na...
Return the Nugget as a dictionary.
[ "Return", "the", "Nugget", "as", "a", "dictionary", "." ]
train
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...
[ "def", "process_text", "(", "text", ",", "pmid", "=", "None", ",", "python2_path", "=", "None", ")", ":", "# Try to locate python2 in one of the directories of the PATH environment", "# variable if it is not provided", "if", "python2_path", "is", "None", ":", "for", "path...
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 ...
[ "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"...
train
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...
[ "def", "run_on_text", "(", "text", ",", "python2_path", ")", ":", "tees_path", "=", "get_config", "(", "'TEES_PATH'", ")", "if", "tees_path", "is", "None", ":", "# If TEES directory is not specifies, see if any of the candidate paths", "# exist and contain all of the files ex...
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 ----...
[ "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", ".", ...
train
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 ...
[ "def", "extract_output", "(", "output_dir", ")", ":", "# Locate the file of sentences segmented by the TEES system, described", "# in a compressed xml document", "sentences_glob", "=", "os", ".", "path", ".", "join", "(", "output_dir", ",", "'*-preprocessed.xml.gz'", ")", "se...
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...
[ "Extract", "the", "text", "of", "the", "a1", "a2", "and", "sentence", "segmentation", "files", "from", "the", "TEES", "output", "directory", ".", "These", "files", "are", "located", "within", "a", "compressed", "archive", "." ]
train
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
[ "def", "_list_to_seq", "(", "lst", ")", ":", "ml", "=", "autoclass", "(", "'scala.collection.mutable.MutableList'", ")", "(", ")", "for", "element", "in", "lst", ":", "ml", ".", "appendElem", "(", "element", ")", "return", "ml" ]
Return a scala.collection.Seq from a Python list.
[ "Return", "a", "scala", ".", "collection", ".", "Seq", "from", "a", "Python", "list", "." ]
train
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" ...
[ "def", "process_text", "(", "self", ",", "text", ",", "format", "=", "'json'", ")", ":", "if", "self", ".", "eidos_reader", "is", "None", ":", "self", ".", "initialize_reader", "(", ")", "default_arg", "=", "lambda", "x", ":", "autoclass", "(", "'scala.S...
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 ...
[ "Return", "a", "mentions", "JSON", "object", "given", "text", "." ]
train
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 ...
[ "def", "process_text", "(", "text", ",", "out_format", "=", "'json_ld'", ",", "save_json", "=", "'eidos_output.json'", ",", "webservice", "=", "None", ")", ":", "if", "not", "webservice", ":", "if", "eidos_reader", "is", "None", ":", "logger", ".", "error", ...
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_...
[ "Return", "an", "EidosProcessor", "by", "processing", "the", "given", "text", "." ]
train
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. ...
[ "def", "process_json_file", "(", "file_name", ")", ":", "try", ":", "with", "open", "(", "file_name", ",", "'rb'", ")", "as", "fh", ":", "json_str", "=", "fh", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "return", "process_json_str", "("...
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...
[ "Return", "an", "EidosProcessor", "by", "processing", "the", "given", "Eidos", "JSON", "-", "LD", "file", "." ]
train
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...
[ "def", "process_json", "(", "json_dict", ")", ":", "ep", "=", "EidosProcessor", "(", "json_dict", ")", "ep", ".", "extract_causal_relations", "(", ")", "ep", ".", "extract_correlations", "(", ")", "ep", ".", "extract_events", "(", ")", "return", "ep" ]
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.
[ "Return", "an", "EidosProcessor", "by", "processing", "a", "Eidos", "JSON", "-", "LD", "dict", "." ]
train
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...
[ "def", "get_drug_inhibition_stmts", "(", "drug", ")", ":", "chebi_id", "=", "drug", ".", "db_refs", ".", "get", "(", "'CHEBI'", ")", "mesh_id", "=", "drug", ".", "db_refs", ".", "get", "(", "'MESH'", ")", "if", "chebi_id", ":", "drug_chembl_id", "=", "ch...
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...
[ "Query", "ChEMBL", "for", "kinetics", "data", "given", "drug", "as", "Agent", "get", "back", "statements" ]
train
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 """ ...
[ "def", "send_query", "(", "query_dict", ")", ":", "query", "=", "query_dict", "[", "'query'", "]", "params", "=", "query_dict", "[", "'params'", "]", "url", "=", "'https://www.ebi.ac.uk/chembl/api/data/'", "+", "query", "+", "'.json'", "r", "=", "requests", "....
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" ]
train
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...
[ "def", "query_target", "(", "target_chembl_id", ")", ":", "query_dict", "=", "{", "'query'", ":", "'target'", ",", "'params'", ":", "{", "'target_chembl_id'", ":", "target_chembl_id", ",", "'limit'", ":", "1", "}", "}", "res", "=", "send_query", "(", "query_...
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", "ChEMBL", "API", "target", "by", "id" ]
train
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...
[ "def", "activities_by_target", "(", "activities", ")", ":", "targ_act_dict", "=", "defaultdict", "(", "lambda", ":", "[", "]", ")", "for", "activity", "in", "activities", ":", "target_chembl_id", "=", "activity", "[", "'target_chembl_id'", "]", "activity_id", "=...
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
[ "Get", "back", "lists", "of", "activities", "in", "a", "dict", "keyed", "by", "ChEMBL", "target", "id" ]
train
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...
[ "def", "get_protein_targets_only", "(", "target_chembl_ids", ")", ":", "protein_targets", "=", "{", "}", "for", "target_chembl_id", "in", "target_chembl_ids", ":", "target", "=", "query_target", "(", "target_chembl_id", ")", "if", "'SINGLE PROTEIN'", "in", "target", ...
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
[ "Given", "list", "of", "ChEMBL", "target", "ids", "return", "dict", "of", "SINGLE", "PROTEIN", "targets" ]
train
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...
[ "def", "get_evidence", "(", "assay", ")", ":", "kin", "=", "get_kinetics", "(", "assay", ")", "source_id", "=", "assay", ".", "get", "(", "'assay_chembl_id'", ")", "if", "not", "kin", ":", "return", "None", "annotations", "=", "{", "'kinetics'", ":", "ki...
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
[ "Given", "an", "activity", "return", "an", "INDRA", "Evidence", "object", "." ]
train
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', ...
[ "def", "get_kinetics", "(", "assay", ")", ":", "try", ":", "val", "=", "float", "(", "assay", ".", "get", "(", "'standard_value'", ")", ")", "except", "TypeError", ":", "logger", ".", "warning", "(", "'Invalid assay value: %s'", "%", "assay", ".", "get", ...
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'
[ "Given", "an", "activity", "return", "its", "kinetics", "values", "." ]
train
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) ...
[ "def", "get_pmid", "(", "doc_id", ")", ":", "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
[ "Get", "PMID", "from", "document_chembl_id" ]
train
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...
[ "def", "get_target_chemblid", "(", "target_upid", ")", ":", "url", "=", "'https://www.ebi.ac.uk/chembl/api/data/target.json'", "params", "=", "{", "'target_components__accession'", ":", "target_upid", "}", "r", "=", "requests", ".", "get", "(", "url", ",", "params", ...
Get ChEMBL ID from UniProt upid Parameters ---------- target_upid : str Returns ------- target_chembl_id : str
[ "Get", "ChEMBL", "ID", "from", "UniProt", "upid" ]
train
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...
[ "def", "get_mesh_id", "(", "nlm_mesh", ")", ":", "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
[ "Get", "MESH", "ID", "from", "NLM", "MESH" ]
train
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...
[ "def", "get_pcid", "(", "mesh_id", ")", ":", "url_mesh2pcid", "=", "'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi'", "params", "=", "{", "'dbfrom'", ":", "'mesh'", ",", "'id'", ":", "mesh_id", ",", "'db'", ":", "'pccompound'", ",", "'retmode'", ":", "'J...
Get PC ID from MESH ID Parameters ---------- mesh : str Returns ------- pcid : str
[ "Get", "PC", "ID", "from", "MESH", "ID" ]
train
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/' + \ ...
[ "def", "get_chembl_id", "(", "nlm_mesh", ")", ":", "mesh_id", "=", "get_mesh_id", "(", "nlm_mesh", ")", "pcid", "=", "get_pcid", "(", "mesh_id", ")", "url_mesh2pcid", "=", "'https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/'", "+", "'cid/%s/synonyms/JSON'", "%", "pc...
Get ChEMBL ID from NLM MESH Parameters ---------- nlm_mesh : str Returns ------- chembl_id : str
[ "Get", "ChEMBL", "ID", "from", "NLM", "MESH" ]
train
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): ...
[ "def", "get_sentences", "(", "self", ",", "root_element", ",", "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.
[ "Returns", "a", "list", "of", "plain", "-", "text", "sentences", "by", "iterating", "through", "XML", "tags", "except", "for", "those", "listed", "in", "block_tags", "." ]
train
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...
[ "def", "any_ends_with", "(", "self", ",", "string_list", ",", "pattern", ")", ":", "try", ":", "s_base", "=", "basestring", "except", ":", "s_base", "=", "str", "is_string", "=", "isinstance", "(", "pattern", ",", "s_base", ")", "if", "not", "is_string", ...
Returns true iff one of the strings in string_list ends in pattern.
[ "Returns", "true", "iff", "one", "of", "the", "strings", "in", "string_list", "ends", "in", "pattern", "." ]
train
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)
[ "def", "get_tag_names", "(", "self", ")", ":", "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.
[ "Returns", "the", "set", "of", "tag", "names", "present", "in", "the", "XML", "." ]
train
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...
[ "def", "get_children_tag_names", "(", "self", ",", "xml_element", ")", ":", "tags", "=", "set", "(", ")", "tags", ".", "add", "(", "self", ".", "remove_namespace_from_tag", "(", "xml_element", ".", "tag", ")", ")", "for", "element", "in", "xml_element", "....
Returns all tag names of xml element and its children.
[ "Returns", "all", "tag", "names", "of", "xml", "element", "and", "its", "children", "." ]
train
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
[ "def", "string_matches_sans_whitespace", "(", "self", ",", "str1", ",", "str2_fuzzy_whitespace", ")", ":", "str2_fuzzy_whitespace", "=", "re", ".", "sub", "(", "'\\s+'", ",", "'\\s*'", ",", "str2_fuzzy_whitespace", ")", "return", "re", ".", "search", "(", "str2_...
Check if two strings match, modulo their whitespace.
[ "Check", "if", "two", "strings", "match", "modulo", "their", "whitespace", "." ]
train
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 ...
[ "def", "sentence_matches", "(", "self", ",", "sentence_text", ")", ":", "has_upstream", "=", "False", "has_downstream", "=", "False", "has_verb", "=", "False", "# Get the first word of the action type and assume this is the verb", "# (Ex. get depends for depends on)", "actionty...
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.
[ "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", "acti...
train
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 ...
[ "def", "get_identifiers_url", "(", "db_name", ",", "db_id", ")", ":", "identifiers_url", "=", "'http://identifiers.org/'", "bel_scai_url", "=", "'https://arty.scai.fraunhofer.de/artifactory/bel/namespace/'", "if", "db_name", "==", "'UP'", ":", "url", "=", "identifiers_url",...
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...
[ "Return", "an", "identifiers", ".", "org", "URL", "for", "a", "given", "database", "name", "and", "ID", "." ]
train
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...
[ "def", "dump_statements", "(", "stmts", ",", "fname", ",", "protocol", "=", "4", ")", ":", "logger", ".", "info", "(", "'Dumping %d statements into %s...'", "%", "(", "len", "(", "stmts", ")", ",", "fname", ")", ")", "with", "open", "(", "fname", ",", ...
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
[ "Dump", "a", "list", "of", "statements", "into", "a", "pickle", "file", "." ]
train
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...
[ "def", "load_statements", "(", "fname", ",", "as_dict", "=", "False", ")", ":", "logger", ".", "info", "(", "'Loading %s...'", "%", "fname", ")", "with", "open", "(", "fname", ",", "'rb'", ")", "as", "fh", ":", "# Encoding argument not available in pickle for ...
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...
[ "Load", "statements", "from", "a", "pickle", "file", "." ]
train
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...
[ "def", "map_grounding", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "from", "indra", ".", "preassembler", ".", "grounding_mapper", "import", "GroundingMapper", "from", "indra", ".", "preassembler", ".", "grounding_mapper", "import", "gm", "as", "groundin...
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...
[ "Map", "grounding", "using", "the", "GroundingMapper", "." ]
train
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...
[ "def", "merge_groundings", "(", "stmts_in", ")", ":", "def", "surface_grounding", "(", "stmt", ")", ":", "# Find the \"best\" grounding for a given concept and its evidences", "# and surface that", "for", "idx", ",", "concept", "in", "enumerate", "(", "stmt", ".", "agen...
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...
[ "Gather", "and", "merge", "original", "grounding", "information", "from", "evidences", "." ]
train
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...
[ "def", "merge_deltas", "(", "stmts_in", ")", ":", "stmts_out", "=", "[", "]", "for", "stmt", "in", "stmts_in", ":", "# This operation is only applicable to Influences", "if", "not", "isinstance", "(", "stmt", ",", "Influence", ")", ":", "stmts_out", ".", "append...
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...
[ "Gather", "and", "merge", "original", "Influence", "delta", "information", "from", "evidence", "." ]
train
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...
[ "def", "map_sequence", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "from", "indra", ".", "preassembler", ".", "sitemapper", "import", "SiteMapper", ",", "default_site_map", "logger", ".", "info", "(", "'Mapping sites on %d statements...'", "%", "len", "(...
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...
[ "Map", "sequences", "using", "the", "SiteMapper", "." ]
train
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,...
[ "def", "run_preassembly", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "dump_pkl_unique", "=", "kwargs", ".", "get", "(", "'save_unique'", ")", "belief_scorer", "=", "kwargs", ".", "get", "(", "'belief_scorer'", ")", "use_hierarchies", "=", "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, all statements are returned irrespectiv...
[ "Run", "preassembly", "on", "a", "list", "of", "statements", "." ]
train
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...
[ "def", "run_preassembly_duplicate", "(", "preassembler", ",", "beliefengine", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Combining duplicates on %d statements...'", "%", "len", "(", "preassembler", ".", "stmts", ")", ")", "dump_pkl", "=", "...
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...
[ "Run", "deduplication", "stage", "of", "preassembly", "on", "a", "list", "of", "statements", "." ]
train
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...
[ "def", "run_preassembly_related", "(", "preassembler", ",", "beliefengine", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Combining related on %d statements...'", "%", "len", "(", "preassembler", ".", "unique_stmts", ")", ")", "return_toplevel", ...
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...
[ "Run", "related", "stage", "of", "preassembly", "on", "a", "list", "of", "statements", "." ]
train
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...
[ "def", "filter_by_type", "(", "stmts_in", ",", "stmt_type", ",", "*", "*", "kwargs", ")", ":", "invert", "=", "kwargs", ".", "get", "(", "'invert'", ",", "False", ")", "logger", ".", "info", "(", "'Filtering %d statements for type %s%s...'", "%", "(", "len",...
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[...
[ "Filter", "to", "a", "given", "statement", "type", "." ]
train
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 ...
[ "def", "_remove_bound_conditions", "(", "agent", ",", "keep_criterion", ")", ":", "new_bc", "=", "[", "]", "for", "ind", "in", "range", "(", "len", "(", "agent", ".", "bound_conditions", ")", ")", ":", "if", "keep_criterion", "(", "agent", ".", "bound_cond...
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...
[ "Removes", "bound", "conditions", "of", "agent", "such", "that", "keep_criterion", "is", "False", "." ]
train
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...
[ "def", "_any_bound_condition_fails_criterion", "(", "agent", ",", "criterion", ")", ":", "bc_agents", "=", "[", "bc", ".", "agent", "for", "bc", "in", "agent", ".", "bound_conditions", "]", "for", "b", "in", "bc_agents", ":", "if", "not", "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 bound condition and returns True if any agents fail to meet t...
[ "Returns", "True", "if", "any", "bound", "condition", "fails", "to", "meet", "the", "specified", "criterion", "." ]
train
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...
[ "def", "filter_grounded_only", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "remove_bound", "=", "kwargs", ".", "get", "(", "'remove_bound'", ",", "False", ")", "logger", ".", "info", "(", "'Filtering %d statements for grounded agents...'", "%", "len", "(...
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...
[ "Filter", "to", "statements", "that", "have", "grounded", "agents", "." ]
train
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,...
[ "def", "_agent_is_gene", "(", "agent", ",", "specific_only", ")", ":", "if", "not", "specific_only", ":", "if", "not", "(", "agent", ".", "db_refs", ".", "get", "(", "'HGNC'", ")", "or", "agent", ".", "db_refs", ".", "get", "(", "'UP'", ")", "or", "a...
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 ---...
[ "Returns", "whether", "an", "agent", "is", "for", "a", "gene", "." ]
train
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...
[ "def", "filter_genes_only", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "remove_bound", "=", "'remove_bound'", "in", "kwargs", "and", "kwargs", "[", "'remove_bound'", "]", "specific_only", "=", "kwargs", ".", "get", "(", "'specific_only'", ")", "logger...
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...
[ "Filter", "to", "statements", "containing", "genes", "only", "." ]
train
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...
[ "def", "filter_belief", "(", "stmts_in", ",", "belief_cutoff", ",", "*", "*", "kwargs", ")", ":", "dump_pkl", "=", "kwargs", ".", "get", "(", "'save'", ")", "logger", ".", "info", "(", "'Filtering %d statements to above %f belief'", "%", "(", "len", "(", "st...
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...
[ "Filter", "to", "statements", "with", "belief", "above", "a", "given", "cutoff", "." ]
train
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 ...
[ "def", "filter_gene_list", "(", "stmts_in", ",", "gene_list", ",", "policy", ",", "allow_families", "=", "False", ",", "*", "*", "kwargs", ")", ":", "invert", "=", "kwargs", ".", "get", "(", "'invert'", ",", "False", ")", "remove_bound", "=", "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 list of gene symbols to filter for. policy : str The policy to apply when filtering for the list of...
[ "Return", "statements", "that", "contain", "genes", "given", "in", "a", "list", "." ]
train
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...
[ "def", "filter_concept_names", "(", "stmts_in", ",", "name_list", ",", "policy", ",", "*", "*", "kwargs", ")", ":", "invert", "=", "kwargs", ".", "get", "(", "'invert'", ",", "False", ")", "if", "policy", "not", "in", "(", "'one'", ",", "'all'", ")", ...
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...
[ "Return", "Statements", "that", "refer", "to", "concepts", "/", "agents", "given", "as", "a", "list", "of", "names", "." ]
train
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 ...
[ "def", "filter_by_db_refs", "(", "stmts_in", ",", "namespace", ",", "values", ",", "policy", ",", "*", "*", "kwargs", ")", ":", "invert", "=", "kwargs", ".", "get", "(", "'invert'", ",", "False", ")", "match_suffix", "=", "kwargs", ".", "get", "(", "'m...
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...
[ "Filter", "to", "Statements", "whose", "agents", "are", "grounded", "to", "a", "matching", "entry", "." ]
train
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...
[ "def", "filter_human_only", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "from", "indra", ".", "databases", "import", "uniprot_client", "if", "'remove_bound'", "in", "kwargs", "and", "kwargs", "[", "'remove_bound'", "]", ":", "remove_bound", "=", "True"...
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] ...
[ "Filter", "out", "statements", "that", "are", "grounded", "but", "not", "to", "a", "human", "gene", "." ]
train
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...
[ "def", "filter_direct", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "def", "get_is_direct", "(", "stmt", ")", ":", "\"\"\"Returns true if there is evidence that the statement is a direct\n interaction.\n\n If any of the evidences associated with the statement\n ...
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...
[ "Filter", "to", "statements", "that", "are", "direct", "interactions" ]
train
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...
[ "def", "filter_no_hypothesis", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Filtering %d statements to no hypothesis...'", "%", "len", "(", "stmts_in", ")", ")", "stmts_out", "=", "[", "]", "for", "st", "in", "stmts_in", ...
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...
[ "Filter", "to", "statements", "that", "are", "not", "marked", "as", "hypothesis", "in", "epistemics", "." ]
train
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...
[ "def", "filter_evidence_source", "(", "stmts_in", ",", "source_apis", ",", "policy", "=", "'one'", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Filtering %d statements to evidence source \"%s\" of: %s...'", "%", "(", "len", "(", "stmts_in", ")"...
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] ...
[ "Filter", "to", "statements", "that", "have", "evidence", "from", "a", "given", "set", "of", "sources", "." ]
train
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...
[ "def", "filter_top_level", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Filtering %d statements for top-level...'", "%", "len", "(", "stmts_in", ")", ")", "stmts_out", "=", "[", "st", "for", "st", "in", "stmts_in", "if", ...
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 ...
[ "Filter", "to", "statements", "that", "are", "at", "the", "top", "-", "level", "of", "the", "hierarchy", "." ]
train
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...
[ "def", "filter_inconsequential_mods", "(", "stmts_in", ",", "whitelist", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "whitelist", "is", "None", ":", "whitelist", "=", "{", "}", "logger", ".", "info", "(", "'Filtering %d statements to remove'", "%", ...
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...
[ "Filter", "out", "Modifications", "that", "modify", "inconsequential", "sites" ]
train
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...
[ "def", "filter_inconsequential_acts", "(", "stmts_in", ",", "whitelist", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "whitelist", "is", "None", ":", "whitelist", "=", "{", "}", "logger", ".", "info", "(", "'Filtering %d statements to remove'", "%", ...
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 ...
[ "Filter", "out", "Activations", "that", "modify", "inconsequential", "activities" ]
train
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...
[ "def", "filter_mutation_status", "(", "stmts_in", ",", "mutations", ",", "deletions", ",", "*", "*", "kwargs", ")", ":", "if", "'remove_bound'", "in", "kwargs", "and", "kwargs", "[", "'remove_bound'", "]", ":", "remove_bound", "=", "True", "else", ":", "remo...
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...
[ "Filter", "statements", "based", "on", "existing", "mutations", "/", "deletions" ]
train
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 (...
[ "def", "filter_enzyme_kinase", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Filtering %d statements to remove '", "%", "len", "(", "stmts_in", ")", "+", "'phosphorylation by non-kinases...'", ")", "path", "=", "os", ".", "pat...
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...
[ "Filter", "Phosphorylations", "to", "ones", "where", "the", "enzyme", "is", "a", "known", "kinase", "." ]
train
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...
[ "def", "filter_transcription_factor", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Filtering %d statements to remove '", "%", "len", "(", "stmts_in", ")", "+", "'amount regulations by non-transcription-factors...'", ")", "path", "=...
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...
[ "Filter", "out", "RegulateAmounts", "where", "subject", "is", "not", "a", "transcription", "factor", "." ]
train
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...
[ "def", "filter_uuid_list", "(", "stmts_in", ",", "uuids", ",", "*", "*", "kwargs", ")", ":", "invert", "=", "kwargs", ".", "get", "(", "'invert'", ",", "False", ")", "logger", ".", "info", "(", "'Filtering %d statements for %d UUID%s...'", "%", "(", "len", ...
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)...
[ "Filter", "to", "Statements", "corresponding", "to", "given", "UUIDs" ]
train
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 ...
[ "def", "expand_families", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "from", "indra", ".", "tools", ".", "expand_families", "import", "Expander", "logger", ".", "info", "(", "'Expanding families on %d statements...'", "%", "len", "(", "stmts_in", ")", ...
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...
[ "Expand", "FamPlex", "Agents", "to", "individual", "genes", "." ]
train
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...
[ "def", "reduce_activities", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Reducing activities on %d statements...'", "%", "len", "(", "stmts_in", ")", ")", "stmts_out", "=", "[", "deepcopy", "(", "st", ")", "for", "st", ...
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...
[ "Reduce", "the", "activity", "types", "in", "a", "list", "of", "statements" ]
train
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...
[ "def", "strip_agent_context", "(", "stmts_in", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Stripping agent context on %d statements...'", "%", "len", "(", "stmts_in", ")", ")", "stmts_out", "=", "[", "]", "for", "st", "in", "stmts_in", "...
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 -------...
[ "Strip", "any", "context", "on", "agents", "within", "each", "statement", "." ]
train
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. """ ...
[ "def", "standardize_names_groundings", "(", "stmts", ")", ":", "print", "(", "'Standardize names to groundings'", ")", "for", "stmt", "in", "stmts", ":", "for", "concept", "in", "stmt", ".", "agent_list", "(", ")", ":", "db_ns", ",", "db_id", "=", "concept", ...
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", "." ]
train
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...
[ "def", "dump_stmt_strings", "(", "stmts", ",", "fname", ")", ":", "with", "open", "(", "fname", ",", "'wb'", ")", "as", "fh", ":", "for", "st", "in", "stmts", ":", "fh", ".", "write", "(", "(", "'%s\\n'", "%", "st", ")", ".", "encode", "(", "'utf...
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.
[ "Save", "printed", "statements", "in", "a", "file", "." ]
train
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...
[ "def", "rename_db_ref", "(", "stmts_in", ",", "ns_from", ",", "ns_to", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "'Remapping \"%s\" to \"%s\" in db_refs on %d statements...'", "%", "(", "ns_from", ",", "ns_to", ",", "len", "(", "stmts_in", ...
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...
[ "Rename", "an", "entry", "in", "the", "db_refs", "of", "each", "Agent", "." ]
train
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...
[ "def", "align_statements", "(", "stmts1", ",", "stmts2", ",", "keyfun", "=", "None", ")", ":", "def", "name_keyfun", "(", "stmt", ")", ":", "return", "tuple", "(", "a", ".", "name", "if", "a", "is", "not", "None", "else", "None", "for", "a", "in", ...
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...
[ "Return", "alignment", "of", "two", "lists", "of", "statements", "by", "key", "." ]
train
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...
[ "def", "submit_query_request", "(", "end_point", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ev_limit", "=", "kwargs", ".", "pop", "(", "'ev_limit'", ",", "10", ")", "best_first", "=", "kwargs", ".", "pop", "(", "'best_first'", ",", "True", "...
Low level function to format the query string.
[ "Low", "level", "function", "to", "format", "the", "query", "string", "." ]
train
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...
[ "def", "submit_statement_request", "(", "meth", ",", "end_point", ",", "query_str", "=", "''", ",", "data", "=", "None", ",", "tries", "=", "2", ",", "*", "*", "params", ")", ":", "full_end_point", "=", "'statements/'", "+", "end_point", ".", "lstrip", "...
Even lower level function to make the request.
[ "Even", "lower", "level", "function", "to", "make", "the", "request", "." ]
train
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...
[ "def", "render_stmt_graph", "(", "statements", ",", "reduce", "=", "True", ",", "english", "=", "False", ",", "rankdir", "=", "None", ",", "agent_style", "=", "None", ")", ":", "from", "indra", ".", "assemblers", ".", "english", "import", "EnglishAssembler",...
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`. ...
[ "Render", "the", "statement", "hierarchy", "as", "a", "pygraphviz", "graph", "." ]
train
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 ...
[ "def", "flatten_stmts", "(", "stmts", ")", ":", "total_stmts", "=", "set", "(", "stmts", ")", "for", "stmt", "in", "stmts", ":", "if", "stmt", ".", "supported_by", ":", "children", "=", "flatten_stmts", "(", "stmt", ".", "supported_by", ")", "total_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 ---------- stmts : list of ...
[ "Return", "the", "full", "set", "of", "unique", "stms", "in", "a", "pre", "-", "assembled", "stmt", "graph", "." ]
train
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...
[ "def", "flatten_evidence", "(", "stmts", ",", "collect_from", "=", "None", ")", ":", "if", "collect_from", "is", "None", ":", "collect_from", "=", "'supported_by'", "if", "collect_from", "not", "in", "(", "'supports'", ",", "'supported_by'", ")", ":", "raise",...
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...
[ "Add", "evidence", "from", "*", "supporting", "*", "stmts", "to", "evidence", "for", "*", "supported", "*", "stmts", "." ]
train
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) ...
[ "def", "combine_duplicates", "(", "self", ")", ":", "if", "self", ".", "unique_stmts", "is", "None", ":", "self", ".", "unique_stmts", "=", "self", ".", "combine_duplicate_stmts", "(", "self", ".", "stmts", ")", "return", "self", ".", "unique_stmts" ]
Combine duplicates among `stmts` and save result in `unique_stmts`. A wrapper around the static method :py:meth:`combine_duplicate_stmts`.
[ "Combine", "duplicates", "among", "stmts", "and", "save", "result", "in", "unique_stmts", "." ]
train
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.' % ...
[ "def", "_get_stmt_matching_groups", "(", "stmts", ")", ":", "def", "match_func", "(", "x", ")", ":", "return", "x", ".", "matches_key", "(", ")", "# Remove exact duplicates using a set() call, then make copies:", "logger", ".", "debug", "(", "'%d statements before remov...
Use the matches_key method to get sets of matching statements.
[ "Use", "the", "matches_key", "method", "to", "get", "sets", "of", "matching", "statements", "." ]
train
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 ...
[ "def", "combine_duplicate_stmts", "(", "stmts", ")", ":", "# Helper function to get a list of evidence matches keys", "def", "_ev_keys", "(", "sts", ")", ":", "ev_keys", "=", "[", "]", "for", "stmt", "in", "sts", ":", "for", "ev", "in", "stmt", ".", "evidence", ...
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...
[ "Combine", "evidence", "from", "duplicate", "Statements", "." ]
train
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 ...
[ "def", "_get_stmt_by_group", "(", "self", ",", "stmt_type", ",", "stmts_this_type", ",", "eh", ")", ":", "# Dict of stmt group key tuples, indexed by their first Agent", "stmt_by_first", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "[", "]", ")", "# Dic...
Group Statements of `stmt_type` by their hierarchical relations.
[ "Group", "Statements", "of", "stmt_type", "by", "their", "hierarchical", "relations", "." ]
train
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...
[ "def", "_generate_id_maps", "(", "self", ",", "unique_stmts", ",", "poolsize", "=", "None", ",", "size_cutoff", "=", "100", ",", "split_idx", "=", "None", ")", ":", "# Check arguments relating to multiprocessing", "if", "poolsize", "is", "None", ":", "logger", "...
Connect statements using their refinement relationships.
[ "Connect", "statements", "using", "their", "refinement", "relationships", "." ]
train
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...
[ "def", "combine_related", "(", "self", ",", "return_toplevel", "=", "True", ",", "poolsize", "=", "None", ",", "size_cutoff", "=", "100", ")", ":", "if", "self", ".", "related_stmts", "is", "not", "None", ":", "if", "return_toplevel", ":", "return", "self"...
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...
[ "Connect", "related", "statements", "based", "on", "their", "refinement", "relationships", "." ]
train
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 ...
[ "def", "find_contradicts", "(", "self", ")", ":", "eh", "=", "self", ".", "hierarchies", "[", "'entity'", "]", "# Make a dict of Statement by type", "stmts_by_type", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "[", "]", ")", "for", "idx", ",", ...
Return pairs of contradicting Statements. Returns ------- contradicts : list(tuple(Statement, Statement)) A list of Statement pairs that are contradicting.
[ "Return", "pairs", "of", "contradicting", "Statements", "." ]
train
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 = [] ...
[ "def", "get_text_content_for_pmids", "(", "pmids", ")", ":", "pmc_pmids", "=", "set", "(", "pmc_client", ".", "filter_pmids", "(", "pmids", ",", "source_type", "=", "'fulltext'", ")", ")", "pmc_ids", "=", "[", "]", "for", "pmid", "in", "pmc_pmids", ":", "p...
Get text content for articles given a list of their pmids Parameters ---------- pmids : list of str Returns ------- text_content : list of str
[ "Get", "text", "content", "for", "articles", "given", "a", "list", "of", "their", "pmids" ]
train
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...
[ "def", "universal_extract_paragraphs", "(", "xml", ")", ":", "try", ":", "paragraphs", "=", "elsevier_client", ".", "extract_paragraphs", "(", "xml", ")", "except", "Exception", ":", "paragraphs", "=", "None", "if", "paragraphs", "is", "None", ":", "try", ":",...
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...
[ "Extract", "paragraphs", "from", "xml", "that", "could", "be", "from", "different", "sources" ]
train
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 ...
[ "def", "filter_paragraphs", "(", "paragraphs", ",", "contains", "=", "None", ")", ":", "if", "contains", "is", "None", ":", "pattern", "=", "''", "else", ":", "if", "isinstance", "(", "contains", ",", "str", ")", ":", "contains", "=", "[", "contains", ...
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...
[ "Filter", "paragraphs", "to", "only", "those", "containing", "one", "of", "a", "list", "of", "strings" ]
train
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: ...
[ "def", "get_valid_residue", "(", "residue", ")", ":", "if", "residue", "is", "not", "None", "and", "amino_acids", ".", "get", "(", "residue", ")", "is", "None", ":", "res", "=", "amino_acids_reverse", ".", "get", "(", "residue", ".", "lower", "(", ")", ...
Check if the given string represents a valid amino acid residue.
[ "Check", "if", "the", "given", "string", "represents", "a", "valid", "amino", "acid", "residue", "." ]
train
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...
[ "def", "get_valid_location", "(", "location", ")", ":", "# If we're given None, return None", "if", "location", "is", "not", "None", "and", "cellular_components", ".", "get", "(", "location", ")", "is", "None", ":", "loc", "=", "cellular_components_reverse", ".", ...
Check if the given location represents a valid cellular component.
[ "Check", "if", "the", "given", "location", "represents", "a", "valid", "cellular", "component", "." ]
train
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'): ...
[ "def", "_read_activity_types", "(", ")", ":", "this_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "ac_file", "=", "os", ".", "path", ".", "join", "(", "this_dir", ",", "os", ".", "p...
Read types of valid activities from a resource file.
[ "Read", "types", "of", "valid", "activities", "from", "a", "resource", "file", "." ]
train
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...
[ "def", "_read_cellular_components", "(", ")", ":", "# 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", ".", "dir...
Read cellular components from a resource file.
[ "Read", "cellular", "components", "from", "a", "resource", "file", "." ]
train
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: ...
[ "def", "_read_amino_acids", "(", ")", ":", "this_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "aa_file", "=", "os", ".", "path", ".", "join", "(", "this_dir", ",", "os", ".", "pard...
Read the amino acid information from a resource file.
[ "Read", "the", "amino", "acid", "information", "from", "a", "resource", "file", "." ]
train
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...
[ "def", "export_sbgn", "(", "model", ")", ":", "import", "lxml", ".", "etree", "import", "lxml", ".", "builder", "from", "pysb", ".", "bng", "import", "generate_equations", "from", "indra", ".", "assemblers", ".", "sbgn", "import", "SBGNAssembler", "logger", ...
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...
[ "Return", "an", "SBGN", "model", "string", "corresponding", "to", "the", "PySB", "model", "." ]
train
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...
[ "def", "export_kappa_im", "(", "model", ",", "fname", "=", "None", ")", ":", "from", ".", "kappa_util", "import", "im_json_to_graph", "kappa", "=", "_prepare_kappa", "(", "model", ")", "imap", "=", "kappa", ".", "analyses_influence_map", "(", ")", "im", "=",...
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....
[ "Return", "a", "networkx", "graph", "representing", "the", "model", "s", "Kappa", "influence", "map", "." ]
train
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...
[ "def", "export_kappa_cm", "(", "model", ",", "fname", "=", "None", ")", ":", "from", ".", "kappa_util", "import", "cm_json_to_graph", "kappa", "=", "_prepare_kappa", "(", "model", ")", "cmap", "=", "kappa", ".", "analyses_contact_map", "(", ")", "cm", "=", ...
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. ...
[ "Return", "a", "networkx", "graph", "representing", "the", "model", "s", "Kappa", "contact", "map", "." ]
train
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
[ "def", "_prepare_kappa", "(", "model", ")", ":", "import", "kappy", "kappa", "=", "kappy", ".", "KappaStd", "(", ")", "model_str", "=", "export", "(", "model", ",", "'kappa'", ")", "kappa", ".", "add_model_string", "(", "model_str", ")", "kappa", ".", "p...
Return a Kappa STD with the model loaded.
[ "Return", "a", "Kappa", "STD", "with", "the", "model", "loaded", "." ]
train
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...
[ "def", "send_request", "(", "*", "*", "kwargs", ")", ":", "skiprows", "=", "kwargs", ".", "pop", "(", "'skiprows'", ",", "None", ")", "res", "=", "requests", ".", "get", "(", "cbio_url", ",", "params", "=", "kwargs", ")", "if", "res", ".", "status_co...
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 ----...
[ "Return", "a", "data", "frame", "from", "a", "web", "service", "request", "to", "cBio", "portal", "." ]
train
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 :...
[ "def", "get_mutations", "(", "study_id", ",", "gene_list", ",", "mutation_type", "=", "None", ",", "case_id", "=", "None", ")", ":", "genetic_profile", "=", "get_genetic_profiles", "(", "study_id", ",", "'mutation'", ")", "[", "0", "]", "gene_list_str", "=", ...
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...
[ "Return", "mutations", "as", "a", "list", "of", "genes", "and", "list", "of", "amino", "acid", "changes", "." ]
train
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 ...
[ "def", "get_case_lists", "(", "study_id", ")", ":", "data", "=", "{", "'cmd'", ":", "'getCaseLists'", ",", "'cancer_study_id'", ":", "study_id", "}", "df", "=", "send_request", "(", "*", "*", "data", ")", "case_set_ids", "=", "df", "[", "'case_list_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 not make this explicitly clear. ...
[ "Return", "a", "list", "of", "the", "case", "set", "ids", "for", "a", "particular", "study", "." ]
train
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...
[ "def", "get_profile_data", "(", "study_id", ",", "gene_list", ",", "profile_filter", ",", "case_set_filter", "=", "None", ")", ":", "genetic_profiles", "=", "get_genetic_profiles", "(", "study_id", ",", "profile_filter", ")", "if", "genetic_profiles", ":", "genetic_...
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...
[ "Return", "dict", "of", "cases", "and", "genes", "and", "their", "respective", "values", "." ]
train
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...
[ "def", "get_num_sequenced", "(", "study_id", ")", ":", "data", "=", "{", "'cmd'", ":", "'getCaseLists'", ",", "'cancer_study_id'", ":", "study_id", "}", "df", "=", "send_request", "(", "*", "*", "data", ")", "if", "df", ".", "empty", ":", "return", "0", ...
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 ------...
[ "Return", "number", "of", "sequenced", "tumors", "for", "given", "study", "." ]
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L196-L220