repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
sorgerlab/indra | indra/tools/reading/readers.py | Reader.add_result | def add_result(self, content_id, content, **kwargs):
""""Add a result to the list of results."""
result_object = self.ResultClass(content_id, self.name, self.version,
formats.JSON, content, **kwargs)
self.results.append(result_object)
return | python | def add_result(self, content_id, content, **kwargs):
""""Add a result to the list of results."""
result_object = self.ResultClass(content_id, self.name, self.version,
formats.JSON, content, **kwargs)
self.results.append(result_object)
return | Add a result to the list of results. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L316-L321 |
sorgerlab/indra | indra/tools/reading/readers.py | Reader._check_content | def _check_content(self, content_str):
"""Check if the content is likely to be successfully read."""
if self.do_content_check:
space_ratio = float(content_str.count(' '))/len(content_str)
if space_ratio > self.max_space_ratio:
return "space-ratio: %f > %f" % (spac... | python | def _check_content(self, content_str):
"""Check if the content is likely to be successfully read."""
if self.do_content_check:
space_ratio = float(content_str.count(' '))/len(content_str)
if space_ratio > self.max_space_ratio:
return "space-ratio: %f > %f" % (spac... | Check if the content is likely to be successfully read. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L323-L333 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader._join_json_files | def _join_json_files(cls, prefix, clear=False):
"""Join different REACH output JSON files into a single JSON object.
The output of REACH is broken into three files that need to be joined
before processing. Specifically, there will be three files of the form:
`<prefix>.uaz.<subcategory>.... | python | def _join_json_files(cls, prefix, clear=False):
"""Join different REACH output JSON files into a single JSON object.
The output of REACH is broken into three files that need to be joined
before processing. Specifically, there will be three files of the form:
`<prefix>.uaz.<subcategory>.... | Join different REACH output JSON files into a single JSON object.
The output of REACH is broken into three files that need to be joined
before processing. Specifically, there will be three files of the form:
`<prefix>.uaz.<subcategory>.json`.
Parameters
----------
prefi... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L370-L406 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader._check_reach_env | def _check_reach_env():
"""Check that the environment supports runnig reach."""
# Get the path to the REACH JAR
path_to_reach = get_config('REACHPATH')
if path_to_reach is None:
path_to_reach = environ.get('REACHPATH', None)
if path_to_reach is None or not path.exists... | python | def _check_reach_env():
"""Check that the environment supports runnig reach."""
# Get the path to the REACH JAR
path_to_reach = get_config('REACHPATH')
if path_to_reach is None:
path_to_reach = environ.get('REACHPATH', None)
if path_to_reach is None or not path.exists... | Check that the environment supports runnig reach. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L409-L433 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader.prep_input | def prep_input(self, read_list):
"""Apply the readers to the content."""
logger.info("Prepping input.")
i = 0
for content in read_list:
# Check the quality of the text, and skip if there are any issues.
quality_issue = self._check_content(content.get_text())
... | python | def prep_input(self, read_list):
"""Apply the readers to the content."""
logger.info("Prepping input.")
i = 0
for content in read_list:
# Check the quality of the text, and skip if there are any issues.
quality_issue = self._check_content(content.get_text())
... | Apply the readers to the content. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L440-L466 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader.get_output | def get_output(self):
"""Get the output of a reading job as a list of filenames."""
logger.info("Getting outputs.")
# Get the set of prefixes (each will correspond to three json files.)
json_files = glob.glob(path.join(self.output_dir, '*.json'))
json_prefixes = set()
for... | python | def get_output(self):
"""Get the output of a reading job as a list of filenames."""
logger.info("Getting outputs.")
# Get the set of prefixes (each will correspond to three json files.)
json_files = glob.glob(path.join(self.output_dir, '*.json'))
json_prefixes = set()
for... | Get the output of a reading job as a list of filenames. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L468-L494 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader.clear_input | def clear_input(self):
"""Remove all the input files (at the end of a reading)."""
for item in listdir(self.input_dir):
item_path = path.join(self.input_dir, item)
if path.isfile(item_path):
remove(item_path)
logger.debug('Removed input %s.' % item... | python | def clear_input(self):
"""Remove all the input files (at the end of a reading)."""
for item in listdir(self.input_dir):
item_path = path.join(self.input_dir, item)
if path.isfile(item_path):
remove(item_path)
logger.debug('Removed input %s.' % item... | Remove all the input files (at the end of a reading). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L496-L503 |
sorgerlab/indra | indra/tools/reading/readers.py | ReachReader.read | def read(self, read_list, verbose=False, log=False):
"""Read the content, returning a list of ReadingData objects."""
ret = []
mem_tot = _get_mem_total()
if mem_tot is not None and mem_tot <= self.REACH_MEM + self.MEM_BUFFER:
logger.error(
"Too little memory t... | python | def read(self, read_list, verbose=False, log=False):
"""Read the content, returning a list of ReadingData objects."""
ret = []
mem_tot = _get_mem_total()
if mem_tot is not None and mem_tot <= self.REACH_MEM + self.MEM_BUFFER:
logger.error(
"Too little memory t... | Read the content, returning a list of ReadingData objects. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L505-L549 |
sorgerlab/indra | indra/tools/reading/readers.py | SparserReader.prep_input | def prep_input(self, read_list):
"Prepare the list of files or text content objects to be read."
logger.info('Prepping input for sparser.')
self.file_list = []
for content in read_list:
quality_issue = self._check_content(content.get_text())
if quality_issue is ... | python | def prep_input(self, read_list):
"Prepare the list of files or text content objects to be read."
logger.info('Prepping input for sparser.')
self.file_list = []
for content in read_list:
quality_issue = self._check_content(content.get_text())
if quality_issue is ... | Prepare the list of files or text content objects to be read. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L567-L598 |
sorgerlab/indra | indra/tools/reading/readers.py | SparserReader.get_output | def get_output(self, output_files, clear=True):
"Get the output files as an id indexed dict."
patt = re.compile(r'(.*?)-semantics.*?')
for outpath in output_files:
if outpath is None:
logger.warning("Found outpath with value None. Skipping.")
continue
... | python | def get_output(self, output_files, clear=True):
"Get the output files as an id indexed dict."
patt = re.compile(r'(.*?)-semantics.*?')
for outpath in output_files:
if outpath is None:
logger.warning("Found outpath with value None. Skipping.")
continue
... | Get the output files as an id indexed dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L600-L639 |
sorgerlab/indra | indra/tools/reading/readers.py | SparserReader.read_some | def read_some(self, fpath_list, outbuf=None, verbose=False):
"Perform a few readings."
outpath_list = []
for fpath in fpath_list:
output, outbuf = self.read_one(fpath, outbuf, verbose)
if output is not None:
outpath_list.append(output)
return outpa... | python | def read_some(self, fpath_list, outbuf=None, verbose=False):
"Perform a few readings."
outpath_list = []
for fpath in fpath_list:
output, outbuf = self.read_one(fpath, outbuf, verbose)
if output is not None:
outpath_list.append(output)
return outpa... | Perform a few readings. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L662-L669 |
sorgerlab/indra | indra/tools/reading/readers.py | SparserReader.read | def read(self, read_list, verbose=False, log=False, n_per_proc=None):
"Perform the actual reading."
ret = []
self.prep_input(read_list)
L = len(self.file_list)
if L == 0:
return ret
logger.info("Beginning to run sparser.")
output_file_list = []
... | python | def read(self, read_list, verbose=False, log=False, n_per_proc=None):
"Perform the actual reading."
ret = []
self.prep_input(read_list)
L = len(self.file_list)
if L == 0:
return ret
logger.info("Beginning to run sparser.")
output_file_list = []
... | Perform the actual reading. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L671-L733 |
sorgerlab/indra | indra/sources/isi/api.py | process_text | def process_text(text, pmid=None, cleanup=True, add_grounding=True):
"""Process a string using the ISI reader and extract INDRA statements.
Parameters
----------
text : str
A text string to process
pmid : Optional[str]
The PMID associated with this text (or None if not specified)
... | python | def process_text(text, pmid=None, cleanup=True, add_grounding=True):
"""Process a string using the ISI reader and extract INDRA statements.
Parameters
----------
text : str
A text string to process
pmid : Optional[str]
The PMID associated with this text (or None if not specified)
... | Process a string using the ISI reader and extract INDRA statements.
Parameters
----------
text : str
A text string to process
pmid : Optional[str]
The PMID associated with this text (or None if not specified)
cleanup : Optional[bool]
If True, the temporary folders created fo... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/api.py#L17-L55 |
sorgerlab/indra | indra/sources/isi/api.py | process_nxml | def process_nxml(nxml_filename, pmid=None, extra_annotations=None,
cleanup=True, add_grounding=True):
"""Process an NXML file using the ISI reader
First converts NXML to plain text and preprocesses it, then runs the ISI
reader, and processes the output to extract INDRA Statements.
Par... | python | def process_nxml(nxml_filename, pmid=None, extra_annotations=None,
cleanup=True, add_grounding=True):
"""Process an NXML file using the ISI reader
First converts NXML to plain text and preprocesses it, then runs the ISI
reader, and processes the output to extract INDRA Statements.
Par... | Process an NXML file using the ISI reader
First converts NXML to plain text and preprocesses it, then runs the ISI
reader, and processes the output to extract INDRA Statements.
Parameters
----------
nxml_filename : str
nxml file to process
pmid : Optional[str]
pmid of this nxml... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/api.py#L58-L109 |
sorgerlab/indra | indra/sources/isi/api.py | process_preprocessed | def process_preprocessed(isi_preprocessor, num_processes=1,
output_dir=None, cleanup=True, add_grounding=True):
"""Process a directory of abstracts and/or papers preprocessed using the
specified IsiPreprocessor, to produce a list of extracted INDRA statements.
Parameters
------... | python | def process_preprocessed(isi_preprocessor, num_processes=1,
output_dir=None, cleanup=True, add_grounding=True):
"""Process a directory of abstracts and/or papers preprocessed using the
specified IsiPreprocessor, to produce a list of extracted INDRA statements.
Parameters
------... | Process a directory of abstracts and/or papers preprocessed using the
specified IsiPreprocessor, to produce a list of extracted INDRA statements.
Parameters
----------
isi_preprocessor : indra.sources.isi.preprocessor.IsiPreprocessor
Preprocessor object that has already preprocessed the documen... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/api.py#L112-L193 |
sorgerlab/indra | indra/sources/isi/api.py | process_output_folder | def process_output_folder(folder_path, pmids=None, extra_annotations=None,
add_grounding=True):
"""Recursively extracts statements from all ISI output files in the
given directory and subdirectories.
Parameters
----------
folder_path : str
The directory to traverse... | python | def process_output_folder(folder_path, pmids=None, extra_annotations=None,
add_grounding=True):
"""Recursively extracts statements from all ISI output files in the
given directory and subdirectories.
Parameters
----------
folder_path : str
The directory to traverse... | Recursively extracts statements from all ISI output files in the
given directory and subdirectories.
Parameters
----------
folder_path : str
The directory to traverse
pmids : Optional[str]
PMID mapping to be added to the Evidence of the extracted INDRA
Statements
extra_a... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/api.py#L196-L237 |
sorgerlab/indra | indra/sources/isi/api.py | process_json_file | def process_json_file(file_path, pmid=None, extra_annotations=None,
add_grounding=True):
"""Extracts statements from the given ISI output file.
Parameters
----------
file_path : str
The ISI output file from which to extract statements
pmid : int
The PMID of the... | python | def process_json_file(file_path, pmid=None, extra_annotations=None,
add_grounding=True):
"""Extracts statements from the given ISI output file.
Parameters
----------
file_path : str
The ISI output file from which to extract statements
pmid : int
The PMID of the... | Extracts statements from the given ISI output file.
Parameters
----------
file_path : str
The ISI output file from which to extract statements
pmid : int
The PMID of the document being preprocessed, or None if not
specified
extra_annotations : dict
Extra annotations ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/api.py#L240-L264 |
sorgerlab/indra | indra/sources/cwms/api.py | process_text | def process_text(text, save_xml='cwms_output.xml'):
"""Processes text using the CWMS web service.
Parameters
----------
text : str
Text to process
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
... | python | def process_text(text, save_xml='cwms_output.xml'):
"""Processes text using the CWMS web service.
Parameters
----------
text : str
Text to process
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
... | Processes text using the CWMS web service.
Parameters
----------
text : str
Text to process
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
statements attribute. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/api.py#L11-L35 |
sorgerlab/indra | indra/sources/cwms/api.py | process_ekb_file | def process_ekb_file(fname):
"""Processes an EKB file produced by CWMS.
Parameters
----------
fname : str
Path to the EKB file to process.
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
stateme... | python | def process_ekb_file(fname):
"""Processes an EKB file produced by CWMS.
Parameters
----------
fname : str
Path to the EKB file to process.
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
stateme... | Processes an EKB file produced by CWMS.
Parameters
----------
fname : str
Path to the EKB file to process.
Returns
-------
cp : indra.sources.cwms.CWMSProcessor
A CWMSProcessor, which contains a list of INDRA statements in its
statements attribute. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/api.py#L38-L55 |
sorgerlab/indra | indra/assemblers/pysb/kappa_util.py | im_json_to_graph | def im_json_to_graph(im_json):
"""Return networkx graph from Kappy's influence map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains an influence map generated by Kappy.
Returns
-------
graph : networkx.MultiDiGraph
A graph representing the influence map... | python | def im_json_to_graph(im_json):
"""Return networkx graph from Kappy's influence map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains an influence map generated by Kappy.
Returns
-------
graph : networkx.MultiDiGraph
A graph representing the influence map... | Return networkx graph from Kappy's influence map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains an influence map generated by Kappy.
Returns
-------
graph : networkx.MultiDiGraph
A graph representing the influence map. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/kappa_util.py#L7-L57 |
sorgerlab/indra | indra/assemblers/pysb/kappa_util.py | cm_json_to_graph | def cm_json_to_graph(im_json):
"""Return pygraphviz Agraph from Kappy's contact map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains a contact map generated by Kappy.
Returns
-------
graph : pygraphviz.Agraph
A graph representing the contact map.
""... | python | def cm_json_to_graph(im_json):
"""Return pygraphviz Agraph from Kappy's contact map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains a contact map generated by Kappy.
Returns
-------
graph : pygraphviz.Agraph
A graph representing the contact map.
""... | Return pygraphviz Agraph from Kappy's contact map JSON.
Parameters
----------
im_json : dict
A JSON dict which contains a contact map generated by Kappy.
Returns
-------
graph : pygraphviz.Agraph
A graph representing the contact map. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/kappa_util.py#L60-L104 |
sorgerlab/indra | indra/tools/machine/gmail_client.py | fetch_email | def fetch_email(M, msg_id):
"""Returns the given email message as a unicode string."""
res, data = M.fetch(msg_id, '(RFC822)')
if res == 'OK':
# Data here is a list with 1 element containing a tuple
# whose 2nd element is a long string containing the email
# The content is a bytes th... | python | def fetch_email(M, msg_id):
"""Returns the given email message as a unicode string."""
res, data = M.fetch(msg_id, '(RFC822)')
if res == 'OK':
# Data here is a list with 1 element containing a tuple
# whose 2nd element is a long string containing the email
# The content is a bytes th... | Returns the given email message as a unicode string. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/gmail_client.py#L28-L47 |
sorgerlab/indra | indra/tools/machine/gmail_client.py | get_headers | def get_headers(msg):
"""Takes email.message.Message object initialized from unicode string,
returns dict with header fields."""
headers = {}
for k in msg.keys():
# decode_header decodes header but does not convert charset, so these
# may still be bytes, even in Python 3. However, if it'... | python | def get_headers(msg):
"""Takes email.message.Message object initialized from unicode string,
returns dict with header fields."""
headers = {}
for k in msg.keys():
# decode_header decodes header but does not convert charset, so these
# may still be bytes, even in Python 3. However, if it'... | Takes email.message.Message object initialized from unicode string,
returns dict with header fields. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/gmail_client.py#L49-L62 |
sorgerlab/indra | indra/config.py | populate_config_dict | def populate_config_dict(config_path):
"""Load the configuration file into the config_file dictionary
A ConfigParser-style configuration file can have multiple sections, but
we ignore the section distinction and load the key/value pairs from all
sections into a single key/value list.
"""
try:
... | python | def populate_config_dict(config_path):
"""Load the configuration file into the config_file dictionary
A ConfigParser-style configuration file can have multiple sections, but
we ignore the section distinction and load the key/value pairs from all
sections into a single key/value list.
"""
try:
... | Load the configuration file into the config_file dictionary
A ConfigParser-style configuration file can have multiple sections, but
we ignore the section distinction and load the key/value pairs from all
sections into a single key/value list. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/config.py#L31-L58 |
sorgerlab/indra | indra/config.py | get_config | def get_config(key, failure_ok=True):
"""Get value by key from config file or environment.
Returns the configuration value, first checking the environment
variables and then, if it's not present there, checking the configuration
file.
Parameters
----------
key : str
The key for the... | python | def get_config(key, failure_ok=True):
"""Get value by key from config file or environment.
Returns the configuration value, first checking the environment
variables and then, if it's not present there, checking the configuration
file.
Parameters
----------
key : str
The key for the... | Get value by key from config file or environment.
Returns the configuration value, first checking the environment
variables and then, if it's not present there, checking the configuration
file.
Parameters
----------
key : str
The key for the configuration value to fetch
failure_ok ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/config.py#L85-L122 |
sorgerlab/indra | indra/util/__init__.py | read_unicode_csv_fileobj | def read_unicode_csv_fileobj(fileobj, delimiter=',', quotechar='"',
quoting=csv.QUOTE_MINIMAL, lineterminator='\n',
encoding='utf-8', skiprows=0):
"""fileobj can be a StringIO in Py3, but should be a BytesIO in Py2."""
# Python 3 version
if sys.versi... | python | def read_unicode_csv_fileobj(fileobj, delimiter=',', quotechar='"',
quoting=csv.QUOTE_MINIMAL, lineterminator='\n',
encoding='utf-8', skiprows=0):
"""fileobj can be a StringIO in Py3, but should be a BytesIO in Py2."""
# Python 3 version
if sys.versi... | fileobj can be a StringIO in Py3, but should be a BytesIO in Py2. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/__init__.py#L113-L141 |
sorgerlab/indra | indra/util/__init__.py | fast_deepcopy | def fast_deepcopy(obj):
"""This is a faster implementation of deepcopy via pickle.
It is meant primarily for sets of Statements with complex hierarchies
but can be used for any object.
"""
with BytesIO() as buf:
pickle.dump(obj, buf)
buf.seek(0)
obj_new = pickle.load(buf)
... | python | def fast_deepcopy(obj):
"""This is a faster implementation of deepcopy via pickle.
It is meant primarily for sets of Statements with complex hierarchies
but can be used for any object.
"""
with BytesIO() as buf:
pickle.dump(obj, buf)
buf.seek(0)
obj_new = pickle.load(buf)
... | This is a faster implementation of deepcopy via pickle.
It is meant primarily for sets of Statements with complex hierarchies
but can be used for any object. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/__init__.py#L198-L208 |
sorgerlab/indra | indra/util/__init__.py | flatten | def flatten(l):
"""Flatten a nested list."""
return sum(map(flatten, l), []) \
if isinstance(l, list) or isinstance(l, tuple) else [l] | python | def flatten(l):
"""Flatten a nested list."""
return sum(map(flatten, l), []) \
if isinstance(l, list) or isinstance(l, tuple) else [l] | Flatten a nested list. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/__init__.py#L216-L219 |
sorgerlab/indra | indra/util/__init__.py | batch_iter | def batch_iter(iterator, batch_size, return_func=None, padding=None):
"""Break an iterable into batches of size batch_size
Note that `padding` should be set to something (anything) which is NOT a
valid member of the iterator. For example, None works for [0,1,2,...10], but
not for ['a', None, 'c', 'd'].... | python | def batch_iter(iterator, batch_size, return_func=None, padding=None):
"""Break an iterable into batches of size batch_size
Note that `padding` should be set to something (anything) which is NOT a
valid member of the iterator. For example, None works for [0,1,2,...10], but
not for ['a', None, 'c', 'd'].... | Break an iterable into batches of size batch_size
Note that `padding` should be set to something (anything) which is NOT a
valid member of the iterator. For example, None works for [0,1,2,...10], but
not for ['a', None, 'c', 'd'].
Parameters
----------
iterator : iterable
A python obje... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/__init__.py#L227-L256 |
sorgerlab/indra | indra/tools/reading/run_drum_reading.py | read_pmid_sentences | def read_pmid_sentences(pmid_sentences, **drum_args):
"""Read sentences from a PMID-keyed dictonary and return all Statements
Parameters
----------
pmid_sentences : dict[str, list[str]]
A dictonary where each key is a PMID pointing to a list of sentences
to be read.
**drum_args
... | python | def read_pmid_sentences(pmid_sentences, **drum_args):
"""Read sentences from a PMID-keyed dictonary and return all Statements
Parameters
----------
pmid_sentences : dict[str, list[str]]
A dictonary where each key is a PMID pointing to a list of sentences
to be read.
**drum_args
... | Read sentences from a PMID-keyed dictonary and return all Statements
Parameters
----------
pmid_sentences : dict[str, list[str]]
A dictonary where each key is a PMID pointing to a list of sentences
to be read.
**drum_args
Keyword arguments passed directly to the DrumReader. Typ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/run_drum_reading.py#L14-L86 |
sorgerlab/indra | indra/sources/biopax/pathway_commons_client.py | graph_query | def graph_query(kind, source, target=None, neighbor_limit=1,
database_filter=None):
"""Perform a graph query on PathwayCommons.
For more information on these queries, see
http://www.pathwaycommons.org/pc2/#graph
Parameters
----------
kind : str
The kind of graph query t... | python | def graph_query(kind, source, target=None, neighbor_limit=1,
database_filter=None):
"""Perform a graph query on PathwayCommons.
For more information on these queries, see
http://www.pathwaycommons.org/pc2/#graph
Parameters
----------
kind : str
The kind of graph query t... | Perform a graph query on PathwayCommons.
For more information on these queries, see
http://www.pathwaycommons.org/pc2/#graph
Parameters
----------
kind : str
The kind of graph query to perform. Currently 3 options are
implemented, 'neighborhood', 'pathsbetween' and 'pathsfromto'.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/pathway_commons_client.py#L17-L99 |
sorgerlab/indra | indra/sources/biopax/pathway_commons_client.py | owl_str_to_model | def owl_str_to_model(owl_str):
"""Return a BioPAX model object from an OWL string.
Parameters
----------
owl_str : str
The model as an OWL string.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
"""
io_class = auto... | python | def owl_str_to_model(owl_str):
"""Return a BioPAX model object from an OWL string.
Parameters
----------
owl_str : str
The model as an OWL string.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
"""
io_class = auto... | Return a BioPAX model object from an OWL string.
Parameters
----------
owl_str : str
The model as an OWL string.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/pathway_commons_client.py#L101-L121 |
sorgerlab/indra | indra/sources/biopax/pathway_commons_client.py | owl_to_model | def owl_to_model(fname):
"""Return a BioPAX model object from an OWL file.
Parameters
----------
fname : str
The name of the OWL file containing the model.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
"""
io_cla... | python | def owl_to_model(fname):
"""Return a BioPAX model object from an OWL file.
Parameters
----------
fname : str
The name of the OWL file containing the model.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
"""
io_cla... | Return a BioPAX model object from an OWL file.
Parameters
----------
fname : str
The name of the OWL file containing the model.
Returns
-------
biopax_model : org.biopax.paxtools.model.Model
A BioPAX model object (java object). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/pathway_commons_client.py#L123-L153 |
sorgerlab/indra | indra/sources/biopax/pathway_commons_client.py | model_to_owl | def model_to_owl(model, fname):
"""Save a BioPAX model object as an OWL file.
Parameters
----------
model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
fname : str
The name of the OWL file to save the model in.
"""
io_class = autoclass('org.biopax.pa... | python | def model_to_owl(model, fname):
"""Save a BioPAX model object as an OWL file.
Parameters
----------
model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
fname : str
The name of the OWL file to save the model in.
"""
io_class = autoclass('org.biopax.pa... | Save a BioPAX model object as an OWL file.
Parameters
----------
model : org.biopax.paxtools.model.Model
A BioPAX model object (java object).
fname : str
The name of the OWL file to save the model in. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/pathway_commons_client.py#L155-L179 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.make_model | def make_model(self, *args, **kwargs):
"""Assemble a Cytoscape JS network from INDRA Statements.
This method assembles a Cytoscape JS network from the set of INDRA
Statements added to the assembler.
Parameters
----------
grouping : bool
If True, the nodes wi... | python | def make_model(self, *args, **kwargs):
"""Assemble a Cytoscape JS network from INDRA Statements.
This method assembles a Cytoscape JS network from the set of INDRA
Statements added to the assembler.
Parameters
----------
grouping : bool
If True, the nodes wi... | Assemble a Cytoscape JS network from INDRA Statements.
This method assembles a Cytoscape JS network from the set of INDRA
Statements added to the assembler.
Parameters
----------
grouping : bool
If True, the nodes with identical incoming and outgoing edges
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L69-L107 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.get_gene_names | def get_gene_names(self):
"""Gather gene names of all nodes and node members"""
# Collect all gene names in network
gene_names = []
for node in self._nodes:
members = node['data'].get('members')
if members:
gene_names += list(members.keys())
... | python | def get_gene_names(self):
"""Gather gene names of all nodes and node members"""
# Collect all gene names in network
gene_names = []
for node in self._nodes:
members = node['data'].get('members')
if members:
gene_names += list(members.keys())
... | Gather gene names of all nodes and node members | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L109-L121 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.set_CCLE_context | def set_CCLE_context(self, cell_types):
"""Set context of all nodes and node members from CCLE."""
self.get_gene_names()
# Get expression and mutations from context client
exp_values = \
context_client.get_protein_expression(self._gene_names, cell_types)
mut_values =... | python | def set_CCLE_context(self, cell_types):
"""Set context of all nodes and node members from CCLE."""
self.get_gene_names()
# Get expression and mutations from context client
exp_values = \
context_client.get_protein_expression(self._gene_names, cell_types)
mut_values =... | Set context of all nodes and node members from CCLE. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L123-L177 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.print_cyjs_graph | def print_cyjs_graph(self):
"""Return the assembled Cytoscape JS network as a json string.
Returns
-------
cyjs_str : str
A json string representation of the Cytoscape JS network.
"""
cyjs_dict = {'edges': self._edges, 'nodes': self._nodes}
cyjs_str =... | python | def print_cyjs_graph(self):
"""Return the assembled Cytoscape JS network as a json string.
Returns
-------
cyjs_str : str
A json string representation of the Cytoscape JS network.
"""
cyjs_dict = {'edges': self._edges, 'nodes': self._nodes}
cyjs_str =... | Return the assembled Cytoscape JS network as a json string.
Returns
-------
cyjs_str : str
A json string representation of the Cytoscape JS network. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L179-L189 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.print_cyjs_context | def print_cyjs_context(self):
"""Return a list of node names and their respective context.
Returns
-------
cyjs_str_context : str
A json string of the context dictionary. e.g. -
{'CCLE' : {'bin_expression' : {'cell_line1' : {'gene1':'val1'} },
'bin_ex... | python | def print_cyjs_context(self):
"""Return a list of node names and their respective context.
Returns
-------
cyjs_str_context : str
A json string of the context dictionary. e.g. -
{'CCLE' : {'bin_expression' : {'cell_line1' : {'gene1':'val1'} },
'bin_ex... | Return a list of node names and their respective context.
Returns
-------
cyjs_str_context : str
A json string of the context dictionary. e.g. -
{'CCLE' : {'bin_expression' : {'cell_line1' : {'gene1':'val1'} },
'bin_expression' : {'cell_line' : {'gene1':'val1... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L191-L204 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.save_json | def save_json(self, fname_prefix='model'):
"""Save the assembled Cytoscape JS network in a json file.
This method saves two files based on the file name prefix given.
It saves one json file with the graph itself, and another json
file with the context.
Parameters
------... | python | def save_json(self, fname_prefix='model'):
"""Save the assembled Cytoscape JS network in a json file.
This method saves two files based on the file name prefix given.
It saves one json file with the graph itself, and another json
file with the context.
Parameters
------... | Save the assembled Cytoscape JS network in a json file.
This method saves two files based on the file name prefix given.
It saves one json file with the graph itself, and another json
file with the context.
Parameters
----------
fname_prefix : Optional[str]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L206-L227 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler.save_model | def save_model(self, fname='model.js'):
"""Save the assembled Cytoscape JS network in a js file.
Parameters
----------
file_name : Optional[str]
The name of the file to save the Cytoscape JS network to.
Default: model.js
"""
exp_colorscale_str = j... | python | def save_model(self, fname='model.js'):
"""Save the assembled Cytoscape JS network in a js file.
Parameters
----------
file_name : Optional[str]
The name of the file to save the Cytoscape JS network to.
Default: model.js
"""
exp_colorscale_str = j... | Save the assembled Cytoscape JS network in a js file.
Parameters
----------
file_name : Optional[str]
The name of the file to save the Cytoscape JS network to.
Default: model.js | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L229-L250 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler._get_edge_dict | def _get_edge_dict(self):
"""Return a dict of edges.
Keyed tuples of (i, source, target, polarity)
with lists of edge ids [id1, id2, ...]
"""
edge_dict = collections.defaultdict(lambda: [])
if len(self._edges) > 0:
for e in self._edges:
data =... | python | def _get_edge_dict(self):
"""Return a dict of edges.
Keyed tuples of (i, source, target, polarity)
with lists of edge ids [id1, id2, ...]
"""
edge_dict = collections.defaultdict(lambda: [])
if len(self._edges) > 0:
for e in self._edges:
data =... | Return a dict of edges.
Keyed tuples of (i, source, target, polarity)
with lists of edge ids [id1, id2, ...] | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L282-L295 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler._get_node_key | def _get_node_key(self, node_dict_item):
"""Return a tuple of sorted sources and targets given a node dict."""
s = tuple(sorted(node_dict_item['sources']))
t = tuple(sorted(node_dict_item['targets']))
return (s, t) | python | def _get_node_key(self, node_dict_item):
"""Return a tuple of sorted sources and targets given a node dict."""
s = tuple(sorted(node_dict_item['sources']))
t = tuple(sorted(node_dict_item['targets']))
return (s, t) | Return a tuple of sorted sources and targets given a node dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L360-L364 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler._get_node_groups | def _get_node_groups(self):
"""Return a list of node id lists that are topologically identical.
First construct a node_dict which is keyed to the node id and
has a value which is a dict with keys 'sources' and 'targets'.
The 'sources' and 'targets' each contain a list of tuples
... | python | def _get_node_groups(self):
"""Return a list of node id lists that are topologically identical.
First construct a node_dict which is keyed to the node id and
has a value which is a dict with keys 'sources' and 'targets'.
The 'sources' and 'targets' each contain a list of tuples
... | Return a list of node id lists that are topologically identical.
First construct a node_dict which is keyed to the node id and
has a value which is a dict with keys 'sources' and 'targets'.
The 'sources' and 'targets' each contain a list of tuples
(i, polarity, source) edge of the node.... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L366-L396 |
sorgerlab/indra | indra/assemblers/cyjs/assembler.py | CyJSAssembler._group_edges | def _group_edges(self):
"""Group all edges that are topologically identical.
This means that (i, source, target, polarity) are the same, then sets
edges on parent (i.e. - group) nodes to 'Virtual' and creates a new
edge to represent all of them.
"""
# edit edges on paren... | python | def _group_edges(self):
"""Group all edges that are topologically identical.
This means that (i, source, target, polarity) are the same, then sets
edges on parent (i.e. - group) nodes to 'Virtual' and creates a new
edge to represent all of them.
"""
# edit edges on paren... | Group all edges that are topologically identical.
This means that (i, source, target, polarity) are the same, then sets
edges on parent (i.e. - group) nodes to 'Virtual' and creates a new
edge to represent all of them. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cyjs/assembler.py#L398-L442 |
sorgerlab/indra | indra/sources/trrust/processor.py | make_stmt | def make_stmt(stmt_cls, tf_agent, target_agent, pmid):
"""Return a Statement based on its type, agents, and PMID."""
ev = Evidence(source_api='trrust', pmid=pmid)
return stmt_cls(deepcopy(tf_agent), deepcopy(target_agent),
evidence=[ev]) | python | def make_stmt(stmt_cls, tf_agent, target_agent, pmid):
"""Return a Statement based on its type, agents, and PMID."""
ev = Evidence(source_api='trrust', pmid=pmid)
return stmt_cls(deepcopy(tf_agent), deepcopy(target_agent),
evidence=[ev]) | Return a Statement based on its type, agents, and PMID. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trrust/processor.py#L37-L41 |
sorgerlab/indra | indra/sources/trrust/processor.py | get_grounded_agent | def get_grounded_agent(gene_name):
"""Return a grounded Agent based on an HGNC symbol."""
db_refs = {'TEXT': gene_name}
if gene_name in hgnc_map:
gene_name = hgnc_map[gene_name]
hgnc_id = hgnc_client.get_hgnc_id(gene_name)
if hgnc_id:
db_refs['HGNC'] = hgnc_id
up_id = hgnc_cl... | python | def get_grounded_agent(gene_name):
"""Return a grounded Agent based on an HGNC symbol."""
db_refs = {'TEXT': gene_name}
if gene_name in hgnc_map:
gene_name = hgnc_map[gene_name]
hgnc_id = hgnc_client.get_hgnc_id(gene_name)
if hgnc_id:
db_refs['HGNC'] = hgnc_id
up_id = hgnc_cl... | Return a grounded Agent based on an HGNC symbol. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trrust/processor.py#L44-L56 |
sorgerlab/indra | indra/sources/trrust/processor.py | TrrustProcessor.extract_statements | def extract_statements(self):
"""Process the table to extract Statements."""
for _, (tf, target, effect, refs) in self.df.iterrows():
tf_agent = get_grounded_agent(tf)
target_agent = get_grounded_agent(target)
if effect == 'Activation':
stmt_cls = Incr... | python | def extract_statements(self):
"""Process the table to extract Statements."""
for _, (tf, target, effect, refs) in self.df.iterrows():
tf_agent = get_grounded_agent(tf)
target_agent = get_grounded_agent(target)
if effect == 'Activation':
stmt_cls = Incr... | Process the table to extract Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trrust/processor.py#L20-L34 |
sorgerlab/indra | indra/tools/machine/machine.py | process_paper | def process_paper(model_name, pmid):
"""Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
A ReachProcessor containing th... | python | def process_paper(model_name, pmid):
"""Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
A ReachProcessor containing th... | Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
A ReachProcessor containing the extracted INDRA Statements
in rp.s... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/machine.py#L91-L140 |
sorgerlab/indra | indra/tools/machine/machine.py | process_paper_helper | def process_paper_helper(model_name, pmid, start_time_local):
"""Wraps processing a paper by either a local or remote service
and caches any uncaught exceptions"""
try:
if not aws_available:
rp, txt_format = process_paper(model_name, pmid)
else:
rp, txt_format = proce... | python | def process_paper_helper(model_name, pmid, start_time_local):
"""Wraps processing a paper by either a local or remote service
and caches any uncaught exceptions"""
try:
if not aws_available:
rp, txt_format = process_paper(model_name, pmid)
else:
rp, txt_format = proce... | Wraps processing a paper by either a local or remote service
and caches any uncaught exceptions | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/machine.py#L196-L208 |
sorgerlab/indra | indra/tools/machine/machine.py | run_with_search_helper | def run_with_search_helper(model_path, config, num_days=None):
logger.info('-------------------------')
logger.info(time.strftime('%c'))
if not os.path.isdir(model_path):
logger.error('%s is not a directory', model_path)
sys.exit()
default_config_fname = os.path.join(model_path, 'confi... | python | def run_with_search_helper(model_path, config, num_days=None):
logger.info('-------------------------')
logger.info(time.strftime('%c'))
if not os.path.isdir(model_path):
logger.error('%s is not a directory', model_path)
sys.exit()
default_config_fname = os.path.join(model_path, 'confi... | # Get PMIDs for search_genes
# Temporarily removed because Entrez-based article searches
# are lagging behind and cannot be time-limited
if not search_genes:
logger.info('No search genes argument (search_genes) specified.')
else:
logger.info('Using search genes: %s' % ', '.join(search_ge... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/machine.py#L523-L637 |
sorgerlab/indra | indra/sources/tas/api.py | _load_data | def _load_data():
"""Load the data from the csv in data.
The "gene_id" is the Entrez gene id, and the "approved_symbol" is the
standard gene symbol. The "hms_id" is the LINCS ID for the drug.
Returns
-------
data : list[dict]
A list of dicts of row values keyed by the column headers ex... | python | def _load_data():
"""Load the data from the csv in data.
The "gene_id" is the Entrez gene id, and the "approved_symbol" is the
standard gene symbol. The "hms_id" is the LINCS ID for the drug.
Returns
-------
data : list[dict]
A list of dicts of row values keyed by the column headers ex... | Load the data from the csv in data.
The "gene_id" is the Entrez gene id, and the "approved_symbol" is the
standard gene symbol. The "hms_id" is the LINCS ID for the drug.
Returns
-------
data : list[dict]
A list of dicts of row values keyed by the column headers extracted from
the ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/tas/api.py#L15-L39 |
sorgerlab/indra | indra/sources/eidos/cli.py | run_eidos | def run_eidos(endpoint, *args):
"""Run a given enpoint of Eidos through the command line.
Parameters
----------
endpoint : str
The class within the Eidos package to run, for instance
'apps.ExtractFromDirectory' will run
'org.clulab.wm.eidos.apps.ExtractFromDirectory'
*args
... | python | def run_eidos(endpoint, *args):
"""Run a given enpoint of Eidos through the command line.
Parameters
----------
endpoint : str
The class within the Eidos package to run, for instance
'apps.ExtractFromDirectory' will run
'org.clulab.wm.eidos.apps.ExtractFromDirectory'
*args
... | Run a given enpoint of Eidos through the command line.
Parameters
----------
endpoint : str
The class within the Eidos package to run, for instance
'apps.ExtractFromDirectory' will run
'org.clulab.wm.eidos.apps.ExtractFromDirectory'
*args
Any further arguments to be pass... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/cli.py#L20-L38 |
sorgerlab/indra | indra/sources/eidos/cli.py | extract_from_directory | def extract_from_directory(path_in, path_out):
"""Run Eidos on a set of text files in a folder.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with some text files... | python | def extract_from_directory(path_in, path_out):
"""Run Eidos on a set of text files in a folder.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with some text files... | Run Eidos on a set of text files in a folder.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with some text files
path_out : str
Path to an output folder i... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/cli.py#L41-L58 |
sorgerlab/indra | indra/sources/eidos/cli.py | extract_and_process | def extract_and_process(path_in, path_out):
"""Run Eidos on a set of text files and process output with INDRA.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with ... | python | def extract_and_process(path_in, path_out):
"""Run Eidos on a set of text files and process output with INDRA.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with ... | Run Eidos on a set of text files and process output with INDRA.
The output is produced in the specified output folder but
the output files aren't processed by this function.
Parameters
----------
path_in : str
Path to an input folder with some text files
path_out : str
Path to ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/cli.py#L61-L91 |
sorgerlab/indra | indra/sources/indra_db_rest/api.py | get_statements | def get_statements(subject=None, object=None, agents=None, stmt_type=None,
use_exact_type=False, persist=True, timeout=None,
simple_response=False, ev_limit=10, best_first=True, tries=2,
max_stmts=None):
"""Get a processor for the INDRA DB web API matching gi... | python | def get_statements(subject=None, object=None, agents=None, stmt_type=None,
use_exact_type=False, persist=True, timeout=None,
simple_response=False, ev_limit=10, best_first=True, tries=2,
max_stmts=None):
"""Get a processor for the INDRA DB web API matching gi... | Get a processor for the INDRA DB web API matching given agents and type.
There are two types of responses available. You can just get a list of
INDRA Statements, or you can get an IndraDBRestProcessor object, which allow
Statements to be loaded in a background thread, providing a sample of the
best* co... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/api.py#L15-L116 |
sorgerlab/indra | indra/sources/indra_db_rest/api.py | get_statements_by_hash | def get_statements_by_hash(hash_list, ev_limit=100, best_first=True, tries=2):
"""Get fully formed statements from a list of hashes.
Parameters
----------
hash_list : list[int or str]
A list of statement hashes.
ev_limit : int or None
Limit the amount of evidence returned per Statem... | python | def get_statements_by_hash(hash_list, ev_limit=100, best_first=True, tries=2):
"""Get fully formed statements from a list of hashes.
Parameters
----------
hash_list : list[int or str]
A list of statement hashes.
ev_limit : int or None
Limit the amount of evidence returned per Statem... | Get fully formed statements from a list of hashes.
Parameters
----------
hash_list : list[int or str]
A list of statement hashes.
ev_limit : int or None
Limit the amount of evidence returned per Statement. Default is 100.
best_first : bool
If True, the preassembled statement... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/api.py#L120-L154 |
sorgerlab/indra | indra/sources/indra_db_rest/api.py | get_statements_for_paper | def get_statements_for_paper(ids, ev_limit=10, best_first=True, tries=2,
max_stmts=None):
"""Get the set of raw Statements extracted from a paper given by the id.
Parameters
----------
ids : list[(<id type>, <id value>)]
A list of tuples with ids and their type. The... | python | def get_statements_for_paper(ids, ev_limit=10, best_first=True, tries=2,
max_stmts=None):
"""Get the set of raw Statements extracted from a paper given by the id.
Parameters
----------
ids : list[(<id type>, <id value>)]
A list of tuples with ids and their type. The... | Get the set of raw Statements extracted from a paper given by the id.
Parameters
----------
ids : list[(<id type>, <id value>)]
A list of tuples with ids and their type. The type can be any one of
'pmid', 'pmcid', 'doi', 'pii', 'manuscript id', or 'trid', which is the
primary key id... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/api.py#L158-L194 |
sorgerlab/indra | indra/sources/indra_db_rest/api.py | submit_curation | def submit_curation(hash_val, tag, curator, text=None,
source='indra_rest_client', ev_hash=None, is_test=False):
"""Submit a curation for the given statement at the relevant level.
Parameters
----------
hash_val : int
The hash corresponding to the statement.
tag : str
... | python | def submit_curation(hash_val, tag, curator, text=None,
source='indra_rest_client', ev_hash=None, is_test=False):
"""Submit a curation for the given statement at the relevant level.
Parameters
----------
hash_val : int
The hash corresponding to the statement.
tag : str
... | Submit a curation for the given statement at the relevant level.
Parameters
----------
hash_val : int
The hash corresponding to the statement.
tag : str
A very short phrase categorizing the error or type of curation,
e.g. "grounding" for a grounding error, or "correct" if you ar... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/api.py#L197-L231 |
sorgerlab/indra | indra/sources/indra_db_rest/api.py | get_statement_queries | def get_statement_queries(stmts, **params):
"""Get queries used to search based on a statement.
In addition to the stmts, you can enter any parameters standard to the
query. See https://github.com/indralab/indra_db/rest_api for a full list.
Parameters
----------
stmts : list[Statement]
... | python | def get_statement_queries(stmts, **params):
"""Get queries used to search based on a statement.
In addition to the stmts, you can enter any parameters standard to the
query. See https://github.com/indralab/indra_db/rest_api for a full list.
Parameters
----------
stmts : list[Statement]
... | Get queries used to search based on a statement.
In addition to the stmts, you can enter any parameters standard to the
query. See https://github.com/indralab/indra_db/rest_api for a full list.
Parameters
----------
stmts : list[Statement]
A list of INDRA statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/api.py#L234-L274 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.save | def save(self, model_fname='model.pkl'):
"""Save the state of the IncrementalModel in a pickle file.
Parameters
----------
model_fname : Optional[str]
The name of the pickle file to save the state of the
IncrementalModel in. Default: model.pkl
"""
... | python | def save(self, model_fname='model.pkl'):
"""Save the state of the IncrementalModel in a pickle file.
Parameters
----------
model_fname : Optional[str]
The name of the pickle file to save the state of the
IncrementalModel in. Default: model.pkl
"""
... | Save the state of the IncrementalModel in a pickle file.
Parameters
----------
model_fname : Optional[str]
The name of the pickle file to save the state of the
IncrementalModel in. Default: model.pkl | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L45-L55 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.add_statements | def add_statements(self, pmid, stmts):
"""Add INDRA Statements to the incremental model indexed by PMID.
Parameters
----------
pmid : str
The PMID of the paper from which statements were extracted.
stmts : list[indra.statements.Statement]
A list of INDRA ... | python | def add_statements(self, pmid, stmts):
"""Add INDRA Statements to the incremental model indexed by PMID.
Parameters
----------
pmid : str
The PMID of the paper from which statements were extracted.
stmts : list[indra.statements.Statement]
A list of INDRA ... | Add INDRA Statements to the incremental model indexed by PMID.
Parameters
----------
pmid : str
The PMID of the paper from which statements were extracted.
stmts : list[indra.statements.Statement]
A list of INDRA Statements to be added to the model. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L57-L70 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.preassemble | def preassemble(self, filters=None, grounding_map=None):
"""Preassemble the Statements collected in the model.
Use INDRA's GroundingMapper, Preassembler and BeliefEngine
on the IncrementalModel and save the unique statements and
the top level statements in class attributes.
Cur... | python | def preassemble(self, filters=None, grounding_map=None):
"""Preassemble the Statements collected in the model.
Use INDRA's GroundingMapper, Preassembler and BeliefEngine
on the IncrementalModel and save the unique statements and
the top level statements in class attributes.
Cur... | Preassemble the Statements collected in the model.
Use INDRA's GroundingMapper, Preassembler and BeliefEngine
on the IncrementalModel and save the unique statements and
the top level statements in class attributes.
Currently the following filter options are implemented:
- groun... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L84-L134 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.get_model_agents | def get_model_agents(self):
"""Return a list of all Agents from all Statements.
Returns
-------
agents : list[indra.statements.Agent]
A list of Agents that are in the model.
"""
model_stmts = self.get_statements()
agents = []
for stmt in model_... | python | def get_model_agents(self):
"""Return a list of all Agents from all Statements.
Returns
-------
agents : list[indra.statements.Agent]
A list of Agents that are in the model.
"""
model_stmts = self.get_statements()
agents = []
for stmt in model_... | Return a list of all Agents from all Statements.
Returns
-------
agents : list[indra.statements.Agent]
A list of Agents that are in the model. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L149-L163 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.get_statements | def get_statements(self):
"""Return a list of all Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model.
"""
stmt_lists = [v for k, v in self.stmts.items()]
stmts = []
... | python | def get_statements(self):
"""Return a list of all Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model.
"""
stmt_lists = [v for k, v in self.stmts.items()]
stmts = []
... | Return a list of all Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L165-L177 |
sorgerlab/indra | indra/tools/incremental_model.py | IncrementalModel.get_statements_noprior | def get_statements_noprior(self):
"""Return a list of all non-prior Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model (excluding
the prior).
"""
stmt_lists = [v fo... | python | def get_statements_noprior(self):
"""Return a list of all non-prior Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model (excluding
the prior).
"""
stmt_lists = [v fo... | Return a list of all non-prior Statements in a single list.
Returns
-------
stmts : list[indra.statements.Statement]
A list of all the INDRA Statements in the model (excluding
the prior). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L179-L192 |
sorgerlab/indra | indra/sources/bel/api.py | process_ndex_neighborhood | def process_ndex_neighborhood(gene_names, network_id=None,
rdf_out='bel_output.rdf', print_output=True):
"""Return a BelRdfProcessor for an NDEx network neighborhood.
Parameters
----------
gene_names : list
A list of HGNC gene symbols to search the neighborhood of.... | python | def process_ndex_neighborhood(gene_names, network_id=None,
rdf_out='bel_output.rdf', print_output=True):
"""Return a BelRdfProcessor for an NDEx network neighborhood.
Parameters
----------
gene_names : list
A list of HGNC gene symbols to search the neighborhood of.... | Return a BelRdfProcessor for an NDEx network neighborhood.
Parameters
----------
gene_names : list
A list of HGNC gene symbols to search the neighborhood of.
Example: ['BRAF', 'MAP2K1']
network_id : Optional[str]
The UUID of the network in NDEx. By default, the BEL Large Corpus
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L20-L71 |
sorgerlab/indra | indra/sources/bel/api.py | process_pybel_neighborhood | def process_pybel_neighborhood(gene_names, network_file=None,
network_type='belscript', **kwargs):
"""Return PybelProcessor around neighborhood of given genes in a network.
This function processes the given network file and filters the returned
Statements to ones that contain... | python | def process_pybel_neighborhood(gene_names, network_file=None,
network_type='belscript', **kwargs):
"""Return PybelProcessor around neighborhood of given genes in a network.
This function processes the given network file and filters the returned
Statements to ones that contain... | Return PybelProcessor around neighborhood of given genes in a network.
This function processes the given network file and filters the returned
Statements to ones that contain genes in the given list.
Parameters
----------
network_file : Optional[str]
Path to the network file to process. If... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L74-L119 |
sorgerlab/indra | indra/sources/bel/api.py | process_belrdf | def process_belrdf(rdf_str, print_output=True):
"""Return a BelRdfProcessor for a BEL/RDF string.
Parameters
----------
rdf_str : str
A BEL/RDF string to be processed. This will usually come from reading
a .rdf file.
Returns
-------
bp : BelRdfProcessor
A BelRdfProc... | python | def process_belrdf(rdf_str, print_output=True):
"""Return a BelRdfProcessor for a BEL/RDF string.
Parameters
----------
rdf_str : str
A BEL/RDF string to be processed. This will usually come from reading
a .rdf file.
Returns
-------
bp : BelRdfProcessor
A BelRdfProc... | Return a BelRdfProcessor for a BEL/RDF string.
Parameters
----------
rdf_str : str
A BEL/RDF string to be processed. This will usually come from reading
a .rdf file.
Returns
-------
bp : BelRdfProcessor
A BelRdfProcessor object which contains INDRA Statements in
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L122-L163 |
sorgerlab/indra | indra/sources/bel/api.py | process_pybel_graph | def process_pybel_graph(graph):
"""Return a PybelProcessor by processing a PyBEL graph.
Parameters
----------
graph : pybel.struct.BELGraph
A PyBEL graph to process
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
bp.sta... | python | def process_pybel_graph(graph):
"""Return a PybelProcessor by processing a PyBEL graph.
Parameters
----------
graph : pybel.struct.BELGraph
A PyBEL graph to process
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
bp.sta... | Return a PybelProcessor by processing a PyBEL graph.
Parameters
----------
graph : pybel.struct.BELGraph
A PyBEL graph to process
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
bp.statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L167-L187 |
sorgerlab/indra | indra/sources/bel/api.py | process_belscript | def process_belscript(file_name, **kwargs):
"""Return a PybelProcessor by processing a BEL script file.
Key word arguments are passed directly to pybel.from_path,
for further information, see
pybel.readthedocs.io/en/latest/io.html#pybel.from_path
Some keyword arguments we use here differ from the d... | python | def process_belscript(file_name, **kwargs):
"""Return a PybelProcessor by processing a BEL script file.
Key word arguments are passed directly to pybel.from_path,
for further information, see
pybel.readthedocs.io/en/latest/io.html#pybel.from_path
Some keyword arguments we use here differ from the d... | Return a PybelProcessor by processing a BEL script file.
Key word arguments are passed directly to pybel.from_path,
for further information, see
pybel.readthedocs.io/en/latest/io.html#pybel.from_path
Some keyword arguments we use here differ from the defaults
of PyBEL, namely we set `citation_clear... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L190-L216 |
sorgerlab/indra | indra/sources/bel/api.py | process_json_file | def process_json_file(file_name):
"""Return a PybelProcessor by processing a Node-Link JSON file.
For more information on this format, see:
http://pybel.readthedocs.io/en/latest/io.html#node-link-json
Parameters
----------
file_name : str
The path to a Node-Link JSON file.
Returns... | python | def process_json_file(file_name):
"""Return a PybelProcessor by processing a Node-Link JSON file.
For more information on this format, see:
http://pybel.readthedocs.io/en/latest/io.html#node-link-json
Parameters
----------
file_name : str
The path to a Node-Link JSON file.
Returns... | Return a PybelProcessor by processing a Node-Link JSON file.
For more information on this format, see:
http://pybel.readthedocs.io/en/latest/io.html#node-link-json
Parameters
----------
file_name : str
The path to a Node-Link JSON file.
Returns
-------
bp : PybelProcessor
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L219-L238 |
sorgerlab/indra | indra/sources/bel/api.py | process_cbn_jgif_file | def process_cbn_jgif_file(file_name):
"""Return a PybelProcessor by processing a CBN JGIF JSON file.
Parameters
----------
file_name : str
The path to a CBN JGIF JSON file.
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
... | python | def process_cbn_jgif_file(file_name):
"""Return a PybelProcessor by processing a CBN JGIF JSON file.
Parameters
----------
file_name : str
The path to a CBN JGIF JSON file.
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
... | Return a PybelProcessor by processing a CBN JGIF JSON file.
Parameters
----------
file_name : str
The path to a CBN JGIF JSON file.
Returns
-------
bp : PybelProcessor
A PybelProcessor object which contains INDRA Statements in
bp.statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L241-L256 |
sorgerlab/indra | indra/resources/update_resources.py | update_famplex | def update_famplex():
"""Update all the CSV files that form the FamPlex resource."""
famplex_url_pattern = \
'https://raw.githubusercontent.com/sorgerlab/famplex/master/%s.csv'
csv_names = ['entities', 'equivalences', 'gene_prefixes',
'grounding_map', 'relations']
for csv_name i... | python | def update_famplex():
"""Update all the CSV files that form the FamPlex resource."""
famplex_url_pattern = \
'https://raw.githubusercontent.com/sorgerlab/famplex/master/%s.csv'
csv_names = ['entities', 'equivalences', 'gene_prefixes',
'grounding_map', 'relations']
for csv_name i... | Update all the CSV files that form the FamPlex resource. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/resources/update_resources.py#L421-L429 |
sorgerlab/indra | indra/resources/update_resources.py | update_lincs_small_molecules | def update_lincs_small_molecules():
"""Load the csv of LINCS small molecule metadata into a dict.
Produces a dict keyed by HMS LINCS small molecule ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv.
"""
url = 'http://lincs.hms.harvard.ed... | python | def update_lincs_small_molecules():
"""Load the csv of LINCS small molecule metadata into a dict.
Produces a dict keyed by HMS LINCS small molecule ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv.
"""
url = 'http://lincs.hms.harvard.ed... | Load the csv of LINCS small molecule metadata into a dict.
Produces a dict keyed by HMS LINCS small molecule ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/resources/update_resources.py#L439-L452 |
sorgerlab/indra | indra/resources/update_resources.py | update_lincs_proteins | def update_lincs_proteins():
"""Load the csv of LINCS protein metadata into a dict.
Produces a dict keyed by HMS LINCS protein ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv.
"""
url = 'http://lincs.hms.harvard.edu/db/proteins/'
p... | python | def update_lincs_proteins():
"""Load the csv of LINCS protein metadata into a dict.
Produces a dict keyed by HMS LINCS protein ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv.
"""
url = 'http://lincs.hms.harvard.edu/db/proteins/'
p... | Load the csv of LINCS protein metadata into a dict.
Produces a dict keyed by HMS LINCS protein ids, with the metadata
contained in a dict of row values keyed by the column headers extracted
from the csv. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/resources/update_resources.py#L455-L468 |
sorgerlab/indra | indra/assemblers/index_card/assembler.py | _get_is_direct | def _get_is_direct(stmt):
'''Returns true if there is evidence that the statement is a direct
interaction. If any of the evidences associated with the statement
indicates a direct interatcion then we assume the interaction
is direct. If there is no evidence for the interaction being indirect
then we... | python | def _get_is_direct(stmt):
'''Returns true if there is evidence that the statement is a direct
interaction. If any of the evidences associated with the statement
indicates a direct interatcion then we assume the interaction
is direct. If there is no evidence for the interaction being indirect
then we... | Returns true if there is evidence that the statement is a direct
interaction. If any of the evidences associated with the statement
indicates a direct interatcion then we assume the interaction
is direct. If there is no evidence for the interaction being indirect
then we default to direct. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/index_card/assembler.py#L418-L434 |
sorgerlab/indra | indra/assemblers/index_card/assembler.py | IndexCardAssembler.make_model | def make_model(self):
"""Assemble statements into index cards."""
for stmt in self.statements:
if isinstance(stmt, Modification):
card = assemble_modification(stmt)
elif isinstance(stmt, SelfModification):
card = assemble_selfmodification(stmt)
... | python | def make_model(self):
"""Assemble statements into index cards."""
for stmt in self.statements:
if isinstance(stmt, Modification):
card = assemble_modification(stmt)
elif isinstance(stmt, SelfModification):
card = assemble_selfmodification(stmt)
... | Assemble statements into index cards. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/index_card/assembler.py#L48-L71 |
sorgerlab/indra | indra/assemblers/index_card/assembler.py | IndexCardAssembler.print_model | def print_model(self):
"""Return the assembled cards as a JSON string.
Returns
-------
cards_json : str
The JSON string representing the assembled cards.
"""
cards = [c.card for c in self.cards]
# If there is only one card, print it as a single
... | python | def print_model(self):
"""Return the assembled cards as a JSON string.
Returns
-------
cards_json : str
The JSON string representing the assembled cards.
"""
cards = [c.card for c in self.cards]
# If there is only one card, print it as a single
... | Return the assembled cards as a JSON string.
Returns
-------
cards_json : str
The JSON string representing the assembled cards. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/index_card/assembler.py#L73-L87 |
sorgerlab/indra | indra/sources/geneways/processor.py | geneways_action_to_indra_statement_type | def geneways_action_to_indra_statement_type(actiontype, plo):
"""Return INDRA Statement corresponding to Geneways action type.
Parameters
----------
actiontype : str
The verb extracted by the Geneways processor
plo : str
A one character string designating whether Geneways classifies... | python | def geneways_action_to_indra_statement_type(actiontype, plo):
"""Return INDRA Statement corresponding to Geneways action type.
Parameters
----------
actiontype : str
The verb extracted by the Geneways processor
plo : str
A one character string designating whether Geneways classifies... | Return INDRA Statement corresponding to Geneways action type.
Parameters
----------
actiontype : str
The verb extracted by the Geneways processor
plo : str
A one character string designating whether Geneways classifies
this verb as a physical, logical, or other interaction
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/processor.py#L155-L189 |
sorgerlab/indra | indra/sources/geneways/processor.py | GenewaysProcessor.make_statement | def make_statement(self, action, mention):
"""Makes an INDRA statement from a Geneways action and action mention.
Parameters
----------
action : GenewaysAction
The mechanism that the Geneways mention maps to. Note that
several text mentions can correspond to the ... | python | def make_statement(self, action, mention):
"""Makes an INDRA statement from a Geneways action and action mention.
Parameters
----------
action : GenewaysAction
The mechanism that the Geneways mention maps to. Note that
several text mentions can correspond to the ... | Makes an INDRA statement from a Geneways action and action mention.
Parameters
----------
action : GenewaysAction
The mechanism that the Geneways mention maps to. Note that
several text mentions can correspond to the same action if they are
referring to the s... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/processor.py#L71-L139 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.load_from_rdf_file | def load_from_rdf_file(self, rdf_file):
"""Initialize given an RDF input file representing the hierarchy."
Parameters
----------
rdf_file : str
Path to an RDF file.
"""
self.graph = rdflib.Graph()
self.graph.parse(os.path.abspath(rdf_file), format='nt... | python | def load_from_rdf_file(self, rdf_file):
"""Initialize given an RDF input file representing the hierarchy."
Parameters
----------
rdf_file : str
Path to an RDF file.
"""
self.graph = rdflib.Graph()
self.graph.parse(os.path.abspath(rdf_file), format='nt... | Initialize given an RDF input file representing the hierarchy."
Parameters
----------
rdf_file : str
Path to an RDF file. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L62-L72 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.load_from_rdf_string | def load_from_rdf_string(self, rdf_str):
"""Initialize given an RDF string representing the hierarchy."
Parameters
----------
rdf_str : str
An RDF string.
"""
self.graph = rdflib.Graph()
self.graph.parse(data=rdf_str, format='nt')
self.initial... | python | def load_from_rdf_string(self, rdf_str):
"""Initialize given an RDF string representing the hierarchy."
Parameters
----------
rdf_str : str
An RDF string.
"""
self.graph = rdflib.Graph()
self.graph.parse(data=rdf_str, format='nt')
self.initial... | Initialize given an RDF string representing the hierarchy."
Parameters
----------
rdf_str : str
An RDF string. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L74-L84 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.extend_with | def extend_with(self, rdf_file):
"""Extend the RDF graph of this HierarchyManager with another RDF file.
Parameters
----------
rdf_file : str
An RDF file which is parsed such that the current graph and the
graph described by the file are merged.
"""
... | python | def extend_with(self, rdf_file):
"""Extend the RDF graph of this HierarchyManager with another RDF file.
Parameters
----------
rdf_file : str
An RDF file which is parsed such that the current graph and the
graph described by the file are merged.
"""
... | Extend the RDF graph of this HierarchyManager with another RDF file.
Parameters
----------
rdf_file : str
An RDF file which is parsed such that the current graph and the
graph described by the file are merged. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L116-L126 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.build_transitive_closures | def build_transitive_closures(self):
"""Build the transitive closures of the hierarchy.
This method constructs dictionaries which contain terms in the
hierarchy as keys and either all the "isa+" or "partof+" related terms
as values.
"""
self.component_counter = 0
... | python | def build_transitive_closures(self):
"""Build the transitive closures of the hierarchy.
This method constructs dictionaries which contain terms in the
hierarchy as keys and either all the "isa+" or "partof+" related terms
as values.
"""
self.component_counter = 0
... | Build the transitive closures of the hierarchy.
This method constructs dictionaries which contain terms in the
hierarchy as keys and either all the "isa+" or "partof+" related terms
as values. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L128-L140 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.build_transitive_closure | def build_transitive_closure(self, rel, tc_dict):
"""Build a transitive closure for a given relation in a given dict."""
# Make a function with the righ argument structure
rel_fun = lambda node, graph: rel(node)
for x in self.graph.all_nodes():
rel_closure = self.graph.transi... | python | def build_transitive_closure(self, rel, tc_dict):
"""Build a transitive closure for a given relation in a given dict."""
# Make a function with the righ argument structure
rel_fun = lambda node, graph: rel(node)
for x in self.graph.all_nodes():
rel_closure = self.graph.transi... | Build a transitive closure for a given relation in a given dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L142-L158 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.find_entity | def find_entity(self, x):
"""
Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity.
"""
qstr = self.prefixes + """
SELECT ?x WHERE {{
?x rn:hasName... | python | def find_entity(self, x):
"""
Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity.
"""
qstr = self.prefixes + """
SELECT ?x WHERE {{
?x rn:hasName... | Get the entity that has the specified name (or synonym).
Parameters
----------
x : string
Name or synonym for the target entity. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L194-L214 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.directly_or_indirectly_related | def directly_or_indirectly_related(self, ns1, id1, ns2, id2, closure_dict,
relation_func):
"""Return True if two entities have the speicified relationship.
This relation is constructed possibly through multiple links connecting
the two entities directly or... | python | def directly_or_indirectly_related(self, ns1, id1, ns2, id2, closure_dict,
relation_func):
"""Return True if two entities have the speicified relationship.
This relation is constructed possibly through multiple links connecting
the two entities directly or... | Return True if two entities have the speicified relationship.
This relation is constructed possibly through multiple links connecting
the two entities directly or indirectly.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L240-L304 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.isa | def isa(self, ns1, id1, ns2, id2):
"""Return True if one entity has an "isa" relationship to another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : string
URI for an entity.
ns2 : str
Namespace code for an entity.... | python | def isa(self, ns1, id1, ns2, id2):
"""Return True if one entity has an "isa" relationship to another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : string
URI for an entity.
ns2 : str
Namespace code for an entity.... | Return True if one entity has an "isa" relationship to another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : string
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : str
URI for an enti... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L306-L329 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.partof | def partof(self, ns1, id1, ns2, id2):
"""Return True if one entity is "partof" another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : st... | python | def partof(self, ns1, id1, ns2, id2):
"""Return True if one entity is "partof" another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : st... | Return True if one entity is "partof" another.
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : str
URI for an entity.
Returns... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L331-L354 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.isa_or_partof | def isa_or_partof(self, ns1, id1, ns2, id2):
"""Return True if two entities are in an "isa" or "partof" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code fo... | python | def isa_or_partof(self, ns1, id1, ns2, id2):
"""Return True if two entities are in an "isa" or "partof" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code fo... | Return True if two entities are in an "isa" or "partof" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : str
URI for an en... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L356-L379 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.is_opposite | def is_opposite(self, ns1, id1, ns2, id2):
"""Return True if two entities are in an "is_opposite" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an e... | python | def is_opposite(self, ns1, id1, ns2, id2):
"""Return True if two entities are in an "is_opposite" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an e... | Return True if two entities are in an "is_opposite" relationship
Parameters
----------
ns1 : str
Namespace code for an entity.
id1 : str
URI for an entity.
ns2 : str
Namespace code for an entity.
id2 : str
URI for an entity... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L381-L409 |
sorgerlab/indra | indra/preassembler/hierarchy_manager.py | HierarchyManager.get_parents | def get_parents(self, uri, type='all'):
"""Return parents of a given entry.
Parameters
----------
uri : str
The URI of the entry whose parents are to be returned. See the
get_uri method to construct this URI from a name space and id.
type : str
... | python | def get_parents(self, uri, type='all'):
"""Return parents of a given entry.
Parameters
----------
uri : str
The URI of the entry whose parents are to be returned. See the
get_uri method to construct this URI from a name space and id.
type : str
... | Return parents of a given entry.
Parameters
----------
uri : str
The URI of the entry whose parents are to be returned. See the
get_uri method to construct this URI from a name space and id.
type : str
'all': return all parents irrespective of level;
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/hierarchy_manager.py#L411-L439 |
sorgerlab/indra | indra/sources/trips/drum_reader.py | _get_perf | def _get_perf(text, msg_id):
"""Return a request message for a given text."""
msg = KQMLPerformative('REQUEST')
msg.set('receiver', 'READER')
content = KQMLList('run-text')
content.sets('text', text)
msg.set('content', content)
msg.set('reply-with', msg_id)
return msg | python | def _get_perf(text, msg_id):
"""Return a request message for a given text."""
msg = KQMLPerformative('REQUEST')
msg.set('receiver', 'READER')
content = KQMLList('run-text')
content.sets('text', text)
msg.set('content', content)
msg.set('reply-with', msg_id)
return msg | Return a request message for a given text. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/drum_reader.py#L156-L164 |
sorgerlab/indra | indra/sources/trips/drum_reader.py | DrumReader.read_pmc | def read_pmc(self, pmcid):
"""Read a given PMC article.
Parameters
----------
pmcid : str
The PMC ID of the article to read. Note that only
articles in the open-access subset of PMC will work.
"""
msg = KQMLPerformative('REQUEST')
msg.set(... | python | def read_pmc(self, pmcid):
"""Read a given PMC article.
Parameters
----------
pmcid : str
The PMC ID of the article to read. Note that only
articles in the open-access subset of PMC will work.
"""
msg = KQMLPerformative('REQUEST')
msg.set(... | Read a given PMC article.
Parameters
----------
pmcid : str
The PMC ID of the article to read. Note that only
articles in the open-access subset of PMC will work. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/drum_reader.py#L87-L104 |
sorgerlab/indra | indra/sources/trips/drum_reader.py | DrumReader.read_text | def read_text(self, text):
"""Read a given text phrase.
Parameters
----------
text : str
The text to read. Typically a sentence or a paragraph.
"""
logger.info('Reading: "%s"' % text)
msg_id = 'RT000%s' % self.msg_counter
kqml_perf = _get_perf... | python | def read_text(self, text):
"""Read a given text phrase.
Parameters
----------
text : str
The text to read. Typically a sentence or a paragraph.
"""
logger.info('Reading: "%s"' % text)
msg_id = 'RT000%s' % self.msg_counter
kqml_perf = _get_perf... | Read a given text phrase.
Parameters
----------
text : str
The text to read. Typically a sentence or a paragraph. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/drum_reader.py#L106-L119 |
sorgerlab/indra | indra/sources/trips/drum_reader.py | DrumReader.receive_reply | def receive_reply(self, msg, content):
"""Handle replies with reading results."""
reply_head = content.head()
if reply_head == 'error':
comment = content.gets('comment')
logger.error('Got error reply: "%s"' % comment)
else:
extractions = content.gets('... | python | def receive_reply(self, msg, content):
"""Handle replies with reading results."""
reply_head = content.head()
if reply_head == 'error':
comment = content.gets('comment')
logger.error('Got error reply: "%s"' % comment)
else:
extractions = content.gets('... | Handle replies with reading results. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/drum_reader.py#L121-L132 |
sorgerlab/indra | indra/sources/hume/visualize_causal.py | split_long_sentence | def split_long_sentence(sentence, words_per_line):
"""Takes a sentence and adds a newline every "words_per_line" words.
Parameters
----------
sentence: str
Sentene to split
words_per_line: double
Add a newline every this many words
"""
words = sentence.split(' ')
split_s... | python | def split_long_sentence(sentence, words_per_line):
"""Takes a sentence and adds a newline every "words_per_line" words.
Parameters
----------
sentence: str
Sentene to split
words_per_line: double
Add a newline every this many words
"""
words = sentence.split(' ')
split_s... | Takes a sentence and adds a newline every "words_per_line" words.
Parameters
----------
sentence: str
Sentene to split
words_per_line: double
Add a newline every this many words | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hume/visualize_causal.py#L7-L25 |
sorgerlab/indra | indra/sources/hume/visualize_causal.py | shorter_name | def shorter_name(key):
"""Return a shorter name for an id.
Does this by only taking the last part of the URI,
after the last / and the last #. Also replaces - and . with _.
Parameters
----------
key: str
Some URI
Returns
-------
key_short: str
A shortened, but more... | python | def shorter_name(key):
"""Return a shorter name for an id.
Does this by only taking the last part of the URI,
after the last / and the last #. Also replaces - and . with _.
Parameters
----------
key: str
Some URI
Returns
-------
key_short: str
A shortened, but more... | Return a shorter name for an id.
Does this by only taking the last part of the URI,
after the last / and the last #. Also replaces - and . with _.
Parameters
----------
key: str
Some URI
Returns
-------
key_short: str
A shortened, but more ambiguous, identifier | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hume/visualize_causal.py#L28-L51 |
sorgerlab/indra | indra/sources/hume/visualize_causal.py | add_event_property_edges | def add_event_property_edges(event_entity, entries):
"""Adds edges to the graph for event properties."""
do_not_log = ['@type', '@id',
'http://worldmodelers.com/DataProvenance#sourced_from']
for prop in event_entity:
if prop not in do_not_log:
value = event_entity[prop]
... | python | def add_event_property_edges(event_entity, entries):
"""Adds edges to the graph for event properties."""
do_not_log = ['@type', '@id',
'http://worldmodelers.com/DataProvenance#sourced_from']
for prop in event_entity:
if prop not in do_not_log:
value = event_entity[prop]
... | Adds edges to the graph for event properties. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hume/visualize_causal.py#L54-L76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.