repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sorgerlab/indra | indra/sources/reach/api.py | process_pubmed_abstract | def process_pubmed_abstract(pubmed_id, offline=False,
output_fname=default_output_fname, **kwargs):
"""Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
-----... | python | def process_pubmed_abstract(pubmed_id, offline=False,
output_fname=default_output_fname, **kwargs):
"""Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
-----... | [
"def",
"process_pubmed_abstract",
"(",
"pubmed_id",
",",
"offline",
"=",
"False",
",",
"output_fname",
"=",
"default_output_fname",
",",
"**",
"kwargs",
")",
":",
"abs_txt",
"=",
"pubmed_client",
".",
"get_abstract",
"(",
"pubmed_id",
")",
"if",
"abs_txt",
"is",... | Return a ReachProcessor by processing an abstract with a given Pubmed id.
Uses the Pubmed client to get the abstract. If that fails, None is
returned.
Parameters
----------
pubmed_id : str
The ID of a Pubmed article. The string may start with PMID but
passing just the ID also works... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"an",
"abstract",
"with",
"a",
"given",
"Pubmed",
"id",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L77-L115 | train |
sorgerlab/indra | indra/sources/reach/api.py | process_text | def process_text(text, citation=None, offline=False,
output_fname=default_output_fname, timeout=None):
"""Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to ... | python | def process_text(text, citation=None, offline=False,
output_fname=default_output_fname, timeout=None):
"""Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to ... | [
"def",
"process_text",
"(",
"text",
",",
"citation",
"=",
"None",
",",
"offline",
"=",
"False",
",",
"output_fname",
"=",
"default_output_fname",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"offline",
":",
"if",
"not",
"try_offline",
":",
"logger",
".",
... | Return a ReachProcessor by processing the given text.
Parameters
----------
text : str
The text to be processed.
citation : Optional[str]
A PubMed ID passed to be used in the evidence for the extracted INDRA
Statements. This is used when the text to be processed comes from
... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"the",
"given",
"text",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L118-L187 | train |
sorgerlab/indra | indra/sources/reach/api.py | process_nxml_str | def process_nxml_str(nxml_str, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : ... | python | def process_nxml_str(nxml_str, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : ... | [
"def",
"process_nxml_str",
"(",
"nxml_str",
",",
"citation",
"=",
"None",
",",
"offline",
"=",
"False",
",",
"output_fname",
"=",
"default_output_fname",
")",
":",
"if",
"offline",
":",
"if",
"not",
"try_offline",
":",
"logger",
".",
"error",
"(",
"'Offline ... | Return a ReachProcessor by processing the given NXML string.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
nxml_str : str
The NXML string to be processed.
citation : Optional[str]
A PubMed ID passed to be used in the eviden... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"the",
"given",
"NXML",
"string",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L190-L261 | train |
sorgerlab/indra | indra/sources/reach/api.py | process_nxml_file | def process_nxml_file(file_name, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name ... | python | def process_nxml_file(file_name, citation=None, offline=False,
output_fname=default_output_fname):
"""Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name ... | [
"def",
"process_nxml_file",
"(",
"file_name",
",",
"citation",
"=",
"None",
",",
"offline",
"=",
"False",
",",
"output_fname",
"=",
"default_output_fname",
")",
":",
"with",
"open",
"(",
"file_name",
",",
"'rb'",
")",
"as",
"f",
":",
"nxml_str",
"=",
"f",
... | Return a ReachProcessor by processing the given NXML file.
NXML is the format used by PubmedCentral for papers in the open
access subset.
Parameters
----------
file_name : str
The name of the NXML file to be processed.
citation : Optional[str]
A PubMed ID passed to be used in t... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"the",
"given",
"NXML",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L264-L293 | train |
sorgerlab/indra | indra/sources/reach/api.py | process_json_file | def process_json_file(file_name, citation=None):
"""Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: http... | python | def process_json_file(file_name, citation=None):
"""Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: http... | [
"def",
"process_json_file",
"(",
"file_name",
",",
"citation",
"=",
"None",
")",
":",
"try",
":",
"with",
"open",
"(",
"file_name",
",",
"'rb'",
")",
"as",
"fh",
":",
"json_str",
"=",
"fh",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
... | Return a ReachProcessor by processing the given REACH json file.
The output from the REACH parser is in this json format. This function is
useful if the output is saved as a file and needs to be processed.
For more information on the format, see: https://github.com/clulab/reach
Parameters
--------... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"the",
"given",
"REACH",
"json",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L296-L322 | train |
sorgerlab/indra | indra/sources/reach/api.py | process_json_str | def process_json_str(json_str, citation=None):
"""Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
Th... | python | def process_json_str(json_str, citation=None):
"""Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
Th... | [
"def",
"process_json_str",
"(",
"json_str",
",",
"citation",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"json_str",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"'{} is {} instead of {}'",
".",
"format",
"(",
"json_str",
",",
"json_str",... | Return a ReachProcessor by processing the given REACH json string.
The output from the REACH parser is in this json format.
For more information on the format, see: https://github.com/clulab/reach
Parameters
----------
json_str : str
The json string to be processed.
citation : Optional... | [
"Return",
"a",
"ReachProcessor",
"by",
"processing",
"the",
"given",
"REACH",
"json",
"string",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/api.py#L325-L369 | train |
sorgerlab/indra | indra/tools/reading/wait_for_complete.py | make_parser | def make_parser():
"""Generate the parser for this script."""
parser = ArgumentParser(
'wait_for_complete.py',
usage='%(prog)s [-h] queue_name [options]',
description=('Wait for a set of batch jobs to complete, and monitor '
'them as they run.'),
epilog=('Job... | python | def make_parser():
"""Generate the parser for this script."""
parser = ArgumentParser(
'wait_for_complete.py',
usage='%(prog)s [-h] queue_name [options]',
description=('Wait for a set of batch jobs to complete, and monitor '
'them as they run.'),
epilog=('Job... | [
"def",
"make_parser",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"'wait_for_complete.py'",
",",
"usage",
"=",
"'%(prog)s [-h] queue_name [options]'",
",",
"description",
"=",
"(",
"'Wait for a set of batch jobs to complete, and monitor '",
"'them as they run.'",
")"... | Generate the parser for this script. | [
"Generate",
"the",
"parser",
"for",
"this",
"script",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/wait_for_complete.py#L4-L66 | train |
sorgerlab/indra | indra/literature/__init__.py | id_lookup | def id_lookup(paper_id, idtype):
"""Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.... | python | def id_lookup(paper_id, idtype):
"""Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.... | [
"def",
"id_lookup",
"(",
"paper_id",
",",
"idtype",
")",
":",
"if",
"idtype",
"not",
"in",
"(",
"'pmid'",
",",
"'pmcid'",
",",
"'doi'",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid idtype %s; must be 'pmid', 'pmcid', \"",
"\"or 'doi'.\"",
"%",
"idtype",
")",... | Take an ID of type PMID, PMCID, or DOI and lookup the other IDs.
If the DOI is not found in Pubmed, try to obtain the DOI by doing a
reverse-lookup of the DOI in CrossRef using article metadata.
Parameters
----------
paper_id : str
ID of the article.
idtype : str
Type of the ID... | [
"Take",
"an",
"ID",
"of",
"type",
"PMID",
"PMCID",
"or",
"DOI",
"and",
"lookup",
"the",
"other",
"IDs",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/__init__.py#L19-L71 | train |
sorgerlab/indra | indra/literature/__init__.py | get_full_text | def get_full_text(paper_id, idtype, preferred_content_type='text/xml'):
"""Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from P... | python | def get_full_text(paper_id, idtype, preferred_content_type='text/xml'):
"""Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from P... | [
"def",
"get_full_text",
"(",
"paper_id",
",",
"idtype",
",",
"preferred_content_type",
"=",
"'text/xml'",
")",
":",
"if",
"preferred_content_type",
"not",
"in",
"(",
"'text/xml'",
",",
"'text/plain'",
",",
"'application/pdf'",
")",
":",
"raise",
"ValueError",
"(",... | Return the content and the content type of an article.
This function retreives the content of an article by its PubMed ID,
PubMed Central ID, or DOI. It prioritizes full text content when available
and returns an abstract from PubMed as a fallback.
Parameters
----------
paper_id : string
... | [
"Return",
"the",
"content",
"and",
"the",
"content",
"type",
"of",
"an",
"article",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/__init__.py#L74-L244 | train |
sorgerlab/indra | indra/sources/reach/reader.py | ReachReader.get_api_ruler | def get_api_ruler(self):
"""Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object).
"""
if self.api_ruler is None:
try:
... | python | def get_api_ruler(self):
"""Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object).
"""
if self.api_ruler is None:
try:
... | [
"def",
"get_api_ruler",
"(",
"self",
")",
":",
"if",
"self",
".",
"api_ruler",
"is",
"None",
":",
"try",
":",
"self",
".",
"api_ruler",
"=",
"autoclass",
"(",
"'org.clulab.reach.export.apis.ApiRuler'",
")",
"except",
"JavaException",
"as",
"e",
":",
"raise",
... | Return the existing reader if it exists or launch a new one.
Returns
-------
api_ruler : org.clulab.reach.apis.ApiRuler
An instance of the REACH ApiRuler class (java object). | [
"Return",
"the",
"existing",
"reader",
"if",
"it",
"exists",
"or",
"launch",
"a",
"new",
"one",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/reader.py#L55-L69 | train |
sorgerlab/indra | indra/sources/biogrid.py | _download_biogrid_data | def _download_biogrid_data(url):
"""Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipp... | python | def _download_biogrid_data(url):
"""Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipp... | [
"def",
"_download_biogrid_data",
"(",
"url",
")",
":",
"res",
"=",
"requests",
".",
"get",
"(",
"biogrid_file_url",
")",
"if",
"res",
".",
"status_code",
"!=",
"200",
":",
"raise",
"Exception",
"(",
"'Unable to download Biogrid data: status code %s'",
"%",
"res",
... | Downloads zipped, tab-separated Biogrid data in .tab2 format.
Parameters:
-----------
url : str
URL of the BioGrid zip file.
Returns
-------
csv.reader
A csv.reader object for iterating over the rows (header has already
been skipped). | [
"Downloads",
"zipped",
"tab",
"-",
"separated",
"Biogrid",
"data",
"in",
".",
"tab2",
"format",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L156-L185 | train |
sorgerlab/indra | indra/sources/biogrid.py | BiogridProcessor._make_agent | def _make_agent(self, entrez_id, text_id):
"""Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
... | python | def _make_agent(self, entrez_id, text_id):
"""Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
... | [
"def",
"_make_agent",
"(",
"self",
",",
"entrez_id",
",",
"text_id",
")",
":",
"hgnc_name",
",",
"db_refs",
"=",
"self",
".",
"_make_db_refs",
"(",
"entrez_id",
",",
"text_id",
")",
"if",
"hgnc_name",
"is",
"not",
"None",
":",
"name",
"=",
"hgnc_name",
"... | Make an Agent object, appropriately grounded.
Parameters
----------
entrez_id : str
Entrez id number
text_id : str
A plain text systematic name, or None if not listed.
Returns
-------
agent : indra.statements.Agent
A grounded ... | [
"Make",
"an",
"Agent",
"object",
"appropriately",
"grounded",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L97-L121 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biogrid.py#L123-L153 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L24-L87 | train |
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'",
")",
"for",
"bc",
"in",
"agent",
".",
"bound_conditions",
":"... | Add an INDRA Agent and its conditions to the Nugget. | [
"Add",
"an",
"INDRA",
"Agent",
"and",
"its",
"conditions",
"to",
"the",
"Nugget",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L134-L170 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L172-L183 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/kami/assembler.py#L193-L206 | train |
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",
")",
":",
"if",
"python2_path",
"is",
"None",
":",
"for",
"path",
"in",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"split",
"(",
"os",
".",
"pathsep... | 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"... | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L46-L93 | train |
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",
":",
"for",
"cpath",
"in",
"tees_candidate_paths",
":",
"cpath",
"=",
"os",
".",
"path",
".",
"expan... | 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",
".",
... | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L95-L206 | train |
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",
")",
":",
"sentences_glob",
"=",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"'*-preprocessed.xml.gz'",
")",
"sentences_filename_candidates",
"=",
"glob",
".",
"glob",
"(",
"sentences_glob",
")",
"if",
"len... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tees/api.py#L208-L312 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/reader.py#L130-L135 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/reader.py#L80-L127 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L22-L62 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L65-L87 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/api.py#L108-L126 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L46-L102 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L105-L125 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L128-L145 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L148-L169 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L172-L190 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L193-L215 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L218-L251 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L254-L270 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L273-L290 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L293-L309 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L312-L329 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chembl_client.py#L332-L352 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L33-L49 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L51-L66 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L120-L123 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L125-L135 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L137-L140 | train |
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",
"actiontype_words",
"=",
"word_tokenize",
"(",
"self",
".",
"mention",
".",
"actiontype",
")",
"action... | 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... | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/find_full_text_sentence.py#L142-L169 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/__init__.py#L6-L110 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L27-L40 | train |
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",
":",
"if",
"sys",
".",
"version_info",
"[",
... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L43-L78 | train |
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",
"grounding_map"... | Map grounding using the GroundingMapper.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to map.
do_rename : Optional[bool]
If True, Agents are renamed based on their mapped grounding.
grounding_map : Optional[dict]
A user supplied grou... | [
"Map",
"grounding",
"using",
"the",
"GroundingMapper",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L81-L119 | train |
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",
")",
":",
"for",
"idx",
",",
"concept",
"in",
"enumerate",
"(",
"stmt",
".",
"agent_list",
"(",
")",
")",
":",
"if",
"concept",
"is",
"None",
":",
"continue",
... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L122-L201 | train |
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",
":",
"if",
"not",
"isinstance",
"(",
"stmt",
",",
"Influence",
")",
":",
"stmts_out",
".",
"append",
"(",
"stmt",
")",
"continue",
"deltas",
... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L204-L272 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L275-L331 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L334-L398 | train |
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",
"=",
"kwargs... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L401-L426 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L429-L499 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L502-L536 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L566-L581 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L584-L606 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L609-L658 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L661-L686 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L689-L739 | train |
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",
"(",
"stmts_in... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L742-L783 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L786-L890 | train |
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",
"(",
"'match_s... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L962-L1039 | train |
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",
"e... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1042-L1097 | train |
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",
")",
":",
"any_indirect",
"=",
"False",
"for",
"ev",
"in",
"stmt",
".",
"evidence",
":",
"if",
"ev",
".",
"epistemics",
".",
"get",
"(",
"'dire... | 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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1100-L1144 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1147-L1179 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1217-L1258 | train |
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",
"not... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1261-L1284 | train |
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'",
"%",
"len"... | 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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1287-L1348 | train |
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'",
"%",
"len"... | 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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1351-L1406 | train |
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",
".",
"path",
... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1506-L1539 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1579-L1612 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1615-L1651 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1654-L1677 | train |
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",
"in",
... | 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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1680-L1704 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1707-L1738 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1741-L1762 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1765-L1777 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1780-L1813 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/assemble_corpus.py#L1816-L1860 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/util.py#L11-L26 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/util.py#L29-L33 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L646-L752 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L755-L797 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L68-L75 | train |
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",
"(",
")",
"logger",
".",
"debug",
"(",
"'%d statements before removing object duplicates.'",
"%",
"len",
"(",
"stmts",
")",
... | Use the matches_key method to get sets of matching statements. | [
"Use",
"the",
"matches_key",
"method",
"to",
"get",
"sets",
"of",
"matching",
"statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L78-L93 | train |
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",
")",
":",
"def",
"_ev_keys",
"(",
"sts",
")",
":",
"ev_keys",
"=",
"[",
"]",
"for",
"stmt",
"in",
"sts",
":",
"for",
"ev",
"in",
"stmt",
".",
"evidence",
":",
"ev_keys",
".",
"append",
"(",
"ev",
".",
... | 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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L96-L186 | train |
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",
")",
":",
"stmt_by_first",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"[",
"]",
")",
"stmt_by_second",
"=",
"collections",
".",
"defaultdict",
"(",
... | Group Statements of `stmt_type` by their hierarchical relations. | [
"Group",
"Statements",
"of",
"stmt_type",
"by",
"their",
"hierarchical",
"relations",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L220-L326 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L428-L563 | train |
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'",
"]",
"stmts_by_type",
"=",
"collections",
".",
"defaultdict",
"(",
"lambda",
":",
"[",
"]",
")",
"for",
"idx",
",",
"stmt",
"in",
"enumerate",
"(",
... | Return pairs of contradicting Statements.
Returns
-------
contradicts : list(tuple(Statement, Statement))
A list of Statement pairs that are contradicting. | [
"Return",
"pairs",
"of",
"contradicting",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/__init__.py#L565-L608 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L46-L84 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L87-L114 | train |
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"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/deft_tools.py#L117-L143 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L15-L23 | train |
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",
"location",
"is",
"not",
"None",
"and",
"cellular_components",
".",
"get",
"(",
"location",
")",
"is",
"None",
":",
"loc",
"=",
"cellular_components_reverse",
".",
"get",
"(",
"location",
")",
"if... | Check if the given location represents a valid cellular component. | [
"Check",
"if",
"the",
"given",
"location",
"represents",
"a",
"valid",
"cellular",
"component",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L26-L35 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L38-L52 | train |
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",
"(",
")",
":",
"this_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"cc_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"this_dir",
",",
"os",
".",... | Read cellular components from a resource file. | [
"Read",
"cellular",
"components",
"from",
"a",
"resource",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L58-L86 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/resources.py#L92-L109 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L9-L82 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L85-L113 | train |
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",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L116-L138 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.