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/literature/elsevier_client.py | download_article | def download_article(id_val, id_type='doi', on_retry=False):
"""Low level function to get an XML article for a particular id.
Parameters
----------
id_val : str
The value of the id.
id_type : str
The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid.
on_retry : bool
... | python | def download_article(id_val, id_type='doi', on_retry=False):
"""Low level function to get an XML article for a particular id.
Parameters
----------
id_val : str
The value of the id.
id_type : str
The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid.
on_retry : bool
... | [
"def",
"download_article",
"(",
"id_val",
",",
"id_type",
"=",
"'doi'",
",",
"on_retry",
"=",
"False",
")",
":",
"if",
"id_type",
"==",
"'pmid'",
":",
"id_type",
"=",
"'pubmed_id'",
"url",
"=",
"'%s/%s'",
"%",
"(",
"elsevier_article_url_fmt",
"%",
"id_type",... | Low level function to get an XML article for a particular id.
Parameters
----------
id_val : str
The value of the id.
id_type : str
The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid.
on_retry : bool
This function has a recursive retry feature, and this is the only... | [
"Low",
"level",
"function",
"to",
"get",
"an",
"XML",
"article",
"for",
"a",
"particular",
"id",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L110-L158 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | download_article_from_ids | def download_article_from_ids(**id_dict):
"""Download an article in XML format from Elsevier matching the set of ids.
Parameters
----------
<id_type> : str
You can enter any combination of eid, doi, pmid, and/or pii. Ids will be
checked in that order, until either content has been found... | python | def download_article_from_ids(**id_dict):
"""Download an article in XML format from Elsevier matching the set of ids.
Parameters
----------
<id_type> : str
You can enter any combination of eid, doi, pmid, and/or pii. Ids will be
checked in that order, until either content has been found... | [
"def",
"download_article_from_ids",
"(",
"**",
"id_dict",
")",
":",
"valid_id_types",
"=",
"[",
"'eid'",
",",
"'doi'",
",",
"'pmid'",
",",
"'pii'",
"]",
"assert",
"all",
"(",
"[",
"k",
"in",
"valid_id_types",
"for",
"k",
"in",
"id_dict",
".",
"keys",
"("... | Download an article in XML format from Elsevier matching the set of ids.
Parameters
----------
<id_type> : str
You can enter any combination of eid, doi, pmid, and/or pii. Ids will be
checked in that order, until either content has been found or all ids
have been checked.
Retur... | [
"Download",
"an",
"article",
"in",
"XML",
"format",
"from",
"Elsevier",
"matching",
"the",
"set",
"of",
"ids",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L161-L192 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | get_abstract | def get_abstract(doi):
"""Get the abstract text of an article from Elsevier given a doi."""
xml_string = download_article(doi)
if xml_string is None:
return None
assert isinstance(xml_string, str)
xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB())
if xml_tree is None:
re... | python | def get_abstract(doi):
"""Get the abstract text of an article from Elsevier given a doi."""
xml_string = download_article(doi)
if xml_string is None:
return None
assert isinstance(xml_string, str)
xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB())
if xml_tree is None:
re... | [
"def",
"get_abstract",
"(",
"doi",
")",
":",
"xml_string",
"=",
"download_article",
"(",
"doi",
")",
"if",
"xml_string",
"is",
"None",
":",
"return",
"None",
"assert",
"isinstance",
"(",
"xml_string",
",",
"str",
")",
"xml_tree",
"=",
"ET",
".",
"XML",
"... | Get the abstract text of an article from Elsevier given a doi. | [
"Get",
"the",
"abstract",
"text",
"of",
"an",
"article",
"from",
"Elsevier",
"given",
"a",
"doi",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L195-L207 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | get_article | def get_article(doi, output_format='txt'):
"""Get the full body of an article from Elsevier.
Parameters
----------
doi : str
The doi for the desired article.
output_format : 'txt' or 'xml'
The desired format for the output. Selecting 'txt' (default) strips all
xml tags and j... | python | def get_article(doi, output_format='txt'):
"""Get the full body of an article from Elsevier.
Parameters
----------
doi : str
The doi for the desired article.
output_format : 'txt' or 'xml'
The desired format for the output. Selecting 'txt' (default) strips all
xml tags and j... | [
"def",
"get_article",
"(",
"doi",
",",
"output_format",
"=",
"'txt'",
")",
":",
"xml_string",
"=",
"download_article",
"(",
"doi",
")",
"if",
"output_format",
"==",
"'txt'",
"and",
"xml_string",
"is",
"not",
"None",
":",
"text",
"=",
"extract_text",
"(",
"... | Get the full body of an article from Elsevier.
Parameters
----------
doi : str
The doi for the desired article.
output_format : 'txt' or 'xml'
The desired format for the output. Selecting 'txt' (default) strips all
xml tags and joins the pieces of text in the main text, while 'x... | [
"Get",
"the",
"full",
"body",
"of",
"an",
"article",
"from",
"Elsevier",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L210-L233 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | extract_paragraphs | def extract_paragraphs(xml_string):
"""Get paragraphs from the body of the given Elsevier xml."""
assert isinstance(xml_string, str)
xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB())
full_text = xml_tree.find('article:originalText', elsevier_ns)
if full_text is None:
logger.info('C... | python | def extract_paragraphs(xml_string):
"""Get paragraphs from the body of the given Elsevier xml."""
assert isinstance(xml_string, str)
xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB())
full_text = xml_tree.find('article:originalText', elsevier_ns)
if full_text is None:
logger.info('C... | [
"def",
"extract_paragraphs",
"(",
"xml_string",
")",
":",
"assert",
"isinstance",
"(",
"xml_string",
",",
"str",
")",
"xml_tree",
"=",
"ET",
".",
"XML",
"(",
"xml_string",
".",
"encode",
"(",
"'utf-8'",
")",
",",
"parser",
"=",
"UTB",
"(",
")",
")",
"f... | Get paragraphs from the body of the given Elsevier xml. | [
"Get",
"paragraphs",
"from",
"the",
"body",
"of",
"the",
"given",
"Elsevier",
"xml",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L245-L259 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | get_dois | def get_dois(query_str, count=100):
"""Search ScienceDirect through the API for articles.
See http://api.elsevier.com/content/search/fields/scidir for constructing a
query string to pass here. Example: 'abstract(BRAF) AND all("colorectal
cancer")'
"""
url = '%s/%s' % (elsevier_search_url, quer... | python | def get_dois(query_str, count=100):
"""Search ScienceDirect through the API for articles.
See http://api.elsevier.com/content/search/fields/scidir for constructing a
query string to pass here. Example: 'abstract(BRAF) AND all("colorectal
cancer")'
"""
url = '%s/%s' % (elsevier_search_url, quer... | [
"def",
"get_dois",
"(",
"query_str",
",",
"count",
"=",
"100",
")",
":",
"url",
"=",
"'%s/%s'",
"%",
"(",
"elsevier_search_url",
",",
"query_str",
")",
"params",
"=",
"{",
"'query'",
":",
"query_str",
",",
"'count'",
":",
"count",
",",
"'httpAccept'",
":... | Search ScienceDirect through the API for articles.
See http://api.elsevier.com/content/search/fields/scidir for constructing a
query string to pass here. Example: 'abstract(BRAF) AND all("colorectal
cancer")' | [
"Search",
"ScienceDirect",
"through",
"the",
"API",
"for",
"articles",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L264-L283 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | get_piis | def get_piis(query_str):
"""Search ScienceDirect through the API for articles and return PIIs.
Note that ScienceDirect has a limitation in which a maximum of 6,000
PIIs can be retrieved for a given search and therefore this call is
internally broken up into multiple queries by a range of years and the
... | python | def get_piis(query_str):
"""Search ScienceDirect through the API for articles and return PIIs.
Note that ScienceDirect has a limitation in which a maximum of 6,000
PIIs can be retrieved for a given search and therefore this call is
internally broken up into multiple queries by a range of years and the
... | [
"def",
"get_piis",
"(",
"query_str",
")",
":",
"dates",
"=",
"range",
"(",
"1960",
",",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
".",
"year",
")",
"all_piis",
"=",
"flatten",
"(",
"[",
"get_piis_for_date",
"(",
"query_str",
",",
"date",
")",
... | Search ScienceDirect through the API for articles and return PIIs.
Note that ScienceDirect has a limitation in which a maximum of 6,000
PIIs can be retrieved for a given search and therefore this call is
internally broken up into multiple queries by a range of years and the
results are combined.
P... | [
"Search",
"ScienceDirect",
"through",
"the",
"API",
"for",
"articles",
"and",
"return",
"PIIs",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L286-L306 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | get_piis_for_date | def get_piis_for_date(query_str, date):
"""Search ScienceDirect with a query string constrained to a given year.
Parameters
----------
query_str : str
The query string to search with
date : str
The year to constrain the search to
Returns
-------
piis : list[str]
... | python | def get_piis_for_date(query_str, date):
"""Search ScienceDirect with a query string constrained to a given year.
Parameters
----------
query_str : str
The query string to search with
date : str
The year to constrain the search to
Returns
-------
piis : list[str]
... | [
"def",
"get_piis_for_date",
"(",
"query_str",
",",
"date",
")",
":",
"count",
"=",
"200",
"params",
"=",
"{",
"'query'",
":",
"query_str",
",",
"'count'",
":",
"count",
",",
"'start'",
":",
"0",
",",
"'sort'",
":",
"'-coverdate'",
",",
"'date'",
":",
"... | Search ScienceDirect with a query string constrained to a given year.
Parameters
----------
query_str : str
The query string to search with
date : str
The year to constrain the search to
Returns
-------
piis : list[str]
The list of PIIs identifying the papers return... | [
"Search",
"ScienceDirect",
"with",
"a",
"query",
"string",
"constrained",
"to",
"a",
"given",
"year",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L311-L358 | train |
sorgerlab/indra | indra/literature/elsevier_client.py | download_from_search | def download_from_search(query_str, folder, do_extract_text=True,
max_results=None):
"""Save raw text files based on a search for papers on ScienceDirect.
This performs a search to get PIIs, downloads the XML corresponding to
the PII, extracts the raw text and then saves the text i... | python | def download_from_search(query_str, folder, do_extract_text=True,
max_results=None):
"""Save raw text files based on a search for papers on ScienceDirect.
This performs a search to get PIIs, downloads the XML corresponding to
the PII, extracts the raw text and then saves the text i... | [
"def",
"download_from_search",
"(",
"query_str",
",",
"folder",
",",
"do_extract_text",
"=",
"True",
",",
"max_results",
"=",
"None",
")",
":",
"piis",
"=",
"get_piis",
"(",
"query_str",
")",
"for",
"pii",
"in",
"piis",
"[",
":",
"max_results",
"]",
":",
... | Save raw text files based on a search for papers on ScienceDirect.
This performs a search to get PIIs, downloads the XML corresponding to
the PII, extracts the raw text and then saves the text into a file
in the designated folder.
Parameters
----------
query_str : str
The query string ... | [
"Save",
"raw",
"text",
"files",
"based",
"on",
"a",
"search",
"for",
"papers",
"on",
"ScienceDirect",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L361-L400 | train |
sorgerlab/indra | indra/sources/cwms/rdf_processor.py | CWMSRDFProcessor.extract_statement_from_query_result | def extract_statement_from_query_result(self, res):
"""Adds a statement based on one element of a rdflib SPARQL query.
Parameters
----------
res: rdflib.query.ResultRow
Element of rdflib SPARQL query result
"""
agent_start, agent_end, affected_start, affected... | python | def extract_statement_from_query_result(self, res):
"""Adds a statement based on one element of a rdflib SPARQL query.
Parameters
----------
res: rdflib.query.ResultRow
Element of rdflib SPARQL query result
"""
agent_start, agent_end, affected_start, affected... | [
"def",
"extract_statement_from_query_result",
"(",
"self",
",",
"res",
")",
":",
"agent_start",
",",
"agent_end",
",",
"affected_start",
",",
"affected_end",
"=",
"res",
"agent_start",
"=",
"int",
"(",
"agent_start",
")",
"agent_end",
"=",
"int",
"(",
"agent_end... | Adds a statement based on one element of a rdflib SPARQL query.
Parameters
----------
res: rdflib.query.ResultRow
Element of rdflib SPARQL query result | [
"Adds",
"a",
"statement",
"based",
"on",
"one",
"element",
"of",
"a",
"rdflib",
"SPARQL",
"query",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/rdf_processor.py#L45-L77 | train |
sorgerlab/indra | indra/sources/cwms/rdf_processor.py | CWMSRDFProcessor.extract_statements | def extract_statements(self):
"""Extracts INDRA statements from the RDF graph via SPARQL queries.
"""
# Look for events that have an AGENT and an AFFECTED, and get the
# start and ending text indices for each.
query = prefixes + """
SELECT
?agent_start
... | python | def extract_statements(self):
"""Extracts INDRA statements from the RDF graph via SPARQL queries.
"""
# Look for events that have an AGENT and an AFFECTED, and get the
# start and ending text indices for each.
query = prefixes + """
SELECT
?agent_start
... | [
"def",
"extract_statements",
"(",
"self",
")",
":",
"query",
"=",
"prefixes",
"+",
"results",
"=",
"self",
".",
"graph",
".",
"query",
"(",
"query",
")",
"for",
"res",
"in",
"results",
":",
"self",
".",
"extract_statement_from_query_result",
"(",
"res",
")... | Extracts INDRA statements from the RDF graph via SPARQL queries. | [
"Extracts",
"INDRA",
"statements",
"from",
"the",
"RDF",
"graph",
"via",
"SPARQL",
"queries",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/rdf_processor.py#L79-L111 | train |
sorgerlab/indra | indra/sources/signor/processor.py | SignorProcessor._recursively_lookup_complex | def _recursively_lookup_complex(self, complex_id):
"""Looks up the constitutents of a complex. If any constituent is
itself a complex, recursively expands until all constituents are
not complexes."""
assert complex_id in self.complex_map
expanded_agent_strings = []
expan... | python | def _recursively_lookup_complex(self, complex_id):
"""Looks up the constitutents of a complex. If any constituent is
itself a complex, recursively expands until all constituents are
not complexes."""
assert complex_id in self.complex_map
expanded_agent_strings = []
expan... | [
"def",
"_recursively_lookup_complex",
"(",
"self",
",",
"complex_id",
")",
":",
"assert",
"complex_id",
"in",
"self",
".",
"complex_map",
"expanded_agent_strings",
"=",
"[",
"]",
"expand_these_next",
"=",
"[",
"complex_id",
"]",
"while",
"len",
"(",
"expand_these_... | Looks up the constitutents of a complex. If any constituent is
itself a complex, recursively expands until all constituents are
not complexes. | [
"Looks",
"up",
"the",
"constitutents",
"of",
"a",
"complex",
".",
"If",
"any",
"constituent",
"is",
"itself",
"a",
"complex",
"recursively",
"expands",
"until",
"all",
"constituents",
"are",
"not",
"complexes",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/signor/processor.py#L223-L244 | train |
sorgerlab/indra | indra/sources/signor/processor.py | SignorProcessor._get_complex_agents | def _get_complex_agents(self, complex_id):
"""Returns a list of agents corresponding to each of the constituents
in a SIGNOR complex."""
agents = []
components = self._recursively_lookup_complex(complex_id)
for c in components:
db_refs = {}
name = uniprot... | python | def _get_complex_agents(self, complex_id):
"""Returns a list of agents corresponding to each of the constituents
in a SIGNOR complex."""
agents = []
components = self._recursively_lookup_complex(complex_id)
for c in components:
db_refs = {}
name = uniprot... | [
"def",
"_get_complex_agents",
"(",
"self",
",",
"complex_id",
")",
":",
"agents",
"=",
"[",
"]",
"components",
"=",
"self",
".",
"_recursively_lookup_complex",
"(",
"complex_id",
")",
"for",
"c",
"in",
"components",
":",
"db_refs",
"=",
"{",
"}",
"name",
"... | Returns a list of agents corresponding to each of the constituents
in a SIGNOR complex. | [
"Returns",
"a",
"list",
"of",
"agents",
"corresponding",
"to",
"each",
"of",
"the",
"constituents",
"in",
"a",
"SIGNOR",
"complex",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/signor/processor.py#L246-L280 | train |
sorgerlab/indra | indra/statements/io.py | stmts_from_json | def stmts_from_json(json_in, on_missing_support='handle'):
"""Get a list of Statements from Statement jsons.
In the case of pre-assembled Statements which have `supports` and
`supported_by` lists, the uuids will be replaced with references to
Statement objects from the json, where possible. The method ... | python | def stmts_from_json(json_in, on_missing_support='handle'):
"""Get a list of Statements from Statement jsons.
In the case of pre-assembled Statements which have `supports` and
`supported_by` lists, the uuids will be replaced with references to
Statement objects from the json, where possible. The method ... | [
"def",
"stmts_from_json",
"(",
"json_in",
",",
"on_missing_support",
"=",
"'handle'",
")",
":",
"stmts",
"=",
"[",
"]",
"uuid_dict",
"=",
"{",
"}",
"for",
"json_stmt",
"in",
"json_in",
":",
"try",
":",
"st",
"=",
"Statement",
".",
"_from_json",
"(",
"jso... | Get a list of Statements from Statement jsons.
In the case of pre-assembled Statements which have `supports` and
`supported_by` lists, the uuids will be replaced with references to
Statement objects from the json, where possible. The method of handling
missing support is controled by the `on_missing_su... | [
"Get",
"a",
"list",
"of",
"Statements",
"from",
"Statement",
"jsons",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L16-L64 | train |
sorgerlab/indra | indra/statements/io.py | stmts_to_json_file | def stmts_to_json_file(stmts, fname):
"""Serialize a list of INDRA Statements into a JSON file.
Parameters
----------
stmts : list[indra.statement.Statements]
The list of INDRA Statements to serialize into the JSON file.
fname : str
Path to the JSON file to serialize Statements into... | python | def stmts_to_json_file(stmts, fname):
"""Serialize a list of INDRA Statements into a JSON file.
Parameters
----------
stmts : list[indra.statement.Statements]
The list of INDRA Statements to serialize into the JSON file.
fname : str
Path to the JSON file to serialize Statements into... | [
"def",
"stmts_to_json_file",
"(",
"stmts",
",",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'w'",
")",
"as",
"fh",
":",
"json",
".",
"dump",
"(",
"stmts_to_json",
"(",
"stmts",
")",
",",
"fh",
",",
"indent",
"=",
"1",
")"
] | Serialize a list of INDRA Statements into a JSON file.
Parameters
----------
stmts : list[indra.statement.Statements]
The list of INDRA Statements to serialize into the JSON file.
fname : str
Path to the JSON file to serialize Statements into. | [
"Serialize",
"a",
"list",
"of",
"INDRA",
"Statements",
"into",
"a",
"JSON",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L84-L95 | train |
sorgerlab/indra | indra/statements/io.py | stmts_to_json | def stmts_to_json(stmts_in, use_sbo=False):
"""Return the JSON-serialized form of one or more INDRA Statements.
Parameters
----------
stmts_in : Statement or list[Statement]
A Statement or list of Statement objects to serialize into JSON.
use_sbo : Optional[bool]
If True, SBO annota... | python | def stmts_to_json(stmts_in, use_sbo=False):
"""Return the JSON-serialized form of one or more INDRA Statements.
Parameters
----------
stmts_in : Statement or list[Statement]
A Statement or list of Statement objects to serialize into JSON.
use_sbo : Optional[bool]
If True, SBO annota... | [
"def",
"stmts_to_json",
"(",
"stmts_in",
",",
"use_sbo",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"stmts_in",
",",
"list",
")",
":",
"json_dict",
"=",
"stmts_in",
".",
"to_json",
"(",
"use_sbo",
"=",
"use_sbo",
")",
"return",
"json_dict",
... | Return the JSON-serialized form of one or more INDRA Statements.
Parameters
----------
stmts_in : Statement or list[Statement]
A Statement or list of Statement objects to serialize into JSON.
use_sbo : Optional[bool]
If True, SBO annotations are added to each applicable element of the
... | [
"Return",
"the",
"JSON",
"-",
"serialized",
"form",
"of",
"one",
"or",
"more",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L98-L119 | train |
sorgerlab/indra | indra/statements/io.py | _promote_support | def _promote_support(sup_list, uuid_dict, on_missing='handle'):
"""Promote the list of support-related uuids to Statements, if possible."""
valid_handling_choices = ['handle', 'error', 'ignore']
if on_missing not in valid_handling_choices:
raise InputError('Invalid option for `on_missing_support`: \... | python | def _promote_support(sup_list, uuid_dict, on_missing='handle'):
"""Promote the list of support-related uuids to Statements, if possible."""
valid_handling_choices = ['handle', 'error', 'ignore']
if on_missing not in valid_handling_choices:
raise InputError('Invalid option for `on_missing_support`: \... | [
"def",
"_promote_support",
"(",
"sup_list",
",",
"uuid_dict",
",",
"on_missing",
"=",
"'handle'",
")",
":",
"valid_handling_choices",
"=",
"[",
"'handle'",
",",
"'error'",
",",
"'ignore'",
"]",
"if",
"on_missing",
"not",
"in",
"valid_handling_choices",
":",
"rai... | Promote the list of support-related uuids to Statements, if possible. | [
"Promote",
"the",
"list",
"of",
"support",
"-",
"related",
"uuids",
"to",
"Statements",
"if",
"possible",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L122-L139 | train |
sorgerlab/indra | indra/statements/io.py | draw_stmt_graph | def draw_stmt_graph(stmts):
"""Render the attributes of a list of Statements as directed graphs.
The layout works well for a single Statement or a few Statements at a time.
This function displays the plot of the graph using plt.show().
Parameters
----------
stmts : list[indra.statements.Statem... | python | def draw_stmt_graph(stmts):
"""Render the attributes of a list of Statements as directed graphs.
The layout works well for a single Statement or a few Statements at a time.
This function displays the plot of the graph using plt.show().
Parameters
----------
stmts : list[indra.statements.Statem... | [
"def",
"draw_stmt_graph",
"(",
"stmts",
")",
":",
"import",
"networkx",
"try",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"except",
"Exception",
":",
"logger",
".",
"error",
"(",
"'Could not import matplotlib, not drawing graph.'",
")",
"return",
"tr... | Render the attributes of a list of Statements as directed graphs.
The layout works well for a single Statement or a few Statements at a time.
This function displays the plot of the graph using plt.show().
Parameters
----------
stmts : list[indra.statements.Statement]
A list of one or more ... | [
"Render",
"the",
"attributes",
"of",
"a",
"list",
"of",
"Statements",
"as",
"directed",
"graphs",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L142-L201 | train |
sorgerlab/indra | indra/sources/sparser/processor.py | _fix_json_agents | def _fix_json_agents(ag_obj):
"""Fix the json representation of an agent."""
if isinstance(ag_obj, str):
logger.info("Fixing string agent: %s." % ag_obj)
ret = {'name': ag_obj, 'db_refs': {'TEXT': ag_obj}}
elif isinstance(ag_obj, list):
# Recursive for complexes and similar.
... | python | def _fix_json_agents(ag_obj):
"""Fix the json representation of an agent."""
if isinstance(ag_obj, str):
logger.info("Fixing string agent: %s." % ag_obj)
ret = {'name': ag_obj, 'db_refs': {'TEXT': ag_obj}}
elif isinstance(ag_obj, list):
# Recursive for complexes and similar.
... | [
"def",
"_fix_json_agents",
"(",
"ag_obj",
")",
":",
"if",
"isinstance",
"(",
"ag_obj",
",",
"str",
")",
":",
"logger",
".",
"info",
"(",
"\"Fixing string agent: %s.\"",
"%",
"ag_obj",
")",
"ret",
"=",
"{",
"'name'",
":",
"ag_obj",
",",
"'db_refs'",
":",
... | Fix the json representation of an agent. | [
"Fix",
"the",
"json",
"representation",
"of",
"an",
"agent",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/sparser/processor.py#L23-L37 | train |
sorgerlab/indra | indra/sources/sparser/processor.py | SparserJSONProcessor.set_statements_pmid | def set_statements_pmid(self, pmid):
"""Set the evidence PMID of Statements that have been extracted.
Parameters
----------
pmid : str or None
The PMID to be used in the Evidence objects of the Statements
that were extracted by the processor.
"""
... | python | def set_statements_pmid(self, pmid):
"""Set the evidence PMID of Statements that have been extracted.
Parameters
----------
pmid : str or None
The PMID to be used in the Evidence objects of the Statements
that were extracted by the processor.
"""
... | [
"def",
"set_statements_pmid",
"(",
"self",
",",
"pmid",
")",
":",
"for",
"stmt",
"in",
"self",
".",
"json_stmts",
":",
"evs",
"=",
"stmt",
".",
"get",
"(",
"'evidence'",
",",
"[",
"]",
")",
"for",
"ev",
"in",
"evs",
":",
"ev",
"[",
"'pmid'",
"]",
... | Set the evidence PMID of Statements that have been extracted.
Parameters
----------
pmid : str or None
The PMID to be used in the Evidence objects of the Statements
that were extracted by the processor. | [
"Set",
"the",
"evidence",
"PMID",
"of",
"Statements",
"that",
"have",
"been",
"extracted",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/sparser/processor.py#L155-L172 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | get_args | def get_args(node):
"""Return the arguments of a node in the event graph."""
arg_roles = {}
args = node.findall('arg') + \
[node.find('arg1'), node.find('arg2'), node.find('arg3')]
for arg in args:
if arg is not None:
id = arg.attrib.get('id')
if id is not None:
... | python | def get_args(node):
"""Return the arguments of a node in the event graph."""
arg_roles = {}
args = node.findall('arg') + \
[node.find('arg1'), node.find('arg2'), node.find('arg3')]
for arg in args:
if arg is not None:
id = arg.attrib.get('id')
if id is not None:
... | [
"def",
"get_args",
"(",
"node",
")",
":",
"arg_roles",
"=",
"{",
"}",
"args",
"=",
"node",
".",
"findall",
"(",
"'arg'",
")",
"+",
"[",
"node",
".",
"find",
"(",
"'arg1'",
")",
",",
"node",
".",
"find",
"(",
"'arg2'",
")",
",",
"node",
".",
"fi... | Return the arguments of a node in the event graph. | [
"Return",
"the",
"arguments",
"of",
"a",
"node",
"in",
"the",
"event",
"graph",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L20-L47 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | type_match | def type_match(a, b):
"""Return True of the types of a and b are compatible, False otherwise."""
# If the types are the same, return True
if a['type'] == b['type']:
return True
# Otherwise, look at some special cases
eq_groups = [
{'ONT::GENE-PROTEIN', 'ONT::GENE', 'ONT::PROTEIN'},
... | python | def type_match(a, b):
"""Return True of the types of a and b are compatible, False otherwise."""
# If the types are the same, return True
if a['type'] == b['type']:
return True
# Otherwise, look at some special cases
eq_groups = [
{'ONT::GENE-PROTEIN', 'ONT::GENE', 'ONT::PROTEIN'},
... | [
"def",
"type_match",
"(",
"a",
",",
"b",
")",
":",
"if",
"a",
"[",
"'type'",
"]",
"==",
"b",
"[",
"'type'",
"]",
":",
"return",
"True",
"eq_groups",
"=",
"[",
"{",
"'ONT::GENE-PROTEIN'",
",",
"'ONT::GENE'",
",",
"'ONT::PROTEIN'",
"}",
",",
"{",
"'ONT... | Return True of the types of a and b are compatible, False otherwise. | [
"Return",
"True",
"of",
"the",
"types",
"of",
"a",
"and",
"b",
"are",
"compatible",
"False",
"otherwise",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L58-L71 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | add_graph | def add_graph(patterns, G):
"""Add a graph to a set of unique patterns."""
if not patterns:
patterns.append([G])
return
for i, graphs in enumerate(patterns):
if networkx.is_isomorphic(graphs[0], G, node_match=type_match,
edge_match=type_match):
... | python | def add_graph(patterns, G):
"""Add a graph to a set of unique patterns."""
if not patterns:
patterns.append([G])
return
for i, graphs in enumerate(patterns):
if networkx.is_isomorphic(graphs[0], G, node_match=type_match,
edge_match=type_match):
... | [
"def",
"add_graph",
"(",
"patterns",
",",
"G",
")",
":",
"if",
"not",
"patterns",
":",
"patterns",
".",
"append",
"(",
"[",
"G",
"]",
")",
"return",
"for",
"i",
",",
"graphs",
"in",
"enumerate",
"(",
"patterns",
")",
":",
"if",
"networkx",
".",
"is... | Add a graph to a set of unique patterns. | [
"Add",
"a",
"graph",
"to",
"a",
"set",
"of",
"unique",
"patterns",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L74-L84 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | draw | def draw(graph, fname):
"""Draw a graph and save it into a file"""
ag = networkx.nx_agraph.to_agraph(graph)
ag.draw(fname, prog='dot') | python | def draw(graph, fname):
"""Draw a graph and save it into a file"""
ag = networkx.nx_agraph.to_agraph(graph)
ag.draw(fname, prog='dot') | [
"def",
"draw",
"(",
"graph",
",",
"fname",
")",
":",
"ag",
"=",
"networkx",
".",
"nx_agraph",
".",
"to_agraph",
"(",
"graph",
")",
"ag",
".",
"draw",
"(",
"fname",
",",
"prog",
"=",
"'dot'",
")"
] | Draw a graph and save it into a file | [
"Draw",
"a",
"graph",
"and",
"save",
"it",
"into",
"a",
"file"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L87-L90 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | build_event_graph | def build_event_graph(graph, tree, node):
"""Return a DiGraph of a specific event structure, built recursively"""
# If we have already added this node then let's return
if node_key(node) in graph:
return
type = get_type(node)
text = get_text(node)
label = '%s (%s)' % (type, text)
gra... | python | def build_event_graph(graph, tree, node):
"""Return a DiGraph of a specific event structure, built recursively"""
# If we have already added this node then let's return
if node_key(node) in graph:
return
type = get_type(node)
text = get_text(node)
label = '%s (%s)' % (type, text)
gra... | [
"def",
"build_event_graph",
"(",
"graph",
",",
"tree",
",",
"node",
")",
":",
"if",
"node_key",
"(",
"node",
")",
"in",
"graph",
":",
"return",
"type",
"=",
"get_type",
"(",
"node",
")",
"text",
"=",
"get_text",
"(",
"node",
")",
"label",
"=",
"'%s (... | Return a DiGraph of a specific event structure, built recursively | [
"Return",
"a",
"DiGraph",
"of",
"a",
"specific",
"event",
"structure",
"built",
"recursively"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L107-L123 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | get_extracted_events | def get_extracted_events(fnames):
"""Get a full list of all extracted event IDs from a list of EKB files"""
event_list = []
for fn in fnames:
tp = trips.process_xml_file(fn)
ed = tp.extracted_events
for k, v in ed.items():
event_list += v
return event_list | python | def get_extracted_events(fnames):
"""Get a full list of all extracted event IDs from a list of EKB files"""
event_list = []
for fn in fnames:
tp = trips.process_xml_file(fn)
ed = tp.extracted_events
for k, v in ed.items():
event_list += v
return event_list | [
"def",
"get_extracted_events",
"(",
"fnames",
")",
":",
"event_list",
"=",
"[",
"]",
"for",
"fn",
"in",
"fnames",
":",
"tp",
"=",
"trips",
".",
"process_xml_file",
"(",
"fn",
")",
"ed",
"=",
"tp",
".",
"extracted_events",
"for",
"k",
",",
"v",
"in",
... | Get a full list of all extracted event IDs from a list of EKB files | [
"Get",
"a",
"full",
"list",
"of",
"all",
"extracted",
"event",
"IDs",
"from",
"a",
"list",
"of",
"EKB",
"files"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L126-L134 | train |
sorgerlab/indra | indra/sources/trips/analyze_ekbs.py | check_event_coverage | def check_event_coverage(patterns, event_list):
"""Calculate the ratio of patterns that were extracted."""
proportions = []
for pattern_list in patterns:
proportion = 0
for pattern in pattern_list:
for node in pattern.nodes():
if node in event_list:
... | python | def check_event_coverage(patterns, event_list):
"""Calculate the ratio of patterns that were extracted."""
proportions = []
for pattern_list in patterns:
proportion = 0
for pattern in pattern_list:
for node in pattern.nodes():
if node in event_list:
... | [
"def",
"check_event_coverage",
"(",
"patterns",
",",
"event_list",
")",
":",
"proportions",
"=",
"[",
"]",
"for",
"pattern_list",
"in",
"patterns",
":",
"proportion",
"=",
"0",
"for",
"pattern",
"in",
"pattern_list",
":",
"for",
"node",
"in",
"pattern",
".",... | Calculate the ratio of patterns that were extracted. | [
"Calculate",
"the",
"ratio",
"of",
"patterns",
"that",
"were",
"extracted",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L137-L148 | train |
sorgerlab/indra | indra/preassembler/ontology_mapper.py | OntologyMapper.map_statements | def map_statements(self):
"""Run the ontology mapping on the statements."""
for stmt in self.statements:
for agent in stmt.agent_list():
if agent is None:
continue
all_mappings = []
for db_name, db_id in agent.db_refs.items(... | python | def map_statements(self):
"""Run the ontology mapping on the statements."""
for stmt in self.statements:
for agent in stmt.agent_list():
if agent is None:
continue
all_mappings = []
for db_name, db_id in agent.db_refs.items(... | [
"def",
"map_statements",
"(",
"self",
")",
":",
"for",
"stmt",
"in",
"self",
".",
"statements",
":",
"for",
"agent",
"in",
"stmt",
".",
"agent_list",
"(",
")",
":",
"if",
"agent",
"is",
"None",
":",
"continue",
"all_mappings",
"=",
"[",
"]",
"for",
"... | Run the ontology mapping on the statements. | [
"Run",
"the",
"ontology",
"mapping",
"on",
"the",
"statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/ontology_mapper.py#L45-L74 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | load_grounding_map | def load_grounding_map(grounding_map_path, ignore_path=None,
lineterminator='\r\n'):
"""Return a grounding map dictionary loaded from a csv file.
In the file pointed to by grounding_map_path, the number of name_space ID
pairs can vary per row and commas are
used to pad out entrie... | python | def load_grounding_map(grounding_map_path, ignore_path=None,
lineterminator='\r\n'):
"""Return a grounding map dictionary loaded from a csv file.
In the file pointed to by grounding_map_path, the number of name_space ID
pairs can vary per row and commas are
used to pad out entrie... | [
"def",
"load_grounding_map",
"(",
"grounding_map_path",
",",
"ignore_path",
"=",
"None",
",",
"lineterminator",
"=",
"'\\r\\n'",
")",
":",
"g_map",
"=",
"{",
"}",
"map_rows",
"=",
"read_unicode_csv",
"(",
"grounding_map_path",
",",
"delimiter",
"=",
"','",
",",
... | Return a grounding map dictionary loaded from a csv file.
In the file pointed to by grounding_map_path, the number of name_space ID
pairs can vary per row and commas are
used to pad out entries containing fewer than the maximum amount of
name spaces appearing in the file. Lines should be terminated wit... | [
"Return",
"a",
"grounding",
"map",
"dictionary",
"loaded",
"from",
"a",
"csv",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L360-L421 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | all_agents | def all_agents(stmts):
"""Return a list of all of the agents from a list of statements.
Only agents that are not None and have a TEXT entry are returned.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
agents : list of :py:class:`indra.stat... | python | def all_agents(stmts):
"""Return a list of all of the agents from a list of statements.
Only agents that are not None and have a TEXT entry are returned.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
agents : list of :py:class:`indra.stat... | [
"def",
"all_agents",
"(",
"stmts",
")",
":",
"agents",
"=",
"[",
"]",
"for",
"stmt",
"in",
"stmts",
":",
"for",
"agent",
"in",
"stmt",
".",
"agent_list",
"(",
")",
":",
"if",
"agent",
"is",
"not",
"None",
"and",
"agent",
".",
"db_refs",
".",
"get",... | Return a list of all of the agents from a list of statements.
Only agents that are not None and have a TEXT entry are returned.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
agents : list of :py:class:`indra.statements.Agent`
List of ... | [
"Return",
"a",
"list",
"of",
"all",
"of",
"the",
"agents",
"from",
"a",
"list",
"of",
"statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L426-L447 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | get_sentences_for_agent | def get_sentences_for_agent(text, stmts, max_sentences=None):
"""Returns evidence sentences with a given agent text from a list of statements
Parameters
----------
text : str
An agent text
stmts : list of :py:class:`indra.statements.Statement`
INDRA Statements to search in for evid... | python | def get_sentences_for_agent(text, stmts, max_sentences=None):
"""Returns evidence sentences with a given agent text from a list of statements
Parameters
----------
text : str
An agent text
stmts : list of :py:class:`indra.statements.Statement`
INDRA Statements to search in for evid... | [
"def",
"get_sentences_for_agent",
"(",
"text",
",",
"stmts",
",",
"max_sentences",
"=",
"None",
")",
":",
"sentences",
"=",
"[",
"]",
"for",
"stmt",
"in",
"stmts",
":",
"for",
"agent",
"in",
"stmt",
".",
"agent_list",
"(",
")",
":",
"if",
"agent",
"is"... | Returns evidence sentences with a given agent text from a list of statements
Parameters
----------
text : str
An agent text
stmts : list of :py:class:`indra.statements.Statement`
INDRA Statements to search in for evidence statements.
max_sentences : Optional[int/None]
Cap ... | [
"Returns",
"evidence",
"sentences",
"with",
"a",
"given",
"agent",
"text",
"from",
"a",
"list",
"of",
"statements"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L467-L496 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | agent_texts_with_grounding | def agent_texts_with_grounding(stmts):
"""Return agent text groundings in a list of statements with their counts
Parameters
----------
stmts: list of :py:class:`indra.statements.Statement`
Returns
-------
list of tuple
List of tuples of the form
(text: str, ((name_space: st... | python | def agent_texts_with_grounding(stmts):
"""Return agent text groundings in a list of statements with their counts
Parameters
----------
stmts: list of :py:class:`indra.statements.Statement`
Returns
-------
list of tuple
List of tuples of the form
(text: str, ((name_space: st... | [
"def",
"agent_texts_with_grounding",
"(",
"stmts",
")",
":",
"allag",
"=",
"all_agents",
"(",
"stmts",
")",
"for",
"ag",
"in",
"allag",
":",
"pfam_def",
"=",
"ag",
".",
"db_refs",
".",
"get",
"(",
"'PFAM-DEF'",
")",
"if",
"pfam_def",
"is",
"not",
"None",... | Return agent text groundings in a list of statements with their counts
Parameters
----------
stmts: list of :py:class:`indra.statements.Statement`
Returns
-------
list of tuple
List of tuples of the form
(text: str, ((name_space: str, ID: str, count: int)...),
total_cou... | [
"Return",
"agent",
"text",
"groundings",
"in",
"a",
"list",
"of",
"statements",
"with",
"their",
"counts"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L499-L559 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | ungrounded_texts | def ungrounded_texts(stmts):
"""Return a list of all ungrounded entities ordered by number of mentions
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
ungroundc : list of tuple
list of tuples of the form (text: str, count: int) sorted in ... | python | def ungrounded_texts(stmts):
"""Return a list of all ungrounded entities ordered by number of mentions
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
ungroundc : list of tuple
list of tuples of the form (text: str, count: int) sorted in ... | [
"def",
"ungrounded_texts",
"(",
"stmts",
")",
":",
"ungrounded",
"=",
"[",
"ag",
".",
"db_refs",
"[",
"'TEXT'",
"]",
"for",
"s",
"in",
"stmts",
"for",
"ag",
"in",
"s",
".",
"agent_list",
"(",
")",
"if",
"ag",
"is",
"not",
"None",
"and",
"list",
"("... | Return a list of all ungrounded entities ordered by number of mentions
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
ungroundc : list of tuple
list of tuples of the form (text: str, count: int) sorted in descending
order by count. | [
"Return",
"a",
"list",
"of",
"all",
"ungrounded",
"entities",
"ordered",
"by",
"number",
"of",
"mentions"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L563-L583 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | get_agents_with_name | def get_agents_with_name(name, stmts):
"""Return all agents within a list of statements with a particular name."""
return [ag for stmt in stmts for ag in stmt.agent_list()
if ag is not None and ag.name == name] | python | def get_agents_with_name(name, stmts):
"""Return all agents within a list of statements with a particular name."""
return [ag for stmt in stmts for ag in stmt.agent_list()
if ag is not None and ag.name == name] | [
"def",
"get_agents_with_name",
"(",
"name",
",",
"stmts",
")",
":",
"return",
"[",
"ag",
"for",
"stmt",
"in",
"stmts",
"for",
"ag",
"in",
"stmt",
".",
"agent_list",
"(",
")",
"if",
"ag",
"is",
"not",
"None",
"and",
"ag",
".",
"name",
"==",
"name",
... | Return all agents within a list of statements with a particular name. | [
"Return",
"all",
"agents",
"within",
"a",
"list",
"of",
"statements",
"with",
"a",
"particular",
"name",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L586-L589 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | save_base_map | def save_base_map(filename, grouped_by_text):
"""Dump a list of agents along with groundings and counts into a csv file
Parameters
----------
filename : str
Filepath for output file
grouped_by_text : list of tuple
List of tuples of the form output by agent_texts_with_grounding
"... | python | def save_base_map(filename, grouped_by_text):
"""Dump a list of agents along with groundings and counts into a csv file
Parameters
----------
filename : str
Filepath for output file
grouped_by_text : list of tuple
List of tuples of the form output by agent_texts_with_grounding
"... | [
"def",
"save_base_map",
"(",
"filename",
",",
"grouped_by_text",
")",
":",
"rows",
"=",
"[",
"]",
"for",
"group",
"in",
"grouped_by_text",
":",
"text_string",
"=",
"group",
"[",
"0",
"]",
"for",
"db",
",",
"db_id",
",",
"count",
"in",
"group",
"[",
"1"... | Dump a list of agents along with groundings and counts into a csv file
Parameters
----------
filename : str
Filepath for output file
grouped_by_text : list of tuple
List of tuples of the form output by agent_texts_with_grounding | [
"Dump",
"a",
"list",
"of",
"agents",
"along",
"with",
"groundings",
"and",
"counts",
"into",
"a",
"csv",
"file"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L592-L614 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | protein_map_from_twg | def protein_map_from_twg(twg):
"""Build map of entity texts to validate protein grounding.
Looks at the grounding of the entity texts extracted from the statements
and finds proteins where there is grounding to a human protein that maps to
an HGNC name that is an exact match to the entity text. Return... | python | def protein_map_from_twg(twg):
"""Build map of entity texts to validate protein grounding.
Looks at the grounding of the entity texts extracted from the statements
and finds proteins where there is grounding to a human protein that maps to
an HGNC name that is an exact match to the entity text. Return... | [
"def",
"protein_map_from_twg",
"(",
"twg",
")",
":",
"protein_map",
"=",
"{",
"}",
"unmatched",
"=",
"0",
"matched",
"=",
"0",
"logger",
".",
"info",
"(",
"'Building grounding map for human proteins'",
")",
"for",
"agent_text",
",",
"grounding_list",
",",
"_",
... | Build map of entity texts to validate protein grounding.
Looks at the grounding of the entity texts extracted from the statements
and finds proteins where there is grounding to a human protein that maps to
an HGNC name that is an exact match to the entity text. Returns a dict that
can be used to updat... | [
"Build",
"map",
"of",
"entity",
"texts",
"to",
"validate",
"protein",
"grounding",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L617-L671 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | save_sentences | def save_sentences(twg, stmts, filename, agent_limit=300):
"""Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are mentioned in the list of sta... | python | def save_sentences(twg, stmts, filename, agent_limit=300):
"""Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are mentioned in the list of sta... | [
"def",
"save_sentences",
"(",
"twg",
",",
"stmts",
",",
"filename",
",",
"agent_limit",
"=",
"300",
")",
":",
"sentences",
"=",
"[",
"]",
"unmapped_texts",
"=",
"[",
"t",
"[",
"0",
"]",
"for",
"t",
"in",
"twg",
"]",
"counter",
"=",
"0",
"logger",
"... | Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are mentioned in the list of statements.
Should be sorted in descending order by the count... | [
"Write",
"evidence",
"sentences",
"for",
"stmts",
"with",
"ungrounded",
"agents",
"to",
"csv",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L674-L707 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | _get_text_for_grounding | def _get_text_for_grounding(stmt, agent_text):
"""Get text context for Deft disambiguation
If the INDRA database is available, attempts to get the fulltext from
which the statement was extracted. If the fulltext is not available, the
abstract is returned. If the indra database is not available, uses th... | python | def _get_text_for_grounding(stmt, agent_text):
"""Get text context for Deft disambiguation
If the INDRA database is available, attempts to get the fulltext from
which the statement was extracted. If the fulltext is not available, the
abstract is returned. If the indra database is not available, uses th... | [
"def",
"_get_text_for_grounding",
"(",
"stmt",
",",
"agent_text",
")",
":",
"text",
"=",
"None",
"try",
":",
"from",
"indra_db",
".",
"util",
".",
"content_scripts",
"import",
"get_text_content_from_text_refs",
"from",
"indra",
".",
"literature",
".",
"deft_tools"... | Get text context for Deft disambiguation
If the INDRA database is available, attempts to get the fulltext from
which the statement was extracted. If the fulltext is not available, the
abstract is returned. If the indra database is not available, uses the
pubmed client to get the abstract. If no abstrac... | [
"Get",
"text",
"context",
"for",
"Deft",
"disambiguation"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L743-L798 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | GroundingMapper.update_agent_db_refs | def update_agent_db_refs(self, agent, agent_text, do_rename=True):
"""Update db_refs of agent using the grounding map
If the grounding map is missing one of the HGNC symbol or Uniprot ID,
attempts to reconstruct one from the other.
Parameters
----------
agent : :py:clas... | python | def update_agent_db_refs(self, agent, agent_text, do_rename=True):
"""Update db_refs of agent using the grounding map
If the grounding map is missing one of the HGNC symbol or Uniprot ID,
attempts to reconstruct one from the other.
Parameters
----------
agent : :py:clas... | [
"def",
"update_agent_db_refs",
"(",
"self",
",",
"agent",
",",
"agent_text",
",",
"do_rename",
"=",
"True",
")",
":",
"map_db_refs",
"=",
"deepcopy",
"(",
"self",
".",
"gm",
".",
"get",
"(",
"agent_text",
")",
")",
"self",
".",
"standardize_agent_db_refs",
... | Update db_refs of agent using the grounding map
If the grounding map is missing one of the HGNC symbol or Uniprot ID,
attempts to reconstruct one from the other.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
The agent whose db_refs will be updated... | [
"Update",
"db_refs",
"of",
"agent",
"using",
"the",
"grounding",
"map"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L51-L83 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | GroundingMapper.map_agents_for_stmt | def map_agents_for_stmt(self, stmt, do_rename=True):
"""Return a new Statement whose agents have been grounding mapped.
Parameters
----------
stmt : :py:class:`indra.statements.Statement`
The Statement whose agents need mapping.
do_rename: Optional[bool]
... | python | def map_agents_for_stmt(self, stmt, do_rename=True):
"""Return a new Statement whose agents have been grounding mapped.
Parameters
----------
stmt : :py:class:`indra.statements.Statement`
The Statement whose agents need mapping.
do_rename: Optional[bool]
... | [
"def",
"map_agents_for_stmt",
"(",
"self",
",",
"stmt",
",",
"do_rename",
"=",
"True",
")",
":",
"mapped_stmt",
"=",
"deepcopy",
"(",
"stmt",
")",
"agent_list",
"=",
"mapped_stmt",
".",
"agent_list",
"(",
")",
"for",
"idx",
",",
"agent",
"in",
"enumerate",... | Return a new Statement whose agents have been grounding mapped.
Parameters
----------
stmt : :py:class:`indra.statements.Statement`
The Statement whose agents need mapping.
do_rename: Optional[bool]
If True, the Agent name is updated based on the mapped grounding... | [
"Return",
"a",
"new",
"Statement",
"whose",
"agents",
"have",
"been",
"grounding",
"mapped",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L150-L217 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | GroundingMapper.map_agent | def map_agent(self, agent, do_rename):
"""Return the given Agent with its grounding mapped.
This function grounds a single agent. It returns the new Agent object
(which might be a different object if we load a new agent state
from json) or the same object otherwise.
Parameters
... | python | def map_agent(self, agent, do_rename):
"""Return the given Agent with its grounding mapped.
This function grounds a single agent. It returns the new Agent object
(which might be a different object if we load a new agent state
from json) or the same object otherwise.
Parameters
... | [
"def",
"map_agent",
"(",
"self",
",",
"agent",
",",
"do_rename",
")",
":",
"agent_text",
"=",
"agent",
".",
"db_refs",
".",
"get",
"(",
"'TEXT'",
")",
"mapped_to_agent_json",
"=",
"self",
".",
"agent_map",
".",
"get",
"(",
"agent_text",
")",
"if",
"mappe... | Return the given Agent with its grounding mapped.
This function grounds a single agent. It returns the new Agent object
(which might be a different object if we load a new agent state
from json) or the same object otherwise.
Parameters
----------
agent : :py:class:`indr... | [
"Return",
"the",
"given",
"Agent",
"with",
"its",
"grounding",
"mapped",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L219-L268 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | GroundingMapper.map_agents | def map_agents(self, stmts, do_rename=True):
"""Return a new list of statements whose agents have been mapped
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
The statements whose agents need mapping
do_rename: Optional[bool]
I... | python | def map_agents(self, stmts, do_rename=True):
"""Return a new list of statements whose agents have been mapped
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
The statements whose agents need mapping
do_rename: Optional[bool]
I... | [
"def",
"map_agents",
"(",
"self",
",",
"stmts",
",",
"do_rename",
"=",
"True",
")",
":",
"mapped_stmts",
"=",
"[",
"]",
"num_skipped",
"=",
"0",
"for",
"stmt",
"in",
"stmts",
":",
"mapped_stmt",
"=",
"self",
".",
"map_agents_for_stmt",
"(",
"stmt",
",",
... | Return a new list of statements whose agents have been mapped
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
The statements whose agents need mapping
do_rename: Optional[bool]
If True, the Agent name is updated based on the mapped gr... | [
"Return",
"a",
"new",
"list",
"of",
"statements",
"whose",
"agents",
"have",
"been",
"mapped"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L270-L301 | train |
sorgerlab/indra | indra/preassembler/grounding_mapper.py | GroundingMapper.rename_agents | def rename_agents(self, stmts):
"""Return a list of mapped statements with updated agent names.
Creates a new list of statements without modifying the original list.
The agents in a statement should be renamed if the grounding map has
updated their db_refs. If an agent contains a FamPl... | python | def rename_agents(self, stmts):
"""Return a list of mapped statements with updated agent names.
Creates a new list of statements without modifying the original list.
The agents in a statement should be renamed if the grounding map has
updated their db_refs. If an agent contains a FamPl... | [
"def",
"rename_agents",
"(",
"self",
",",
"stmts",
")",
":",
"mapped_stmts",
"=",
"deepcopy",
"(",
"stmts",
")",
"for",
"_",
",",
"stmt",
"in",
"enumerate",
"(",
"mapped_stmts",
")",
":",
"for",
"agent",
"in",
"stmt",
".",
"agent_list",
"(",
")",
":",
... | Return a list of mapped statements with updated agent names.
Creates a new list of statements without modifying the original list.
The agents in a statement should be renamed if the grounding map has
updated their db_refs. If an agent contains a FamPlex grounding, the
FamPlex ID is use... | [
"Return",
"a",
"list",
"of",
"mapped",
"statements",
"with",
"updated",
"agent",
"names",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L303-L355 | train |
sorgerlab/indra | indra/sources/hprd/processor.py | HprdProcessor.get_complexes | def get_complexes(self, cplx_df):
"""Generate Complex Statements from the HPRD protein complexes data.
Parameters
----------
cplx_df : pandas.DataFrame
DataFrame loaded from the PROTEIN_COMPLEXES.txt file.
"""
# Group the agents for the complex
logg... | python | def get_complexes(self, cplx_df):
"""Generate Complex Statements from the HPRD protein complexes data.
Parameters
----------
cplx_df : pandas.DataFrame
DataFrame loaded from the PROTEIN_COMPLEXES.txt file.
"""
# Group the agents for the complex
logg... | [
"def",
"get_complexes",
"(",
"self",
",",
"cplx_df",
")",
":",
"logger",
".",
"info",
"(",
"'Processing complexes...'",
")",
"for",
"cplx_id",
",",
"this_cplx",
"in",
"cplx_df",
".",
"groupby",
"(",
"'CPLX_ID'",
")",
":",
"agents",
"=",
"[",
"]",
"for",
... | Generate Complex Statements from the HPRD protein complexes data.
Parameters
----------
cplx_df : pandas.DataFrame
DataFrame loaded from the PROTEIN_COMPLEXES.txt file. | [
"Generate",
"Complex",
"Statements",
"from",
"the",
"HPRD",
"protein",
"complexes",
"data",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L151-L176 | train |
sorgerlab/indra | indra/sources/hprd/processor.py | HprdProcessor.get_ptms | def get_ptms(self, ptm_df):
"""Generate Modification statements from the HPRD PTM data.
Parameters
----------
ptm_df : pandas.DataFrame
DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file.
"""
logger.info('Processing PTMs...')
# Iterat... | python | def get_ptms(self, ptm_df):
"""Generate Modification statements from the HPRD PTM data.
Parameters
----------
ptm_df : pandas.DataFrame
DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file.
"""
logger.info('Processing PTMs...')
# Iterat... | [
"def",
"get_ptms",
"(",
"self",
",",
"ptm_df",
")",
":",
"logger",
".",
"info",
"(",
"'Processing PTMs...'",
")",
"for",
"ix",
",",
"row",
"in",
"ptm_df",
".",
"iterrows",
"(",
")",
":",
"ptm_class",
"=",
"_ptm_map",
"[",
"row",
"[",
"'MOD_TYPE'",
"]",... | Generate Modification statements from the HPRD PTM data.
Parameters
----------
ptm_df : pandas.DataFrame
DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file. | [
"Generate",
"Modification",
"statements",
"from",
"the",
"HPRD",
"PTM",
"data",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L178-L220 | train |
sorgerlab/indra | indra/sources/hprd/processor.py | HprdProcessor.get_ppis | def get_ppis(self, ppi_df):
"""Generate Complex Statements from the HPRD PPI data.
Parameters
----------
ppi_df : pandas.DataFrame
DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt
file.
"""
logger.info('Processing PPIs...')
... | python | def get_ppis(self, ppi_df):
"""Generate Complex Statements from the HPRD PPI data.
Parameters
----------
ppi_df : pandas.DataFrame
DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt
file.
"""
logger.info('Processing PPIs...')
... | [
"def",
"get_ppis",
"(",
"self",
",",
"ppi_df",
")",
":",
"logger",
".",
"info",
"(",
"'Processing PPIs...'",
")",
"for",
"ix",
",",
"row",
"in",
"ppi_df",
".",
"iterrows",
"(",
")",
":",
"agA",
"=",
"self",
".",
"_make_agent",
"(",
"row",
"[",
"'HPRD... | Generate Complex Statements from the HPRD PPI data.
Parameters
----------
ppi_df : pandas.DataFrame
DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt
file. | [
"Generate",
"Complex",
"Statements",
"from",
"the",
"HPRD",
"PPI",
"data",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L222-L243 | train |
sorgerlab/indra | indra/sources/isi/processor.py | _build_verb_statement_mapping | def _build_verb_statement_mapping():
"""Build the mapping between ISI verb strings and INDRA statement classes.
Looks up the INDRA statement class name, if any, in a resource file,
and resolves this class name to a class.
Returns
-------
verb_to_statement_type : dict
Dictionary mapping... | python | def _build_verb_statement_mapping():
"""Build the mapping between ISI verb strings and INDRA statement classes.
Looks up the INDRA statement class name, if any, in a resource file,
and resolves this class name to a class.
Returns
-------
verb_to_statement_type : dict
Dictionary mapping... | [
"def",
"_build_verb_statement_mapping",
"(",
")",
":",
"path_this",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
"map_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_this",
",",
"'isi... | Build the mapping between ISI verb strings and INDRA statement classes.
Looks up the INDRA statement class name, if any, in a resource file,
and resolves this class name to a class.
Returns
-------
verb_to_statement_type : dict
Dictionary mapping verb name to an INDRA statment class | [
"Build",
"the",
"mapping",
"between",
"ISI",
"verb",
"strings",
"and",
"INDRA",
"statement",
"classes",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L167-L198 | train |
sorgerlab/indra | indra/sources/isi/processor.py | IsiProcessor.get_statements | def get_statements(self):
"""Process reader output to produce INDRA Statements."""
for k, v in self.reader_output.items():
for interaction in v['interactions']:
self._process_interaction(k, interaction, v['text'], self.pmid,
self.extr... | python | def get_statements(self):
"""Process reader output to produce INDRA Statements."""
for k, v in self.reader_output.items():
for interaction in v['interactions']:
self._process_interaction(k, interaction, v['text'], self.pmid,
self.extr... | [
"def",
"get_statements",
"(",
"self",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"reader_output",
".",
"items",
"(",
")",
":",
"for",
"interaction",
"in",
"v",
"[",
"'interactions'",
"]",
":",
"self",
".",
"_process_interaction",
"(",
"k",
",",... | Process reader output to produce INDRA Statements. | [
"Process",
"reader",
"output",
"to",
"produce",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L38-L43 | train |
sorgerlab/indra | indra/sources/isi/processor.py | IsiProcessor._process_interaction | def _process_interaction(self, source_id, interaction, text, pmid,
extra_annotations):
"""Process an interaction JSON tuple from the ISI output, and adds up
to one statement to the list of extracted statements.
Parameters
----------
source_id : str
... | python | def _process_interaction(self, source_id, interaction, text, pmid,
extra_annotations):
"""Process an interaction JSON tuple from the ISI output, and adds up
to one statement to the list of extracted statements.
Parameters
----------
source_id : str
... | [
"def",
"_process_interaction",
"(",
"self",
",",
"source_id",
",",
"interaction",
",",
"text",
",",
"pmid",
",",
"extra_annotations",
")",
":",
"verb",
"=",
"interaction",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"subj",
"=",
"interaction",
"[",
"-",
"2",
... | Process an interaction JSON tuple from the ISI output, and adds up
to one statement to the list of extracted statements.
Parameters
----------
source_id : str
the JSON key corresponding to the sentence in the ISI output
interaction: the JSON list with subject/ver... | [
"Process",
"an",
"interaction",
"JSON",
"tuple",
"from",
"the",
"ISI",
"output",
"and",
"adds",
"up",
"to",
"one",
"statement",
"to",
"the",
"list",
"of",
"extracted",
"statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L59-L146 | train |
sorgerlab/indra | indra/sources/geneways/actionmention_parser.py | GenewaysActionMention.make_annotation | def make_annotation(self):
"""Returns a dictionary with all properties of the action mention."""
annotation = dict()
# Put all properties of the action object into the annotation
for item in dir(self):
if len(item) > 0 and item[0] != '_' and \
not inspect... | python | def make_annotation(self):
"""Returns a dictionary with all properties of the action mention."""
annotation = dict()
# Put all properties of the action object into the annotation
for item in dir(self):
if len(item) > 0 and item[0] != '_' and \
not inspect... | [
"def",
"make_annotation",
"(",
"self",
")",
":",
"annotation",
"=",
"dict",
"(",
")",
"for",
"item",
"in",
"dir",
"(",
"self",
")",
":",
"if",
"len",
"(",
"item",
")",
">",
"0",
"and",
"item",
"[",
"0",
"]",
"!=",
"'_'",
"and",
"not",
"inspect",
... | Returns a dictionary with all properties of the action mention. | [
"Returns",
"a",
"dictionary",
"with",
"all",
"properties",
"of",
"the",
"action",
"mention",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/actionmention_parser.py#L31-L41 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _match_to_array | def _match_to_array(m):
""" Returns an array consisting of the elements obtained from a pattern
search cast into their appropriate classes. """
return [_cast_biopax_element(m.get(i)) for i in range(m.varSize())] | python | def _match_to_array(m):
""" Returns an array consisting of the elements obtained from a pattern
search cast into their appropriate classes. """
return [_cast_biopax_element(m.get(i)) for i in range(m.varSize())] | [
"def",
"_match_to_array",
"(",
"m",
")",
":",
"return",
"[",
"_cast_biopax_element",
"(",
"m",
".",
"get",
"(",
"i",
")",
")",
"for",
"i",
"in",
"range",
"(",
"m",
".",
"varSize",
"(",
")",
")",
"]"
] | Returns an array consisting of the elements obtained from a pattern
search cast into their appropriate classes. | [
"Returns",
"an",
"array",
"consisting",
"of",
"the",
"elements",
"obtained",
"from",
"a",
"pattern",
"search",
"cast",
"into",
"their",
"appropriate",
"classes",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1374-L1377 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_complex | def _is_complex(pe):
"""Return True if the physical entity is a complex"""
val = isinstance(pe, _bp('Complex')) or \
isinstance(pe, _bpimpl('Complex'))
return val | python | def _is_complex(pe):
"""Return True if the physical entity is a complex"""
val = isinstance(pe, _bp('Complex')) or \
isinstance(pe, _bpimpl('Complex'))
return val | [
"def",
"_is_complex",
"(",
"pe",
")",
":",
"val",
"=",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'Complex'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bpimpl",
"(",
"'Complex'",
")",
")",
"return",
"val"
] | Return True if the physical entity is a complex | [
"Return",
"True",
"if",
"the",
"physical",
"entity",
"is",
"a",
"complex"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1379-L1383 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_protein | def _is_protein(pe):
"""Return True if the element is a protein"""
val = isinstance(pe, _bp('Protein')) or \
isinstance(pe, _bpimpl('Protein')) or \
isinstance(pe, _bp('ProteinReference')) or \
isinstance(pe, _bpimpl('ProteinReference'))
return val | python | def _is_protein(pe):
"""Return True if the element is a protein"""
val = isinstance(pe, _bp('Protein')) or \
isinstance(pe, _bpimpl('Protein')) or \
isinstance(pe, _bp('ProteinReference')) or \
isinstance(pe, _bpimpl('ProteinReference'))
return val | [
"def",
"_is_protein",
"(",
"pe",
")",
":",
"val",
"=",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'Protein'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bpimpl",
"(",
"'Protein'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'Pro... | Return True if the element is a protein | [
"Return",
"True",
"if",
"the",
"element",
"is",
"a",
"protein"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1385-L1391 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_rna | def _is_rna(pe):
"""Return True if the element is an RNA"""
val = isinstance(pe, _bp('Rna')) or isinstance(pe, _bpimpl('Rna'))
return val | python | def _is_rna(pe):
"""Return True if the element is an RNA"""
val = isinstance(pe, _bp('Rna')) or isinstance(pe, _bpimpl('Rna'))
return val | [
"def",
"_is_rna",
"(",
"pe",
")",
":",
"val",
"=",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'Rna'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bpimpl",
"(",
"'Rna'",
")",
")",
"return",
"val"
] | Return True if the element is an RNA | [
"Return",
"True",
"if",
"the",
"element",
"is",
"an",
"RNA"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1393-L1396 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_small_molecule | def _is_small_molecule(pe):
"""Return True if the element is a small molecule"""
val = isinstance(pe, _bp('SmallMolecule')) or \
isinstance(pe, _bpimpl('SmallMolecule')) or \
isinstance(pe, _bp('SmallMoleculeReference')) or \
isinstance(pe, _bpimpl('SmallMoleculeReference'))
... | python | def _is_small_molecule(pe):
"""Return True if the element is a small molecule"""
val = isinstance(pe, _bp('SmallMolecule')) or \
isinstance(pe, _bpimpl('SmallMolecule')) or \
isinstance(pe, _bp('SmallMoleculeReference')) or \
isinstance(pe, _bpimpl('SmallMoleculeReference'))
... | [
"def",
"_is_small_molecule",
"(",
"pe",
")",
":",
"val",
"=",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'SmallMolecule'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bpimpl",
"(",
"'SmallMolecule'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_... | Return True if the element is a small molecule | [
"Return",
"True",
"if",
"the",
"element",
"is",
"a",
"small",
"molecule"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1398-L1404 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_physical_entity | def _is_physical_entity(pe):
"""Return True if the element is a physical entity"""
val = isinstance(pe, _bp('PhysicalEntity')) or \
isinstance(pe, _bpimpl('PhysicalEntity'))
return val | python | def _is_physical_entity(pe):
"""Return True if the element is a physical entity"""
val = isinstance(pe, _bp('PhysicalEntity')) or \
isinstance(pe, _bpimpl('PhysicalEntity'))
return val | [
"def",
"_is_physical_entity",
"(",
"pe",
")",
":",
"val",
"=",
"isinstance",
"(",
"pe",
",",
"_bp",
"(",
"'PhysicalEntity'",
")",
")",
"or",
"isinstance",
"(",
"pe",
",",
"_bpimpl",
"(",
"'PhysicalEntity'",
")",
")",
"return",
"val"
] | Return True if the element is a physical entity | [
"Return",
"True",
"if",
"the",
"element",
"is",
"a",
"physical",
"entity"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1406-L1410 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_modification_or_activity | def _is_modification_or_activity(feature):
"""Return True if the feature is a modification"""
if not (isinstance(feature, _bp('ModificationFeature')) or \
isinstance(feature, _bpimpl('ModificationFeature'))):
return None
mf_type = feature.getModificationType()
if mf_type is None:
... | python | def _is_modification_or_activity(feature):
"""Return True if the feature is a modification"""
if not (isinstance(feature, _bp('ModificationFeature')) or \
isinstance(feature, _bpimpl('ModificationFeature'))):
return None
mf_type = feature.getModificationType()
if mf_type is None:
... | [
"def",
"_is_modification_or_activity",
"(",
"feature",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"feature",
",",
"_bp",
"(",
"'ModificationFeature'",
")",
")",
"or",
"isinstance",
"(",
"feature",
",",
"_bpimpl",
"(",
"'ModificationFeature'",
")",
")",
")"... | Return True if the feature is a modification | [
"Return",
"True",
"if",
"the",
"feature",
"is",
"a",
"modification"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1418-L1432 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_reference | def _is_reference(bpe):
"""Return True if the element is an entity reference."""
if isinstance(bpe, _bp('ProteinReference')) or \
isinstance(bpe, _bpimpl('ProteinReference')) or \
isinstance(bpe, _bp('SmallMoleculeReference')) or \
isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \
... | python | def _is_reference(bpe):
"""Return True if the element is an entity reference."""
if isinstance(bpe, _bp('ProteinReference')) or \
isinstance(bpe, _bpimpl('ProteinReference')) or \
isinstance(bpe, _bp('SmallMoleculeReference')) or \
isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \
... | [
"def",
"_is_reference",
"(",
"bpe",
")",
":",
"if",
"isinstance",
"(",
"bpe",
",",
"_bp",
"(",
"'ProteinReference'",
")",
")",
"or",
"isinstance",
"(",
"bpe",
",",
"_bpimpl",
"(",
"'ProteinReference'",
")",
")",
"or",
"isinstance",
"(",
"bpe",
",",
"_bp"... | Return True if the element is an entity reference. | [
"Return",
"True",
"if",
"the",
"element",
"is",
"an",
"entity",
"reference",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1434-L1446 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_entity | def _is_entity(bpe):
"""Return True if the element is a physical entity."""
if isinstance(bpe, _bp('Protein')) or \
isinstance(bpe, _bpimpl('Protein')) or \
isinstance(bpe, _bp('SmallMolecule')) or \
isinstance(bpe, _bpimpl('SmallMolecule')) or \
isinstance(bpe, _bp('Complex')) o... | python | def _is_entity(bpe):
"""Return True if the element is a physical entity."""
if isinstance(bpe, _bp('Protein')) or \
isinstance(bpe, _bpimpl('Protein')) or \
isinstance(bpe, _bp('SmallMolecule')) or \
isinstance(bpe, _bpimpl('SmallMolecule')) or \
isinstance(bpe, _bp('Complex')) o... | [
"def",
"_is_entity",
"(",
"bpe",
")",
":",
"if",
"isinstance",
"(",
"bpe",
",",
"_bp",
"(",
"'Protein'",
")",
")",
"or",
"isinstance",
"(",
"bpe",
",",
"_bpimpl",
"(",
"'Protein'",
")",
")",
"or",
"isinstance",
"(",
"bpe",
",",
"_bp",
"(",
"'SmallMol... | Return True if the element is a physical entity. | [
"Return",
"True",
"if",
"the",
"element",
"is",
"a",
"physical",
"entity",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1448-L1466 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | _is_catalysis | def _is_catalysis(bpe):
"""Return True if the element is Catalysis."""
if isinstance(bpe, _bp('Catalysis')) or \
isinstance(bpe, _bpimpl('Catalysis')):
return True
else:
return False | python | def _is_catalysis(bpe):
"""Return True if the element is Catalysis."""
if isinstance(bpe, _bp('Catalysis')) or \
isinstance(bpe, _bpimpl('Catalysis')):
return True
else:
return False | [
"def",
"_is_catalysis",
"(",
"bpe",
")",
":",
"if",
"isinstance",
"(",
"bpe",
",",
"_bp",
"(",
"'Catalysis'",
")",
")",
"or",
"isinstance",
"(",
"bpe",
",",
"_bpimpl",
"(",
"'Catalysis'",
")",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
... | Return True if the element is Catalysis. | [
"Return",
"True",
"if",
"the",
"element",
"is",
"Catalysis",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1468-L1474 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.print_statements | def print_statements(self):
"""Print all INDRA Statements collected by the processors."""
for i, stmt in enumerate(self.statements):
print("%s: %s" % (i, stmt)) | python | def print_statements(self):
"""Print all INDRA Statements collected by the processors."""
for i, stmt in enumerate(self.statements):
print("%s: %s" % (i, stmt)) | [
"def",
"print_statements",
"(",
"self",
")",
":",
"for",
"i",
",",
"stmt",
"in",
"enumerate",
"(",
"self",
".",
"statements",
")",
":",
"print",
"(",
"\"%s: %s\"",
"%",
"(",
"i",
",",
"stmt",
")",
")"
] | Print all INDRA Statements collected by the processors. | [
"Print",
"all",
"INDRA",
"Statements",
"collected",
"by",
"the",
"processors",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L53-L56 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.save_model | def save_model(self, file_name=None):
"""Save the BioPAX model object in an OWL file.
Parameters
----------
file_name : Optional[str]
The name of the OWL file to save the model in.
"""
if file_name is None:
logger.error('Missing file name')
... | python | def save_model(self, file_name=None):
"""Save the BioPAX model object in an OWL file.
Parameters
----------
file_name : Optional[str]
The name of the OWL file to save the model in.
"""
if file_name is None:
logger.error('Missing file name')
... | [
"def",
"save_model",
"(",
"self",
",",
"file_name",
"=",
"None",
")",
":",
"if",
"file_name",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"'Missing file name'",
")",
"return",
"pcc",
".",
"model_to_owl",
"(",
"self",
".",
"model",
",",
"file_name",
"... | Save the BioPAX model object in an OWL file.
Parameters
----------
file_name : Optional[str]
The name of the OWL file to save the model in. | [
"Save",
"the",
"BioPAX",
"model",
"object",
"in",
"an",
"OWL",
"file",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L58-L69 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.eliminate_exact_duplicates | def eliminate_exact_duplicates(self):
"""Eliminate Statements that were extracted multiple times.
Due to the way the patterns are implemented, they can sometimes yield
the same Statement information multiple times, in which case,
we end up with redundant Statements that aren't from inde... | python | def eliminate_exact_duplicates(self):
"""Eliminate Statements that were extracted multiple times.
Due to the way the patterns are implemented, they can sometimes yield
the same Statement information multiple times, in which case,
we end up with redundant Statements that aren't from inde... | [
"def",
"eliminate_exact_duplicates",
"(",
"self",
")",
":",
"self",
".",
"statements",
"=",
"list",
"(",
"{",
"stmt",
".",
"get_hash",
"(",
"shallow",
"=",
"False",
",",
"refresh",
"=",
"True",
")",
":",
"stmt",
"for",
"stmt",
"in",
"self",
".",
"state... | Eliminate Statements that were extracted multiple times.
Due to the way the patterns are implemented, they can sometimes yield
the same Statement information multiple times, in which case,
we end up with redundant Statements that aren't from independent
underlying entries. To avoid this... | [
"Eliminate",
"Statements",
"that",
"were",
"extracted",
"multiple",
"times",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L71-L83 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_complexes | def get_complexes(self):
"""Extract INDRA Complex Statements from the BioPAX model.
This method searches for org.biopax.paxtools.model.level3.Complex
objects which represent molecular complexes. It doesn't reuse
BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith
... | python | def get_complexes(self):
"""Extract INDRA Complex Statements from the BioPAX model.
This method searches for org.biopax.paxtools.model.level3.Complex
objects which represent molecular complexes. It doesn't reuse
BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith
... | [
"def",
"get_complexes",
"(",
"self",
")",
":",
"for",
"obj",
"in",
"self",
".",
"model",
".",
"getObjects",
"(",
")",
".",
"toArray",
"(",
")",
":",
"bpe",
"=",
"_cast_biopax_element",
"(",
"obj",
")",
"if",
"not",
"_is_complex",
"(",
"bpe",
")",
":"... | Extract INDRA Complex Statements from the BioPAX model.
This method searches for org.biopax.paxtools.model.level3.Complex
objects which represent molecular complexes. It doesn't reuse
BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith
query since that retrieves pairs ... | [
"Extract",
"INDRA",
"Complex",
"Statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L86-L109 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_modifications | def get_modifications(self):
"""Extract INDRA Modification Statements from the BioPAX model.
To extract Modifications, this method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern
with additional constraints to specify ... | python | def get_modifications(self):
"""Extract INDRA Modification Statements from the BioPAX model.
To extract Modifications, this method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern
with additional constraints to specify ... | [
"def",
"get_modifications",
"(",
"self",
")",
":",
"for",
"modtype",
",",
"modclass",
"in",
"modtype_to_modclass",
".",
"items",
"(",
")",
":",
"if",
"modtype",
"==",
"'modification'",
":",
"continue",
"stmts",
"=",
"self",
".",
"_get_generic_modification",
"(... | Extract INDRA Modification Statements from the BioPAX model.
To extract Modifications, this method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern
with additional constraints to specify the type of state change
occurri... | [
"Extract",
"INDRA",
"Modification",
"Statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L111-L126 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_activity_modification | def get_activity_modification(self):
"""Extract INDRA ActiveForm statements from the BioPAX model.
This method extracts ActiveForm Statements that are due to
protein modifications. This method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constr... | python | def get_activity_modification(self):
"""Extract INDRA ActiveForm statements from the BioPAX model.
This method extracts ActiveForm Statements that are due to
protein modifications. This method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constr... | [
"def",
"get_activity_modification",
"(",
"self",
")",
":",
"mod_filter",
"=",
"'residue modification, active'",
"for",
"is_active",
"in",
"[",
"True",
",",
"False",
"]",
":",
"p",
"=",
"self",
".",
"_construct_modification_pattern",
"(",
")",
"rel",
"=",
"mcct",... | Extract INDRA ActiveForm statements from the BioPAX model.
This method extracts ActiveForm Statements that are due to
protein modifications. This method reuses the structure of
BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern
with additional c... | [
"Extract",
"INDRA",
"ActiveForm",
"statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L128-L185 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_regulate_amounts | def get_regulate_amounts(self):
"""Extract INDRA RegulateAmount Statements from the BioPAX model.
This method extracts IncreaseAmount/DecreaseAmount Statements from
the BioPAX model. It fully reuses BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateRe... | python | def get_regulate_amounts(self):
"""Extract INDRA RegulateAmount Statements from the BioPAX model.
This method extracts IncreaseAmount/DecreaseAmount Statements from
the BioPAX model. It fully reuses BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateRe... | [
"def",
"get_regulate_amounts",
"(",
"self",
")",
":",
"p",
"=",
"pb",
".",
"controlsExpressionWithTemplateReac",
"(",
")",
"s",
"=",
"_bpp",
"(",
"'Searcher'",
")",
"res",
"=",
"s",
".",
"searchPlain",
"(",
"self",
".",
"model",
",",
"p",
")",
"res_array... | Extract INDRA RegulateAmount Statements from the BioPAX model.
This method extracts IncreaseAmount/DecreaseAmount Statements from
the BioPAX model. It fully reuses BioPAX Pattern's
org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateReac
pattern to find TemplateReaction... | [
"Extract",
"INDRA",
"RegulateAmount",
"Statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L261-L342 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_gef | def get_gef(self):
"""Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in ... | python | def get_gef(self):
"""Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in ... | [
"def",
"get_gef",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_gef_gap_base",
"(",
")",
"s",
"=",
"_bpp",
"(",
"'Searcher'",
")",
"res",
"=",
"s",
".",
"searchPlain",
"(",
"self",
".",
"model",
",",
"p",
")",
"res_array",
"=",
"[",
"_match_to_ar... | Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in complex with GTP on the
... | [
"Extract",
"Gef",
"INDRA",
"Statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L474-L531 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_gap | def get_gap(self):
"""Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in ... | python | def get_gap(self):
"""Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in ... | [
"def",
"get_gap",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_gef_gap_base",
"(",
")",
"s",
"=",
"_bpp",
"(",
"'Searcher'",
")",
"res",
"=",
"s",
".",
"searchPlain",
"(",
"self",
".",
"model",
",",
"p",
")",
"res_array",
"=",
"[",
"_match_to_ar... | Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in complex with GDP on the
... | [
"Extract",
"Gap",
"INDRA",
"Statements",
"from",
"the",
"BioPAX",
"model",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L533-L590 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_entity_mods | def _get_entity_mods(bpe):
"""Get all the modifications of an entity in INDRA format"""
if _is_entity(bpe):
features = bpe.getFeature().toArray()
else:
features = bpe.getEntityFeature().toArray()
mods = []
for feature in features:
if not _is_mo... | python | def _get_entity_mods(bpe):
"""Get all the modifications of an entity in INDRA format"""
if _is_entity(bpe):
features = bpe.getFeature().toArray()
else:
features = bpe.getEntityFeature().toArray()
mods = []
for feature in features:
if not _is_mo... | [
"def",
"_get_entity_mods",
"(",
"bpe",
")",
":",
"if",
"_is_entity",
"(",
"bpe",
")",
":",
"features",
"=",
"bpe",
".",
"getFeature",
"(",
")",
".",
"toArray",
"(",
")",
"else",
":",
"features",
"=",
"bpe",
".",
"getEntityFeature",
"(",
")",
".",
"to... | Get all the modifications of an entity in INDRA format | [
"Get",
"all",
"the",
"modifications",
"of",
"an",
"entity",
"in",
"INDRA",
"format"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L633-L646 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_generic_modification | def _get_generic_modification(self, mod_class):
"""Get all modification reactions given a Modification class."""
mod_type = modclass_to_modtype[mod_class]
if issubclass(mod_class, RemoveModification):
mod_gain_const = mcct.LOSS
mod_type = modtype_to_inverse[mod_type]
... | python | def _get_generic_modification(self, mod_class):
"""Get all modification reactions given a Modification class."""
mod_type = modclass_to_modtype[mod_class]
if issubclass(mod_class, RemoveModification):
mod_gain_const = mcct.LOSS
mod_type = modtype_to_inverse[mod_type]
... | [
"def",
"_get_generic_modification",
"(",
"self",
",",
"mod_class",
")",
":",
"mod_type",
"=",
"modclass_to_modtype",
"[",
"mod_class",
"]",
"if",
"issubclass",
"(",
"mod_class",
",",
"RemoveModification",
")",
":",
"mod_gain_const",
"=",
"mcct",
".",
"LOSS",
"mo... | Get all modification reactions given a Modification class. | [
"Get",
"all",
"modification",
"reactions",
"given",
"a",
"Modification",
"class",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L648-L721 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._construct_modification_pattern | def _construct_modification_pattern():
"""Construct the BioPAX pattern to extract modification reactions."""
# The following constraints were pieced together based on the
# following two higher level constrains: pb.controlsStateChange(),
# pb.controlsPhosphorylation().
p = _bpp('... | python | def _construct_modification_pattern():
"""Construct the BioPAX pattern to extract modification reactions."""
# The following constraints were pieced together based on the
# following two higher level constrains: pb.controlsStateChange(),
# pb.controlsPhosphorylation().
p = _bpp('... | [
"def",
"_construct_modification_pattern",
"(",
")",
":",
"p",
"=",
"_bpp",
"(",
"'Pattern'",
")",
"(",
"_bpimpl",
"(",
"'PhysicalEntity'",
")",
"(",
")",
".",
"getModelInterface",
"(",
")",
",",
"'controller PE'",
")",
"p",
".",
"add",
"(",
"cb",
".",
"p... | Construct the BioPAX pattern to extract modification reactions. | [
"Construct",
"the",
"BioPAX",
"pattern",
"to",
"extract",
"modification",
"reactions",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L788-L826 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._extract_mod_from_feature | def _extract_mod_from_feature(mf):
"""Extract the type of modification and the position from
a ModificationFeature object in the INDRA format."""
# ModificationFeature / SequenceModificationVocabulary
mf_type = mf.getModificationType()
if mf_type is None:
return None
... | python | def _extract_mod_from_feature(mf):
"""Extract the type of modification and the position from
a ModificationFeature object in the INDRA format."""
# ModificationFeature / SequenceModificationVocabulary
mf_type = mf.getModificationType()
if mf_type is None:
return None
... | [
"def",
"_extract_mod_from_feature",
"(",
"mf",
")",
":",
"mf_type",
"=",
"mf",
".",
"getModificationType",
"(",
")",
"if",
"mf_type",
"is",
"None",
":",
"return",
"None",
"mf_type_terms",
"=",
"mf_type",
".",
"getTerm",
"(",
")",
".",
"toArray",
"(",
")",
... | Extract the type of modification and the position from
a ModificationFeature object in the INDRA format. | [
"Extract",
"the",
"type",
"of",
"modification",
"and",
"the",
"position",
"from",
"a",
"ModificationFeature",
"object",
"in",
"the",
"INDRA",
"format",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L875-L922 | train |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_entref | def _get_entref(bpe):
"""Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument."""
if not _is_reference(bpe):
try:
er = bpe.getEntityReference()
except AttributeError:
return No... | python | def _get_entref(bpe):
"""Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument."""
if not _is_reference(bpe):
try:
er = bpe.getEntityReference()
except AttributeError:
return No... | [
"def",
"_get_entref",
"(",
"bpe",
")",
":",
"if",
"not",
"_is_reference",
"(",
"bpe",
")",
":",
"try",
":",
"er",
"=",
"bpe",
".",
"getEntityReference",
"(",
")",
"except",
"AttributeError",
":",
"return",
"None",
"return",
"er",
"else",
":",
"return",
... | Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument. | [
"Returns",
"the",
"entity",
"reference",
"of",
"an",
"entity",
"if",
"it",
"exists",
"or",
"return",
"the",
"entity",
"reference",
"that",
"was",
"passed",
"in",
"as",
"argument",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1224-L1234 | train |
sorgerlab/indra | indra/sources/trips/processor.py | _stmt_location_to_agents | def _stmt_location_to_agents(stmt, location):
"""Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location.
"""
if location is None:
return
agents = stmt.a... | python | def _stmt_location_to_agents(stmt, location):
"""Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location.
"""
if location is None:
return
agents = stmt.a... | [
"def",
"_stmt_location_to_agents",
"(",
"stmt",
",",
"location",
")",
":",
"if",
"location",
"is",
"None",
":",
"return",
"agents",
"=",
"stmt",
".",
"agent_list",
"(",
")",
"for",
"a",
"in",
"agents",
":",
"if",
"a",
"is",
"not",
"None",
":",
"a",
"... | Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location. | [
"Apply",
"an",
"event",
"location",
"to",
"the",
"Agents",
"in",
"the",
"corresponding",
"Statement",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1710-L1721 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_all_events | def get_all_events(self):
"""Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events.
"""
self.all_events = {}
events = self.tree.findall('EVENT')
events += self.tree.findall('CC')
for e in events:
event_id = e.attrib['id'... | python | def get_all_events(self):
"""Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events.
"""
self.all_events = {}
events = self.tree.findall('EVENT')
events += self.tree.findall('CC')
for e in events:
event_id = e.attrib['id'... | [
"def",
"get_all_events",
"(",
"self",
")",
":",
"self",
".",
"all_events",
"=",
"{",
"}",
"events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"'EVENT'",
")",
"events",
"+=",
"self",
".",
"tree",
".",
"findall",
"(",
"'CC'",
")",
"for",
"e",
"i... | Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events. | [
"Make",
"a",
"list",
"of",
"all",
"events",
"in",
"the",
"TRIPS",
"EKB",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L98-L114 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations | def get_activations(self):
"""Extract direct Activation INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
inact_events = self.tree.findall("EVENT/[type='ONT::DEACTIVATE']")
inact_events += self.tree.findall("EVENT/[type='ONT::INHIBIT']")
for even... | python | def get_activations(self):
"""Extract direct Activation INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
inact_events = self.tree.findall("EVENT/[type='ONT::DEACTIVATE']")
inact_events += self.tree.findall("EVENT/[type='ONT::INHIBIT']")
for even... | [
"def",
"get_activations",
"(",
"self",
")",
":",
"act_events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::ACTIVATE']\"",
")",
"inact_events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::DEACTIVATE']\"",
")",
"inact_... | Extract direct Activation INDRA Statements. | [
"Extract",
"direct",
"Activation",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L116-L174 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations_causal | def get_activations_causal(self):
"""Extract causal Activation INDRA Statements."""
# Search for causal connectives of type ONT::CAUSE
ccs = self.tree.findall("CC/[type='ONT::CAUSE']")
for cc in ccs:
factor = cc.find("arg/[@role=':FACTOR']")
outcome = cc.find("arg... | python | def get_activations_causal(self):
"""Extract causal Activation INDRA Statements."""
# Search for causal connectives of type ONT::CAUSE
ccs = self.tree.findall("CC/[type='ONT::CAUSE']")
for cc in ccs:
factor = cc.find("arg/[@role=':FACTOR']")
outcome = cc.find("arg... | [
"def",
"get_activations_causal",
"(",
"self",
")",
":",
"ccs",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"CC/[type='ONT::CAUSE']\"",
")",
"for",
"cc",
"in",
"ccs",
":",
"factor",
"=",
"cc",
".",
"find",
"(",
"\"arg/[@role=':FACTOR']\"",
")",
"outcome"... | Extract causal Activation INDRA Statements. | [
"Extract",
"causal",
"Activation",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L176-L235 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations_stimulate | def get_activations_stimulate(self):
"""Extract Activation INDRA Statements via stimulation."""
# TODO: extract to other patterns:
# - Stimulation by EGF activates ERK
# - Stimulation by EGF leads to ERK activation
# Search for stimulation event
stim_events = self.tree.fi... | python | def get_activations_stimulate(self):
"""Extract Activation INDRA Statements via stimulation."""
# TODO: extract to other patterns:
# - Stimulation by EGF activates ERK
# - Stimulation by EGF leads to ERK activation
# Search for stimulation event
stim_events = self.tree.fi... | [
"def",
"get_activations_stimulate",
"(",
"self",
")",
":",
"stim_events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::STIMULATE']\"",
")",
"for",
"event",
"in",
"stim_events",
":",
"event_id",
"=",
"event",
".",
"attrib",
".",
"get",
"(... | Extract Activation INDRA Statements via stimulation. | [
"Extract",
"Activation",
"INDRA",
"Statements",
"via",
"stimulation",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L237-L303 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_degradations | def get_degradations(self):
"""Extract Degradation INDRA Statements."""
deg_events = self.tree.findall("EVENT/[type='ONT::CONSUME']")
for event in deg_events:
if event.attrib['id'] in self._static_events:
continue
affected = event.find(".//*[@role=':AFFECT... | python | def get_degradations(self):
"""Extract Degradation INDRA Statements."""
deg_events = self.tree.findall("EVENT/[type='ONT::CONSUME']")
for event in deg_events:
if event.attrib['id'] in self._static_events:
continue
affected = event.find(".//*[@role=':AFFECT... | [
"def",
"get_degradations",
"(",
"self",
")",
":",
"deg_events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::CONSUME']\"",
")",
"for",
"event",
"in",
"deg_events",
":",
"if",
"event",
".",
"attrib",
"[",
"'id'",
"]",
"in",
"self",
".... | Extract Degradation INDRA Statements. | [
"Extract",
"Degradation",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L305-L354 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_complexes | def get_complexes(self):
"""Extract Complex INDRA Statements."""
bind_events = self.tree.findall("EVENT/[type='ONT::BIND']")
bind_events += self.tree.findall("EVENT/[type='ONT::INTERACT']")
for event in bind_events:
if event.attrib['id'] in self._static_events:
... | python | def get_complexes(self):
"""Extract Complex INDRA Statements."""
bind_events = self.tree.findall("EVENT/[type='ONT::BIND']")
bind_events += self.tree.findall("EVENT/[type='ONT::INTERACT']")
for event in bind_events:
if event.attrib['id'] in self._static_events:
... | [
"def",
"get_complexes",
"(",
"self",
")",
":",
"bind_events",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::BIND']\"",
")",
"bind_events",
"+=",
"self",
".",
"tree",
".",
"findall",
"(",
"\"EVENT/[type='ONT::INTERACT']\"",
")",
"for",
"even... | Extract Complex INDRA Statements. | [
"Extract",
"Complex",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L637-L693 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_modifications | def get_modifications(self):
"""Extract all types of Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
mod_events = []
for mod_event_t... | python | def get_modifications(self):
"""Extract all types of Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
mod_events = []
for mod_event_t... | [
"def",
"get_modifications",
"(",
"self",
")",
":",
"mod_event_types",
"=",
"list",
"(",
"ont_to_mod_type",
".",
"keys",
"(",
")",
")",
"mod_event_types",
"+=",
"[",
"'ONT::PTM'",
"]",
"mod_events",
"=",
"[",
"]",
"for",
"mod_event_type",
"in",
"mod_event_types... | Extract all types of Modification INDRA Statements. | [
"Extract",
"all",
"types",
"of",
"Modification",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L695-L715 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_modifications_indirect | def get_modifications_indirect(self):
"""Extract indirect Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
def get_increase_events(mod_event... | python | def get_modifications_indirect(self):
"""Extract indirect Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
def get_increase_events(mod_event... | [
"def",
"get_modifications_indirect",
"(",
"self",
")",
":",
"mod_event_types",
"=",
"list",
"(",
"ont_to_mod_type",
".",
"keys",
"(",
")",
")",
"mod_event_types",
"+=",
"[",
"'ONT::PTM'",
"]",
"def",
"get_increase_events",
"(",
"mod_event_types",
")",
":",
"mod_... | Extract indirect Modification INDRA Statements. | [
"Extract",
"indirect",
"Modification",
"INDRA",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L717-L821 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_agents | def get_agents(self):
"""Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
... | python | def get_agents(self):
"""Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
... | [
"def",
"get_agents",
"(",
"self",
")",
":",
"agents_dict",
"=",
"self",
".",
"get_term_agents",
"(",
")",
"agents",
"=",
"[",
"a",
"for",
"a",
"in",
"agents_dict",
".",
"values",
"(",
")",
"if",
"a",
"is",
"not",
"None",
"]",
"return",
"agents"
] | Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
as INDRA Agents.
... | [
"Return",
"list",
"of",
"INDRA",
"Agents",
"corresponding",
"to",
"TERMs",
"in",
"the",
"EKB",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1059-L1074 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_term_agents | def get_term_agents(self):
"""Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are r... | python | def get_term_agents(self):
"""Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are r... | [
"def",
"get_term_agents",
"(",
"self",
")",
":",
"terms",
"=",
"self",
".",
"tree",
".",
"findall",
"(",
"'TERM'",
")",
"agents",
"=",
"{",
"}",
"assoc_links",
"=",
"[",
"]",
"for",
"term",
"in",
"terms",
":",
"term_id",
"=",
"term",
".",
"attrib",
... | Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
as INDRA Agents. Fu... | [
"Return",
"dict",
"of",
"INDRA",
"Agents",
"keyed",
"by",
"corresponding",
"TERMs",
"in",
"the",
"EKB",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1076-L1110 | train |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor._get_evidence_text | def _get_evidence_text(self, event_tag):
"""Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
... | python | def _get_evidence_text(self, event_tag):
"""Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
... | [
"def",
"_get_evidence_text",
"(",
"self",
",",
"event_tag",
")",
":",
"par_id",
"=",
"event_tag",
".",
"attrib",
".",
"get",
"(",
"'paragraph'",
")",
"uttnum",
"=",
"event_tag",
".",
"attrib",
".",
"get",
"(",
"'uttnum'",
")",
"event_text",
"=",
"event_tag... | Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
the event was taken. | [
"Extract",
"the",
"evidence",
"for",
"an",
"event",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1596-L1613 | train |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | get_causal_edge | def get_causal_edge(stmt, activates):
"""Returns the causal, polar edge with the correct "contact"."""
any_contact = any(
evidence.epistemics.get('direct', False)
for evidence in stmt.evidence
)
if any_contact:
return pc.DIRECTLY_INCREASES if activates else pc.DIRECTLY_DECREASES
... | python | def get_causal_edge(stmt, activates):
"""Returns the causal, polar edge with the correct "contact"."""
any_contact = any(
evidence.epistemics.get('direct', False)
for evidence in stmt.evidence
)
if any_contact:
return pc.DIRECTLY_INCREASES if activates else pc.DIRECTLY_DECREASES
... | [
"def",
"get_causal_edge",
"(",
"stmt",
",",
"activates",
")",
":",
"any_contact",
"=",
"any",
"(",
"evidence",
".",
"epistemics",
".",
"get",
"(",
"'direct'",
",",
"False",
")",
"for",
"evidence",
"in",
"stmt",
".",
"evidence",
")",
"if",
"any_contact",
... | Returns the causal, polar edge with the correct "contact". | [
"Returns",
"the",
"causal",
"polar",
"edge",
"with",
"the",
"correct",
"contact",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L568-L577 | train |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler.to_database | def to_database(self, manager=None):
"""Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
confi... | python | def to_database(self, manager=None):
"""Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
confi... | [
"def",
"to_database",
"(",
"self",
",",
"manager",
"=",
"None",
")",
":",
"network",
"=",
"pybel",
".",
"to_database",
"(",
"self",
".",
"model",
",",
"manager",
"=",
"manager",
")",
"return",
"network"
] | Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
configuration for ``PYBEL_CONNECTION`` then checks th... | [
"Send",
"the",
"model",
"to",
"the",
"PyBEL",
"database"
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L149-L170 | train |
sorgerlab/indra | indra/assemblers/pysb/sites.py | get_binding_site_name | def get_binding_site_name(agent):
"""Return a binding site name from a given agent."""
# Try to construct a binding site name based on parent
grounding = agent.get_grounding()
if grounding != (None, None):
uri = hierarchies['entity'].get_uri(grounding[0], grounding[1])
# Get highest leve... | python | def get_binding_site_name(agent):
"""Return a binding site name from a given agent."""
# Try to construct a binding site name based on parent
grounding = agent.get_grounding()
if grounding != (None, None):
uri = hierarchies['entity'].get_uri(grounding[0], grounding[1])
# Get highest leve... | [
"def",
"get_binding_site_name",
"(",
"agent",
")",
":",
"grounding",
"=",
"agent",
".",
"get_grounding",
"(",
")",
"if",
"grounding",
"!=",
"(",
"None",
",",
"None",
")",
":",
"uri",
"=",
"hierarchies",
"[",
"'entity'",
"]",
".",
"get_uri",
"(",
"groundi... | Return a binding site name from a given agent. | [
"Return",
"a",
"binding",
"site",
"name",
"from",
"a",
"given",
"agent",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/sites.py#L68-L84 | train |
sorgerlab/indra | indra/assemblers/pysb/sites.py | get_mod_site_name | def get_mod_site_name(mod_condition):
"""Return site names for a modification."""
if mod_condition.residue is None:
mod_str = abbrevs[mod_condition.mod_type]
else:
mod_str = mod_condition.residue
mod_pos = mod_condition.position if \
mod_condition.position is not None else ''
... | python | def get_mod_site_name(mod_condition):
"""Return site names for a modification."""
if mod_condition.residue is None:
mod_str = abbrevs[mod_condition.mod_type]
else:
mod_str = mod_condition.residue
mod_pos = mod_condition.position if \
mod_condition.position is not None else ''
... | [
"def",
"get_mod_site_name",
"(",
"mod_condition",
")",
":",
"if",
"mod_condition",
".",
"residue",
"is",
"None",
":",
"mod_str",
"=",
"abbrevs",
"[",
"mod_condition",
".",
"mod_type",
"]",
"else",
":",
"mod_str",
"=",
"mod_condition",
".",
"residue",
"mod_pos"... | Return site names for a modification. | [
"Return",
"site",
"names",
"for",
"a",
"modification",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/sites.py#L87-L96 | train |
sorgerlab/indra | indra/sources/hprd/api.py | process_flat_files | def process_flat_files(id_mappings_file, complexes_file=None, ptm_file=None,
ppi_file=None, seq_file=None, motif_window=7):
"""Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must ... | python | def process_flat_files(id_mappings_file, complexes_file=None, ptm_file=None,
ppi_file=None, seq_file=None, motif_window=7):
"""Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must ... | [
"def",
"process_flat_files",
"(",
"id_mappings_file",
",",
"complexes_file",
"=",
"None",
",",
"ptm_file",
"=",
"None",
",",
"ppi_file",
"=",
"None",
",",
"seq_file",
"=",
"None",
",",
"motif_window",
"=",
"7",
")",
":",
"id_df",
"=",
"pd",
".",
"read_csv"... | Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must also be given. If
`ptm_file` is given, `seq_file` must also be given.
Note that many proteins (> 1,600) in the HPRD content are associated with
... | [
"Get",
"INDRA",
"Statements",
"from",
"HPRD",
"data",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/api.py#L22-L104 | train |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler._gather_active_forms | def _gather_active_forms(self):
"""Collect all the active forms of each Agent in the Statements."""
for stmt in self.statements:
if isinstance(stmt, ActiveForm):
base_agent = self.agent_set.get_create_base_agent(stmt.agent)
# Handle the case where an activity ... | python | def _gather_active_forms(self):
"""Collect all the active forms of each Agent in the Statements."""
for stmt in self.statements:
if isinstance(stmt, ActiveForm):
base_agent = self.agent_set.get_create_base_agent(stmt.agent)
# Handle the case where an activity ... | [
"def",
"_gather_active_forms",
"(",
"self",
")",
":",
"for",
"stmt",
"in",
"self",
".",
"statements",
":",
"if",
"isinstance",
"(",
"stmt",
",",
"ActiveForm",
")",
":",
"base_agent",
"=",
"self",
".",
"agent_set",
".",
"get_create_base_agent",
"(",
"stmt",
... | Collect all the active forms of each Agent in the Statements. | [
"Collect",
"all",
"the",
"active",
"forms",
"of",
"each",
"Agent",
"in",
"the",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L28-L39 | train |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler.replace_activities | def replace_activities(self):
"""Replace ative flags with Agent states when possible."""
logger.debug('Running PySB Preassembler replace activities')
# TODO: handle activity hierarchies
new_stmts = []
def has_agent_activity(stmt):
"""Return True if any agents in the ... | python | def replace_activities(self):
"""Replace ative flags with Agent states when possible."""
logger.debug('Running PySB Preassembler replace activities')
# TODO: handle activity hierarchies
new_stmts = []
def has_agent_activity(stmt):
"""Return True if any agents in the ... | [
"def",
"replace_activities",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Running PySB Preassembler replace activities'",
")",
"new_stmts",
"=",
"[",
"]",
"def",
"has_agent_activity",
"(",
"stmt",
")",
":",
"for",
"agent",
"in",
"stmt",
".",
"agent_list... | Replace ative flags with Agent states when possible. | [
"Replace",
"ative",
"flags",
"with",
"Agent",
"states",
"when",
"possible",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L41-L105 | train |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler.add_reverse_effects | def add_reverse_effects(self):
"""Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process.
"""
... | python | def add_reverse_effects(self):
"""Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process.
"""
... | [
"def",
"add_reverse_effects",
"(",
"self",
")",
":",
"pos_mod_sites",
"=",
"{",
"}",
"neg_mod_sites",
"=",
"{",
"}",
"syntheses",
"=",
"[",
"]",
"degradations",
"=",
"[",
"]",
"for",
"stmt",
"in",
"self",
".",
"statements",
":",
"if",
"isinstance",
"(",
... | Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process. | [
"Add",
"Statements",
"for",
"the",
"reverse",
"effects",
"of",
"some",
"Statements",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L107-L156 | train |
sorgerlab/indra | indra/preassembler/sitemapper.py | _get_uniprot_id | def _get_uniprot_id(agent):
"""Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default.
"""
up_id = agent.db_refs.get('UP')
hgnc_id = agent.db_refs.get('HGNC')
if up_id is None:
if hgnc_id is None:
... | python | def _get_uniprot_id(agent):
"""Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default.
"""
up_id = agent.db_refs.get('UP')
hgnc_id = agent.db_refs.get('HGNC')
if up_id is None:
if hgnc_id is None:
... | [
"def",
"_get_uniprot_id",
"(",
"agent",
")",
":",
"up_id",
"=",
"agent",
".",
"db_refs",
".",
"get",
"(",
"'UP'",
")",
"hgnc_id",
"=",
"agent",
".",
"db_refs",
".",
"get",
"(",
"'HGNC'",
")",
"if",
"up_id",
"is",
"None",
":",
"if",
"hgnc_id",
"is",
... | Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default. | [
"Return",
"the",
"UniProt",
"ID",
"for",
"an",
"agent",
"looking",
"up",
"in",
"HGNC",
"if",
"necessary",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L333-L354 | train |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper.map_sites | def map_sites(self, stmts):
"""Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss w... | python | def map_sites(self, stmts):
"""Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss w... | [
"def",
"map_sites",
"(",
"self",
",",
"stmts",
")",
":",
"valid_statements",
"=",
"[",
"]",
"mapped_statements",
"=",
"[",
"]",
"for",
"stmt",
"in",
"stmts",
":",
"mapped_stmt",
"=",
"self",
".",
"map_stmt_sites",
"(",
"stmt",
")",
"if",
"mapped_stmt",
"... | Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss with a statement (modifications on any o... | [
"Check",
"a",
"set",
"of",
"statements",
"for",
"invalid",
"modification",
"sites",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L203-L246 | train |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper._map_agent_sites | def _map_agent_sites(self, agent):
"""Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The firs... | python | def _map_agent_sites(self, agent):
"""Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The firs... | [
"def",
"_map_agent_sites",
"(",
"self",
",",
"agent",
")",
":",
"if",
"agent",
"is",
"None",
"or",
"not",
"agent",
".",
"mods",
":",
"return",
"[",
"]",
",",
"agent",
"new_agent",
"=",
"deepcopy",
"(",
"agent",
")",
"mapped_sites",
"=",
"[",
"]",
"fo... | Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The first element is a list of MappedSite objects, the... | [
"Check",
"an",
"agent",
"for",
"invalid",
"sites",
"and",
"update",
"if",
"necessary",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L248-L289 | train |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper._map_agent_mod | def _map_agent_mod(self, agent, mod_condition):
"""Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModConditio... | python | def _map_agent_mod(self, agent, mod_condition):
"""Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModConditio... | [
"def",
"_map_agent_mod",
"(",
"self",
",",
"agent",
",",
"mod_condition",
")",
":",
"up_id",
"=",
"_get_uniprot_id",
"(",
"agent",
")",
"if",
"not",
"up_id",
":",
"logger",
".",
"debug",
"(",
"\"No uniprot ID for %s\"",
"%",
"agent",
".",
"name",
")",
"ret... | Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModCondition`
Modification to check for validity and map.
... | [
"Map",
"a",
"single",
"modification",
"condition",
"on",
"an",
"agent",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L291-L324 | train |
sorgerlab/indra | indra/mechlinker/__init__.py | _get_graph_reductions | def _get_graph_reductions(graph):
"""Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'... | python | def _get_graph_reductions(graph):
"""Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'... | [
"def",
"_get_graph_reductions",
"(",
"graph",
")",
":",
"def",
"frontier",
"(",
"g",
",",
"nd",
")",
":",
"if",
"g",
".",
"out_degree",
"(",
"nd",
")",
"==",
"0",
":",
"return",
"set",
"(",
"[",
"nd",
"]",
")",
"else",
":",
"frontiers",
"=",
"set... | Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'activity': 'kinase', 'catalytic': 'kinase... | [
"Return",
"transitive",
"reductions",
"on",
"a",
"DAG",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L764-L795 | train |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.gather_explicit_activities | def gather_explicit_activities(self):
"""Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents.
"""
for stmt in self.statements:
agents = stm... | python | def gather_explicit_activities(self):
"""Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents.
"""
for stmt in self.statements:
agents = stm... | [
"def",
"gather_explicit_activities",
"(",
"self",
")",
":",
"for",
"stmt",
"in",
"self",
".",
"statements",
":",
"agents",
"=",
"stmt",
".",
"agent_list",
"(",
")",
"for",
"agent",
"in",
"agents",
":",
"if",
"agent",
"is",
"not",
"None",
"and",
"agent",
... | Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents. | [
"Aggregate",
"all",
"explicit",
"activities",
"and",
"active",
"forms",
"of",
"Agents",
"."
] | 79a70415832c5702d7a820c7c9ccc8e25010124b | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L39-L66 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.