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/submit_reading_pipeline.py
submit_reading
def submit_reading(basename, pmid_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, project_name=None): """Submit an old-style pmid-centered no-database s3 only reading job. This function is provide...
python
def submit_reading(basename, pmid_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, project_name=None): """Submit an old-style pmid-centered no-database s3 only reading job. This function is provide...
Submit an old-style pmid-centered no-database s3 only reading job. This function is provided for the sake of backward compatibility. It is preferred that you use the object-oriented PmidSubmitter and the submit_reading job going forward.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L555-L568
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
submit_combine
def submit_combine(basename, readers, job_ids=None, project_name=None): """Submit a batch job to combine the outputs of a reading job. This function is provided for backwards compatibility. You should use the PmidSubmitter and submit_combine methods. """ sub = PmidSubmitter(basename, readers, proje...
python
def submit_combine(basename, readers, job_ids=None, project_name=None): """Submit a batch job to combine the outputs of a reading job. This function is provided for backwards compatibility. You should use the PmidSubmitter and submit_combine methods. """ sub = PmidSubmitter(basename, readers, proje...
Submit a batch job to combine the outputs of a reading job. This function is provided for backwards compatibility. You should use the PmidSubmitter and submit_combine methods.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L571-L580
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
create_read_parser
def create_read_parser(): import argparse parent_read_parser = argparse.ArgumentParser(add_help=False) parent_read_parser.add_argument( 'input_file', help=('Path to file containing input ids of content to read. For the ' 'no-db options, this is simply a file with each line bein...
python
def create_read_parser(): import argparse parent_read_parser = argparse.ArgumentParser(add_help=False) parent_read_parser.add_argument( 'input_file', help=('Path to file containing input ids of content to read. For the ' 'no-db options, this is simply a file with each line bein...
Not currently supported. parent_read_parser.add_argument( '--num_tries', default=2, type=int, help='Maximum number of times to try running job.' )
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L606-L650
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
Submitter.submit_reading
def submit_reading(self, input_fname, start_ix, end_ix, ids_per_job, num_tries=1, stagger=0): """Submit a batch of reading jobs Parameters ---------- input_fname : str The name of the file containing the ids to be read. start_ix : int ...
python
def submit_reading(self, input_fname, start_ix, end_ix, ids_per_job, num_tries=1, stagger=0): """Submit a batch of reading jobs Parameters ---------- input_fname : str The name of the file containing the ids to be read. start_ix : int ...
Submit a batch of reading jobs Parameters ---------- input_fname : str The name of the file containing the ids to be read. start_ix : int The line index of the first item in the list to read. end_ix : int The line index of the last item in the...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L397-L466
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
Submitter.watch_and_wait
def watch_and_wait(self, poll_interval=10, idle_log_timeout=None, kill_on_timeout=False, stash_log_method=None, tag_instances=False, **kwargs): """This provides shortcut access to the wait_for_complete_function.""" return wait_for_complete(self._job_queue, j...
python
def watch_and_wait(self, poll_interval=10, idle_log_timeout=None, kill_on_timeout=False, stash_log_method=None, tag_instances=False, **kwargs): """This provides shortcut access to the wait_for_complete_function.""" return wait_for_complete(self._job_queue, j...
This provides shortcut access to the wait_for_complete_function.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L468-L478
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
Submitter.run
def run(self, input_fname, ids_per_job, stagger=0, **wait_params): """Run this submission all the way. This method will run both `submit_reading` and `watch_and_wait`, blocking on the latter. """ submit_thread = Thread(target=self.submit_reading, a...
python
def run(self, input_fname, ids_per_job, stagger=0, **wait_params): """Run this submission all the way. This method will run both `submit_reading` and `watch_and_wait`, blocking on the latter. """ submit_thread = Thread(target=self.submit_reading, a...
Run this submission all the way. This method will run both `submit_reading` and `watch_and_wait`, blocking on the latter.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L480-L496
sorgerlab/indra
indra/tools/reading/submit_reading_pipeline.py
PmidSubmitter.set_options
def set_options(self, force_read=False, force_fulltext=False): """Set the options for this run.""" self.options['force_read'] = force_read self.options['force_fulltext'] = force_fulltext return
python
def set_options(self, force_read=False, force_fulltext=False): """Set the options for this run.""" self.options['force_read'] = force_read self.options['force_fulltext'] = force_fulltext return
Set the options for this run.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/submit_reading_pipeline.py#L517-L521
sorgerlab/indra
indra/databases/chebi_client.py
get_chebi_name_from_id
def get_chebi_name_from_id(chebi_id, offline=False): """Return a ChEBI name corresponding to the given ChEBI ID. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. offline : Optional[bool] Choose whether to allow an online lookup if the local lookup fail...
python
def get_chebi_name_from_id(chebi_id, offline=False): """Return a ChEBI name corresponding to the given ChEBI ID. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. offline : Optional[bool] Choose whether to allow an online lookup if the local lookup fail...
Return a ChEBI name corresponding to the given ChEBI ID. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. offline : Optional[bool] Choose whether to allow an online lookup if the local lookup fails. If True, the online lookup is not attempted. Defa...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chebi_client.py#L86-L106
sorgerlab/indra
indra/databases/chebi_client.py
get_chebi_name_from_id_web
def get_chebi_name_from_id_web(chebi_id): """Return a ChEBI mame corresponding to a given ChEBI ID using a REST API. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. Returns ------- chebi_name : str The name corresponding to the given ChEBI ID...
python
def get_chebi_name_from_id_web(chebi_id): """Return a ChEBI mame corresponding to a given ChEBI ID using a REST API. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. Returns ------- chebi_name : str The name corresponding to the given ChEBI ID...
Return a ChEBI mame corresponding to a given ChEBI ID using a REST API. Parameters ---------- chebi_id : str The ChEBI ID whose name is to be returned. Returns ------- chebi_name : str The name corresponding to the given ChEBI ID. If the lookup fails, None is returned.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/chebi_client.py#L179-L214
sorgerlab/indra
indra/tools/executable_subnetwork.py
get_subnetwork
def get_subnetwork(statements, nodes, relevance_network=None, relevance_node_lim=10): """Return a PySB model based on a subset of given INDRA Statements. Statements are first filtered for nodes in the given list and other nodes are optionally added based on relevance in a given network. ...
python
def get_subnetwork(statements, nodes, relevance_network=None, relevance_node_lim=10): """Return a PySB model based on a subset of given INDRA Statements. Statements are first filtered for nodes in the given list and other nodes are optionally added based on relevance in a given network. ...
Return a PySB model based on a subset of given INDRA Statements. Statements are first filtered for nodes in the given list and other nodes are optionally added based on relevance in a given network. The filtered statements are then assembled into an executable model using INDRA's PySB Assembler. P...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/executable_subnetwork.py#L7-L45
sorgerlab/indra
indra/tools/executable_subnetwork.py
_filter_statements
def _filter_statements(statements, agents): """Return INDRA Statements which have Agents in the given list. Only statements are returned in which all appearing Agents as in the agents list. Parameters ---------- statements : list[indra.statements.Statement] A list of INDRA Statements t...
python
def _filter_statements(statements, agents): """Return INDRA Statements which have Agents in the given list. Only statements are returned in which all appearing Agents as in the agents list. Parameters ---------- statements : list[indra.statements.Statement] A list of INDRA Statements t...
Return INDRA Statements which have Agents in the given list. Only statements are returned in which all appearing Agents as in the agents list. Parameters ---------- statements : list[indra.statements.Statement] A list of INDRA Statements to filter. agents : list[str] A list of ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/executable_subnetwork.py#L47-L70
sorgerlab/indra
indra/tools/executable_subnetwork.py
_find_relevant_nodes
def _find_relevant_nodes(query_nodes, relevance_network, relevance_node_lim): """Return a list of nodes that are relevant for the query. Parameters ---------- query_nodes : list[str] A list of node names to query for. relevance_network : str The UUID of the NDEx network to query rel...
python
def _find_relevant_nodes(query_nodes, relevance_network, relevance_node_lim): """Return a list of nodes that are relevant for the query. Parameters ---------- query_nodes : list[str] A list of node names to query for. relevance_network : str The UUID of the NDEx network to query rel...
Return a list of nodes that are relevant for the query. Parameters ---------- query_nodes : list[str] A list of node names to query for. relevance_network : str The UUID of the NDEx network to query relevance in. relevance_node_lim : int The number of top relevant nodes to r...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/executable_subnetwork.py#L72-L92
sorgerlab/indra
indra/sources/hume/api.py
process_jsonld_file
def process_jsonld_file(fname): """Process a JSON-LD file in the new format to extract Statements. Parameters ---------- fname : str The path to the JSON-LD file to be processed. Returns ------- indra.sources.hume.HumeProcessor A HumeProcessor instance, which contains a lis...
python
def process_jsonld_file(fname): """Process a JSON-LD file in the new format to extract Statements. Parameters ---------- fname : str The path to the JSON-LD file to be processed. Returns ------- indra.sources.hume.HumeProcessor A HumeProcessor instance, which contains a lis...
Process a JSON-LD file in the new format to extract Statements. Parameters ---------- fname : str The path to the JSON-LD file to be processed. Returns ------- indra.sources.hume.HumeProcessor A HumeProcessor instance, which contains a list of INDRA Statements as its st...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hume/api.py#L10-L26
sorgerlab/indra
indra/util/aws.py
kill_all
def kill_all(job_queue, reason='None given', states=None): """Terminates/cancels all RUNNING, RUNNABLE, and STARTING jobs.""" if states is None: states = ['STARTING', 'RUNNABLE', 'RUNNING'] batch = boto3.client('batch') runnable = batch.list_jobs(jobQueue=job_queue, jobStatus='RUNNABLE') job...
python
def kill_all(job_queue, reason='None given', states=None): """Terminates/cancels all RUNNING, RUNNABLE, and STARTING jobs.""" if states is None: states = ['STARTING', 'RUNNABLE', 'RUNNING'] batch = boto3.client('batch') runnable = batch.list_jobs(jobQueue=job_queue, jobStatus='RUNNABLE') job...
Terminates/cancels all RUNNING, RUNNABLE, and STARTING jobs.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L11-L33
sorgerlab/indra
indra/util/aws.py
tag_instance
def tag_instance(instance_id, **tags): """Tag a single ec2 instance.""" logger.debug("Got request to add tags %s to instance %s." % (str(tags), instance_id)) ec2 = boto3.resource('ec2') instance = ec2.Instance(instance_id) # Remove None's from `tags` filtered_tags = {k: v for k...
python
def tag_instance(instance_id, **tags): """Tag a single ec2 instance.""" logger.debug("Got request to add tags %s to instance %s." % (str(tags), instance_id)) ec2 = boto3.resource('ec2') instance = ec2.Instance(instance_id) # Remove None's from `tags` filtered_tags = {k: v for k...
Tag a single ec2 instance.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L36-L62
sorgerlab/indra
indra/util/aws.py
tag_myself
def tag_myself(project='cwc', **other_tags): """Function run when indra is used in an EC2 instance to apply tags.""" base_url = "http://169.254.169.254" try: resp = requests.get(base_url + "/latest/meta-data/instance-id") except requests.exceptions.ConnectionError: logger.warning("Could ...
python
def tag_myself(project='cwc', **other_tags): """Function run when indra is used in an EC2 instance to apply tags.""" base_url = "http://169.254.169.254" try: resp = requests.get(base_url + "/latest/meta-data/instance-id") except requests.exceptions.ConnectionError: logger.warning("Could ...
Function run when indra is used in an EC2 instance to apply tags.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L65-L76
sorgerlab/indra
indra/util/aws.py
get_batch_command
def get_batch_command(command_list, project=None, purpose=None): """Get the command appropriate for running something on batch.""" command_str = ' '.join(command_list) ret = ['python', '-m', 'indra.util.aws', 'run_in_batch', command_str] if not project and has_config('DEFAULT_AWS_PROJECT'): proj...
python
def get_batch_command(command_list, project=None, purpose=None): """Get the command appropriate for running something on batch.""" command_str = ' '.join(command_list) ret = ['python', '-m', 'indra.util.aws', 'run_in_batch', command_str] if not project and has_config('DEFAULT_AWS_PROJECT'): proj...
Get the command appropriate for running something on batch.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L79-L89
sorgerlab/indra
indra/util/aws.py
get_jobs
def get_jobs(job_queue='run_reach_queue', job_status='RUNNING'): """Returns a list of dicts with jobName and jobId for each job with the given status.""" batch = boto3.client('batch') jobs = batch.list_jobs(jobQueue=job_queue, jobStatus=job_status) return jobs.get('jobSummaryList')
python
def get_jobs(job_queue='run_reach_queue', job_status='RUNNING'): """Returns a list of dicts with jobName and jobId for each job with the given status.""" batch = boto3.client('batch') jobs = batch.list_jobs(jobQueue=job_queue, jobStatus=job_status) return jobs.get('jobSummaryList')
Returns a list of dicts with jobName and jobId for each job with the given status.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L101-L106
sorgerlab/indra
indra/util/aws.py
get_job_log
def get_job_log(job_info, log_group_name='/aws/batch/job', write_file=True, verbose=False): """Gets the Cloudwatch log associated with the given job. Parameters ---------- job_info : dict dict containing entries for 'jobName' and 'jobId', e.g., as returned by get_jobs() ...
python
def get_job_log(job_info, log_group_name='/aws/batch/job', write_file=True, verbose=False): """Gets the Cloudwatch log associated with the given job. Parameters ---------- job_info : dict dict containing entries for 'jobName' and 'jobId', e.g., as returned by get_jobs() ...
Gets the Cloudwatch log associated with the given job. Parameters ---------- job_info : dict dict containing entries for 'jobName' and 'jobId', e.g., as returned by get_jobs() log_group_name : string Name of the log group; defaults to '/aws/batch/job' write_file : boolean ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L109-L153
sorgerlab/indra
indra/util/aws.py
get_log_by_name
def get_log_by_name(log_group_name, log_stream_name, out_file=None, verbose=True): """Download a log given the log's group and stream name. Parameters ---------- log_group_name : str The name of the log group, e.g. /aws/batch/job. log_stream_name : str The name ...
python
def get_log_by_name(log_group_name, log_stream_name, out_file=None, verbose=True): """Download a log given the log's group and stream name. Parameters ---------- log_group_name : str The name of the log group, e.g. /aws/batch/job. log_stream_name : str The name ...
Download a log given the log's group and stream name. Parameters ---------- log_group_name : str The name of the log group, e.g. /aws/batch/job. log_stream_name : str The name of the log stream, e.g. run_reach_jobdef/default/<UUID> Returns ------- lines : list[str] ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L156-L196
sorgerlab/indra
indra/util/aws.py
dump_logs
def dump_logs(job_queue='run_reach_queue', job_status='RUNNING'): """Write logs for all jobs with given the status to files.""" jobs = get_jobs(job_queue, job_status) for job in jobs: get_job_log(job, write_file=True)
python
def dump_logs(job_queue='run_reach_queue', job_status='RUNNING'): """Write logs for all jobs with given the status to files.""" jobs = get_jobs(job_queue, job_status) for job in jobs: get_job_log(job, write_file=True)
Write logs for all jobs with given the status to files.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L199-L203
sorgerlab/indra
indra/util/aws.py
get_s3_file_tree
def get_s3_file_tree(s3, bucket, prefix): """Overcome s3 response limit and return NestedDict tree of paths. The NestedDict object also allows the user to search by the ends of a path. The tree mimics a file directory structure, with the leave nodes being the full unbroken key. For example, 'path/to/f...
python
def get_s3_file_tree(s3, bucket, prefix): """Overcome s3 response limit and return NestedDict tree of paths. The NestedDict object also allows the user to search by the ends of a path. The tree mimics a file directory structure, with the leave nodes being the full unbroken key. For example, 'path/to/f...
Overcome s3 response limit and return NestedDict tree of paths. The NestedDict object also allows the user to search by the ends of a path. The tree mimics a file directory structure, with the leave nodes being the full unbroken key. For example, 'path/to/file.txt' would be retrieved by ret['path...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/aws.py#L206-L248
sorgerlab/indra
indra/assemblers/sif/assembler.py
SifAssembler.make_model
def make_model(self, use_name_as_key=False, include_mods=False, include_complexes=False): """Assemble the graph from the assembler's list of INDRA Statements. Parameters ---------- use_name_as_key : boolean If True, uses the name of the agent as the key to...
python
def make_model(self, use_name_as_key=False, include_mods=False, include_complexes=False): """Assemble the graph from the assembler's list of INDRA Statements. Parameters ---------- use_name_as_key : boolean If True, uses the name of the agent as the key to...
Assemble the graph from the assembler's list of INDRA Statements. Parameters ---------- use_name_as_key : boolean If True, uses the name of the agent as the key to the nodes in the network. If False (default) uses the matches_key() of the agent. inclu...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/sif/assembler.py#L38-L81
sorgerlab/indra
indra/assemblers/sif/assembler.py
SifAssembler.print_model
def print_model(self, include_unsigned_edges=False): """Return a SIF string of the assembled model. Parameters ---------- include_unsigned_edges : bool If True, includes edges with an unknown activating/inactivating relationship (e.g., most PTMs). Default is Fals...
python
def print_model(self, include_unsigned_edges=False): """Return a SIF string of the assembled model. Parameters ---------- include_unsigned_edges : bool If True, includes edges with an unknown activating/inactivating relationship (e.g., most PTMs). Default is Fals...
Return a SIF string of the assembled model. Parameters ---------- include_unsigned_edges : bool If True, includes edges with an unknown activating/inactivating relationship (e.g., most PTMs). Default is False.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/sif/assembler.py#L98-L122
sorgerlab/indra
indra/assemblers/sif/assembler.py
SifAssembler.save_model
def save_model(self, fname, include_unsigned_edges=False): """Save the assembled model's SIF string into a file. Parameters ---------- fname : str The name of the file to save the SIF into. include_unsigned_edges : bool If True, includes edges with an unk...
python
def save_model(self, fname, include_unsigned_edges=False): """Save the assembled model's SIF string into a file. Parameters ---------- fname : str The name of the file to save the SIF into. include_unsigned_edges : bool If True, includes edges with an unk...
Save the assembled model's SIF string into a file. Parameters ---------- fname : str The name of the file to save the SIF into. include_unsigned_edges : bool If True, includes edges with an unknown activating/inactivating relationship (e.g., most PTMs...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/sif/assembler.py#L124-L137
sorgerlab/indra
indra/assemblers/sif/assembler.py
SifAssembler.print_loopy
def print_loopy(self, as_url=True): """Return Parameters ---------- out_file : Optional[str] A file name in which the Loopy network is saved. Returns ------- full_str : str The string representing the Loopy network. """ i...
python
def print_loopy(self, as_url=True): """Return Parameters ---------- out_file : Optional[str] A file name in which the Loopy network is saved. Returns ------- full_str : str The string representing the Loopy network. """ i...
Return Parameters ---------- out_file : Optional[str] A file name in which the Loopy network is saved. Returns ------- full_str : str The string representing the Loopy network.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/sif/assembler.py#L139-L181
sorgerlab/indra
indra/assemblers/sif/assembler.py
SifAssembler.print_boolean_net
def print_boolean_net(self, out_file=None): """Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str] A file n...
python
def print_boolean_net(self, out_file=None): """Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str] A file n...
Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str] A file name in which the Boolean network is saved. Ret...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/sif/assembler.py#L183-L242
sorgerlab/indra
indra/literature/elsevier_client.py
_ensure_api_keys
def _ensure_api_keys(task_desc, failure_ret=None): """Wrap Elsevier methods which directly use the API keys. Ensure that the keys are retrieved from the environment or config file when first called, and store global scope. Subsequently use globally stashed results and check for required ids. """ ...
python
def _ensure_api_keys(task_desc, failure_ret=None): """Wrap Elsevier methods which directly use the API keys. Ensure that the keys are retrieved from the environment or config file when first called, and store global scope. Subsequently use globally stashed results and check for required ids. """ ...
Wrap Elsevier methods which directly use the API keys. Ensure that the keys are retrieved from the environment or config file when first called, and store global scope. Subsequently use globally stashed results and check for required ids.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L51-L85
sorgerlab/indra
indra/literature/elsevier_client.py
check_entitlement
def check_entitlement(doi): """Check whether IP and credentials enable access to content for a doi. This function uses the entitlement endpoint of the Elsevier API to check whether an article is available to a given institution. Note that this feature of the API is itself not available for all institut...
python
def check_entitlement(doi): """Check whether IP and credentials enable access to content for a doi. This function uses the entitlement endpoint of the Elsevier API to check whether an article is available to a given institution. Note that this feature of the API is itself not available for all institut...
Check whether IP and credentials enable access to content for a doi. This function uses the entitlement endpoint of the Elsevier API to check whether an article is available to a given institution. Note that this feature of the API is itself not available for all institution keys.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L89-L106
sorgerlab/indra
indra/literature/elsevier_client.py
download_article
def download_article(id_val, id_type='doi', on_retry=False): """Low level function to get an XML article for a particular id. Parameters ---------- id_val : str The value of the id. id_type : str The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid. on_retry : bool ...
python
def download_article(id_val, id_type='doi', on_retry=False): """Low level function to get an XML article for a particular id. Parameters ---------- id_val : str The value of the id. id_type : str The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid. on_retry : bool ...
Low level function to get an XML article for a particular id. Parameters ---------- id_val : str The value of the id. id_type : str The type of id, such as pmid (a.k.a. pubmed_id), doi, or eid. on_retry : bool This function has a recursive retry feature, and this is the only...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L110-L158
sorgerlab/indra
indra/literature/elsevier_client.py
download_article_from_ids
def download_article_from_ids(**id_dict): """Download an article in XML format from Elsevier matching the set of ids. Parameters ---------- <id_type> : str You can enter any combination of eid, doi, pmid, and/or pii. Ids will be checked in that order, until either content has been found...
python
def download_article_from_ids(**id_dict): """Download an article in XML format from Elsevier matching the set of ids. Parameters ---------- <id_type> : str You can enter any combination of eid, doi, pmid, and/or pii. Ids will be checked in that order, until either content has been found...
Download an article in XML format from Elsevier matching the set of ids. Parameters ---------- <id_type> : str You can enter any combination of eid, doi, pmid, and/or pii. Ids will be checked in that order, until either content has been found or all ids have been checked. Retur...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L161-L192
sorgerlab/indra
indra/literature/elsevier_client.py
get_abstract
def get_abstract(doi): """Get the abstract text of an article from Elsevier given a doi.""" xml_string = download_article(doi) if xml_string is None: return None assert isinstance(xml_string, str) xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB()) if xml_tree is None: re...
python
def get_abstract(doi): """Get the abstract text of an article from Elsevier given a doi.""" xml_string = download_article(doi) if xml_string is None: return None assert isinstance(xml_string, str) xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB()) if xml_tree is None: re...
Get the abstract text of an article from Elsevier given a doi.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L195-L207
sorgerlab/indra
indra/literature/elsevier_client.py
get_article
def get_article(doi, output_format='txt'): """Get the full body of an article from Elsevier. Parameters ---------- doi : str The doi for the desired article. output_format : 'txt' or 'xml' The desired format for the output. Selecting 'txt' (default) strips all xml tags and j...
python
def get_article(doi, output_format='txt'): """Get the full body of an article from Elsevier. Parameters ---------- doi : str The doi for the desired article. output_format : 'txt' or 'xml' The desired format for the output. Selecting 'txt' (default) strips all xml tags and j...
Get the full body of an article from Elsevier. Parameters ---------- doi : str The doi for the desired article. output_format : 'txt' or 'xml' The desired format for the output. Selecting 'txt' (default) strips all xml tags and joins the pieces of text in the main text, while 'x...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L210-L233
sorgerlab/indra
indra/literature/elsevier_client.py
extract_paragraphs
def extract_paragraphs(xml_string): """Get paragraphs from the body of the given Elsevier xml.""" assert isinstance(xml_string, str) xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB()) full_text = xml_tree.find('article:originalText', elsevier_ns) if full_text is None: logger.info('C...
python
def extract_paragraphs(xml_string): """Get paragraphs from the body of the given Elsevier xml.""" assert isinstance(xml_string, str) xml_tree = ET.XML(xml_string.encode('utf-8'), parser=UTB()) full_text = xml_tree.find('article:originalText', elsevier_ns) if full_text is None: logger.info('C...
Get paragraphs from the body of the given Elsevier xml.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L245-L259
sorgerlab/indra
indra/literature/elsevier_client.py
get_dois
def get_dois(query_str, count=100): """Search ScienceDirect through the API for articles. See http://api.elsevier.com/content/search/fields/scidir for constructing a query string to pass here. Example: 'abstract(BRAF) AND all("colorectal cancer")' """ url = '%s/%s' % (elsevier_search_url, quer...
python
def get_dois(query_str, count=100): """Search ScienceDirect through the API for articles. See http://api.elsevier.com/content/search/fields/scidir for constructing a query string to pass here. Example: 'abstract(BRAF) AND all("colorectal cancer")' """ url = '%s/%s' % (elsevier_search_url, quer...
Search ScienceDirect through the API for articles. See http://api.elsevier.com/content/search/fields/scidir for constructing a query string to pass here. Example: 'abstract(BRAF) AND all("colorectal cancer")'
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L264-L283
sorgerlab/indra
indra/literature/elsevier_client.py
get_piis
def get_piis(query_str): """Search ScienceDirect through the API for articles and return PIIs. Note that ScienceDirect has a limitation in which a maximum of 6,000 PIIs can be retrieved for a given search and therefore this call is internally broken up into multiple queries by a range of years and the ...
python
def get_piis(query_str): """Search ScienceDirect through the API for articles and return PIIs. Note that ScienceDirect has a limitation in which a maximum of 6,000 PIIs can be retrieved for a given search and therefore this call is internally broken up into multiple queries by a range of years and the ...
Search ScienceDirect through the API for articles and return PIIs. Note that ScienceDirect has a limitation in which a maximum of 6,000 PIIs can be retrieved for a given search and therefore this call is internally broken up into multiple queries by a range of years and the results are combined. P...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L286-L306
sorgerlab/indra
indra/literature/elsevier_client.py
get_piis_for_date
def get_piis_for_date(query_str, date): """Search ScienceDirect with a query string constrained to a given year. Parameters ---------- query_str : str The query string to search with date : str The year to constrain the search to Returns ------- piis : list[str] ...
python
def get_piis_for_date(query_str, date): """Search ScienceDirect with a query string constrained to a given year. Parameters ---------- query_str : str The query string to search with date : str The year to constrain the search to Returns ------- piis : list[str] ...
Search ScienceDirect with a query string constrained to a given year. Parameters ---------- query_str : str The query string to search with date : str The year to constrain the search to Returns ------- piis : list[str] The list of PIIs identifying the papers return...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L311-L358
sorgerlab/indra
indra/literature/elsevier_client.py
download_from_search
def download_from_search(query_str, folder, do_extract_text=True, max_results=None): """Save raw text files based on a search for papers on ScienceDirect. This performs a search to get PIIs, downloads the XML corresponding to the PII, extracts the raw text and then saves the text i...
python
def download_from_search(query_str, folder, do_extract_text=True, max_results=None): """Save raw text files based on a search for papers on ScienceDirect. This performs a search to get PIIs, downloads the XML corresponding to the PII, extracts the raw text and then saves the text i...
Save raw text files based on a search for papers on ScienceDirect. This performs a search to get PIIs, downloads the XML corresponding to the PII, extracts the raw text and then saves the text into a file in the designated folder. Parameters ---------- query_str : str The query string ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/elsevier_client.py#L361-L400
sorgerlab/indra
indra/sources/cwms/rdf_processor.py
CWMSRDFProcessor.extract_statement_from_query_result
def extract_statement_from_query_result(self, res): """Adds a statement based on one element of a rdflib SPARQL query. Parameters ---------- res: rdflib.query.ResultRow Element of rdflib SPARQL query result """ agent_start, agent_end, affected_start, affected...
python
def extract_statement_from_query_result(self, res): """Adds a statement based on one element of a rdflib SPARQL query. Parameters ---------- res: rdflib.query.ResultRow Element of rdflib SPARQL query result """ agent_start, agent_end, affected_start, affected...
Adds a statement based on one element of a rdflib SPARQL query. Parameters ---------- res: rdflib.query.ResultRow Element of rdflib SPARQL query result
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/rdf_processor.py#L45-L77
sorgerlab/indra
indra/sources/cwms/rdf_processor.py
CWMSRDFProcessor.extract_statements
def extract_statements(self): """Extracts INDRA statements from the RDF graph via SPARQL queries. """ # Look for events that have an AGENT and an AFFECTED, and get the # start and ending text indices for each. query = prefixes + """ SELECT ?agent_start ...
python
def extract_statements(self): """Extracts INDRA statements from the RDF graph via SPARQL queries. """ # Look for events that have an AGENT and an AFFECTED, and get the # start and ending text indices for each. query = prefixes + """ SELECT ?agent_start ...
Extracts INDRA statements from the RDF graph via SPARQL queries.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/cwms/rdf_processor.py#L79-L111
sorgerlab/indra
indra/sources/signor/processor.py
SignorProcessor._recursively_lookup_complex
def _recursively_lookup_complex(self, complex_id): """Looks up the constitutents of a complex. If any constituent is itself a complex, recursively expands until all constituents are not complexes.""" assert complex_id in self.complex_map expanded_agent_strings = [] expan...
python
def _recursively_lookup_complex(self, complex_id): """Looks up the constitutents of a complex. If any constituent is itself a complex, recursively expands until all constituents are not complexes.""" assert complex_id in self.complex_map expanded_agent_strings = [] expan...
Looks up the constitutents of a complex. If any constituent is itself a complex, recursively expands until all constituents are not complexes.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/signor/processor.py#L223-L244
sorgerlab/indra
indra/sources/signor/processor.py
SignorProcessor._get_complex_agents
def _get_complex_agents(self, complex_id): """Returns a list of agents corresponding to each of the constituents in a SIGNOR complex.""" agents = [] components = self._recursively_lookup_complex(complex_id) for c in components: db_refs = {} name = uniprot...
python
def _get_complex_agents(self, complex_id): """Returns a list of agents corresponding to each of the constituents in a SIGNOR complex.""" agents = [] components = self._recursively_lookup_complex(complex_id) for c in components: db_refs = {} name = uniprot...
Returns a list of agents corresponding to each of the constituents in a SIGNOR complex.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/signor/processor.py#L246-L280
sorgerlab/indra
indra/statements/io.py
stmts_from_json
def stmts_from_json(json_in, on_missing_support='handle'): """Get a list of Statements from Statement jsons. In the case of pre-assembled Statements which have `supports` and `supported_by` lists, the uuids will be replaced with references to Statement objects from the json, where possible. The method ...
python
def stmts_from_json(json_in, on_missing_support='handle'): """Get a list of Statements from Statement jsons. In the case of pre-assembled Statements which have `supports` and `supported_by` lists, the uuids will be replaced with references to Statement objects from the json, where possible. The method ...
Get a list of Statements from Statement jsons. In the case of pre-assembled Statements which have `supports` and `supported_by` lists, the uuids will be replaced with references to Statement objects from the json, where possible. The method of handling missing support is controled by the `on_missing_su...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L16-L64
sorgerlab/indra
indra/statements/io.py
stmts_to_json_file
def stmts_to_json_file(stmts, fname): """Serialize a list of INDRA Statements into a JSON file. Parameters ---------- stmts : list[indra.statement.Statements] The list of INDRA Statements to serialize into the JSON file. fname : str Path to the JSON file to serialize Statements into...
python
def stmts_to_json_file(stmts, fname): """Serialize a list of INDRA Statements into a JSON file. Parameters ---------- stmts : list[indra.statement.Statements] The list of INDRA Statements to serialize into the JSON file. fname : str Path to the JSON file to serialize Statements into...
Serialize a list of INDRA Statements into a JSON file. Parameters ---------- stmts : list[indra.statement.Statements] The list of INDRA Statements to serialize into the JSON file. fname : str Path to the JSON file to serialize Statements into.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L84-L95
sorgerlab/indra
indra/statements/io.py
stmts_to_json
def stmts_to_json(stmts_in, use_sbo=False): """Return the JSON-serialized form of one or more INDRA Statements. Parameters ---------- stmts_in : Statement or list[Statement] A Statement or list of Statement objects to serialize into JSON. use_sbo : Optional[bool] If True, SBO annota...
python
def stmts_to_json(stmts_in, use_sbo=False): """Return the JSON-serialized form of one or more INDRA Statements. Parameters ---------- stmts_in : Statement or list[Statement] A Statement or list of Statement objects to serialize into JSON. use_sbo : Optional[bool] If True, SBO annota...
Return the JSON-serialized form of one or more INDRA Statements. Parameters ---------- stmts_in : Statement or list[Statement] A Statement or list of Statement objects to serialize into JSON. use_sbo : Optional[bool] If True, SBO annotations are added to each applicable element of the ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L98-L119
sorgerlab/indra
indra/statements/io.py
_promote_support
def _promote_support(sup_list, uuid_dict, on_missing='handle'): """Promote the list of support-related uuids to Statements, if possible.""" valid_handling_choices = ['handle', 'error', 'ignore'] if on_missing not in valid_handling_choices: raise InputError('Invalid option for `on_missing_support`: \...
python
def _promote_support(sup_list, uuid_dict, on_missing='handle'): """Promote the list of support-related uuids to Statements, if possible.""" valid_handling_choices = ['handle', 'error', 'ignore'] if on_missing not in valid_handling_choices: raise InputError('Invalid option for `on_missing_support`: \...
Promote the list of support-related uuids to Statements, if possible.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L122-L139
sorgerlab/indra
indra/statements/io.py
draw_stmt_graph
def draw_stmt_graph(stmts): """Render the attributes of a list of Statements as directed graphs. The layout works well for a single Statement or a few Statements at a time. This function displays the plot of the graph using plt.show(). Parameters ---------- stmts : list[indra.statements.Statem...
python
def draw_stmt_graph(stmts): """Render the attributes of a list of Statements as directed graphs. The layout works well for a single Statement or a few Statements at a time. This function displays the plot of the graph using plt.show(). Parameters ---------- stmts : list[indra.statements.Statem...
Render the attributes of a list of Statements as directed graphs. The layout works well for a single Statement or a few Statements at a time. This function displays the plot of the graph using plt.show(). Parameters ---------- stmts : list[indra.statements.Statement] A list of one or more ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/statements/io.py#L142-L201
sorgerlab/indra
indra/sources/sparser/processor.py
_fix_json_agents
def _fix_json_agents(ag_obj): """Fix the json representation of an agent.""" if isinstance(ag_obj, str): logger.info("Fixing string agent: %s." % ag_obj) ret = {'name': ag_obj, 'db_refs': {'TEXT': ag_obj}} elif isinstance(ag_obj, list): # Recursive for complexes and similar. ...
python
def _fix_json_agents(ag_obj): """Fix the json representation of an agent.""" if isinstance(ag_obj, str): logger.info("Fixing string agent: %s." % ag_obj) ret = {'name': ag_obj, 'db_refs': {'TEXT': ag_obj}} elif isinstance(ag_obj, list): # Recursive for complexes and similar. ...
Fix the json representation of an agent.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/sparser/processor.py#L23-L37
sorgerlab/indra
indra/sources/sparser/processor.py
SparserJSONProcessor.set_statements_pmid
def set_statements_pmid(self, pmid): """Set the evidence PMID of Statements that have been extracted. Parameters ---------- pmid : str or None The PMID to be used in the Evidence objects of the Statements that were extracted by the processor. """ ...
python
def set_statements_pmid(self, pmid): """Set the evidence PMID of Statements that have been extracted. Parameters ---------- pmid : str or None The PMID to be used in the Evidence objects of the Statements that were extracted by the processor. """ ...
Set the evidence PMID of Statements that have been extracted. Parameters ---------- pmid : str or None The PMID to be used in the Evidence objects of the Statements that were extracted by the processor.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/sparser/processor.py#L155-L172
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
get_args
def get_args(node): """Return the arguments of a node in the event graph.""" arg_roles = {} args = node.findall('arg') + \ [node.find('arg1'), node.find('arg2'), node.find('arg3')] for arg in args: if arg is not None: id = arg.attrib.get('id') if id is not None: ...
python
def get_args(node): """Return the arguments of a node in the event graph.""" arg_roles = {} args = node.findall('arg') + \ [node.find('arg1'), node.find('arg2'), node.find('arg3')] for arg in args: if arg is not None: id = arg.attrib.get('id') if id is not None: ...
Return the arguments of a node in the event graph.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L20-L47
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
type_match
def type_match(a, b): """Return True of the types of a and b are compatible, False otherwise.""" # If the types are the same, return True if a['type'] == b['type']: return True # Otherwise, look at some special cases eq_groups = [ {'ONT::GENE-PROTEIN', 'ONT::GENE', 'ONT::PROTEIN'}, ...
python
def type_match(a, b): """Return True of the types of a and b are compatible, False otherwise.""" # If the types are the same, return True if a['type'] == b['type']: return True # Otherwise, look at some special cases eq_groups = [ {'ONT::GENE-PROTEIN', 'ONT::GENE', 'ONT::PROTEIN'}, ...
Return True of the types of a and b are compatible, False otherwise.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L58-L71
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
add_graph
def add_graph(patterns, G): """Add a graph to a set of unique patterns.""" if not patterns: patterns.append([G]) return for i, graphs in enumerate(patterns): if networkx.is_isomorphic(graphs[0], G, node_match=type_match, edge_match=type_match): ...
python
def add_graph(patterns, G): """Add a graph to a set of unique patterns.""" if not patterns: patterns.append([G]) return for i, graphs in enumerate(patterns): if networkx.is_isomorphic(graphs[0], G, node_match=type_match, edge_match=type_match): ...
Add a graph to a set of unique patterns.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L74-L84
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
draw
def draw(graph, fname): """Draw a graph and save it into a file""" ag = networkx.nx_agraph.to_agraph(graph) ag.draw(fname, prog='dot')
python
def draw(graph, fname): """Draw a graph and save it into a file""" ag = networkx.nx_agraph.to_agraph(graph) ag.draw(fname, prog='dot')
Draw a graph and save it into a file
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L87-L90
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
build_patterns
def build_patterns(fnames): """Return a list of CC/EVENT graph patterns from a list of EKB files""" patterns = [] for fn in fnames: et = ET.parse(fn) res = et.findall('CC') + et.findall('EVENT') for event in res: G = networkx.DiGraph() build_event_graph(G, et,...
python
def build_patterns(fnames): """Return a list of CC/EVENT graph patterns from a list of EKB files""" patterns = [] for fn in fnames: et = ET.parse(fn) res = et.findall('CC') + et.findall('EVENT') for event in res: G = networkx.DiGraph() build_event_graph(G, et,...
Return a list of CC/EVENT graph patterns from a list of EKB files
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L93-L104
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
build_event_graph
def build_event_graph(graph, tree, node): """Return a DiGraph of a specific event structure, built recursively""" # If we have already added this node then let's return if node_key(node) in graph: return type = get_type(node) text = get_text(node) label = '%s (%s)' % (type, text) gra...
python
def build_event_graph(graph, tree, node): """Return a DiGraph of a specific event structure, built recursively""" # If we have already added this node then let's return if node_key(node) in graph: return type = get_type(node) text = get_text(node) label = '%s (%s)' % (type, text) gra...
Return a DiGraph of a specific event structure, built recursively
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L107-L123
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
get_extracted_events
def get_extracted_events(fnames): """Get a full list of all extracted event IDs from a list of EKB files""" event_list = [] for fn in fnames: tp = trips.process_xml_file(fn) ed = tp.extracted_events for k, v in ed.items(): event_list += v return event_list
python
def get_extracted_events(fnames): """Get a full list of all extracted event IDs from a list of EKB files""" event_list = [] for fn in fnames: tp = trips.process_xml_file(fn) ed = tp.extracted_events for k, v in ed.items(): event_list += v return event_list
Get a full list of all extracted event IDs from a list of EKB files
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L126-L134
sorgerlab/indra
indra/sources/trips/analyze_ekbs.py
check_event_coverage
def check_event_coverage(patterns, event_list): """Calculate the ratio of patterns that were extracted.""" proportions = [] for pattern_list in patterns: proportion = 0 for pattern in pattern_list: for node in pattern.nodes(): if node in event_list: ...
python
def check_event_coverage(patterns, event_list): """Calculate the ratio of patterns that were extracted.""" proportions = [] for pattern_list in patterns: proportion = 0 for pattern in pattern_list: for node in pattern.nodes(): if node in event_list: ...
Calculate the ratio of patterns that were extracted.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/analyze_ekbs.py#L137-L148
sorgerlab/indra
indra/preassembler/ontology_mapper.py
_load_wm_map
def _load_wm_map(exclude_auto=None): """Load an ontology map for world models. exclude_auto : None or list[tuple] A list of ontology mappings for which automated mappings should be excluded, e.g. [(HUME, UN)] would result in not using mappings from HUME to UN. """ exclude_auto =...
python
def _load_wm_map(exclude_auto=None): """Load an ontology map for world models. exclude_auto : None or list[tuple] A list of ontology mappings for which automated mappings should be excluded, e.g. [(HUME, UN)] would result in not using mappings from HUME to UN. """ exclude_auto =...
Load an ontology map for world models. exclude_auto : None or list[tuple] A list of ontology mappings for which automated mappings should be excluded, e.g. [(HUME, UN)] would result in not using mappings from HUME to UN.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/ontology_mapper.py#L102-L215
sorgerlab/indra
indra/preassembler/ontology_mapper.py
OntologyMapper.map_statements
def map_statements(self): """Run the ontology mapping on the statements.""" for stmt in self.statements: for agent in stmt.agent_list(): if agent is None: continue all_mappings = [] for db_name, db_id in agent.db_refs.items(...
python
def map_statements(self): """Run the ontology mapping on the statements.""" for stmt in self.statements: for agent in stmt.agent_list(): if agent is None: continue all_mappings = [] for db_name, db_id in agent.db_refs.items(...
Run the ontology mapping on the statements.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/ontology_mapper.py#L45-L74
sorgerlab/indra
indra/preassembler/grounding_mapper.py
load_grounding_map
def load_grounding_map(grounding_map_path, ignore_path=None, lineterminator='\r\n'): """Return a grounding map dictionary loaded from a csv file. In the file pointed to by grounding_map_path, the number of name_space ID pairs can vary per row and commas are used to pad out entrie...
python
def load_grounding_map(grounding_map_path, ignore_path=None, lineterminator='\r\n'): """Return a grounding map dictionary loaded from a csv file. In the file pointed to by grounding_map_path, the number of name_space ID pairs can vary per row and commas are used to pad out entrie...
Return a grounding map dictionary loaded from a csv file. In the file pointed to by grounding_map_path, the number of name_space ID pairs can vary per row and commas are used to pad out entries containing fewer than the maximum amount of name spaces appearing in the file. Lines should be terminated wit...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L360-L421
sorgerlab/indra
indra/preassembler/grounding_mapper.py
all_agents
def all_agents(stmts): """Return a list of all of the agents from a list of statements. Only agents that are not None and have a TEXT entry are returned. Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- agents : list of :py:class:`indra.stat...
python
def all_agents(stmts): """Return a list of all of the agents from a list of statements. Only agents that are not None and have a TEXT entry are returned. Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- agents : list of :py:class:`indra.stat...
Return a list of all of the agents from a list of statements. Only agents that are not None and have a TEXT entry are returned. Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- agents : list of :py:class:`indra.statements.Agent` List of ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L426-L447
sorgerlab/indra
indra/preassembler/grounding_mapper.py
get_sentences_for_agent
def get_sentences_for_agent(text, stmts, max_sentences=None): """Returns evidence sentences with a given agent text from a list of statements Parameters ---------- text : str An agent text stmts : list of :py:class:`indra.statements.Statement` INDRA Statements to search in for evid...
python
def get_sentences_for_agent(text, stmts, max_sentences=None): """Returns evidence sentences with a given agent text from a list of statements Parameters ---------- text : str An agent text stmts : list of :py:class:`indra.statements.Statement` INDRA Statements to search in for evid...
Returns evidence sentences with a given agent text from a list of statements Parameters ---------- text : str An agent text stmts : list of :py:class:`indra.statements.Statement` INDRA Statements to search in for evidence statements. max_sentences : Optional[int/None] Cap ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L467-L496
sorgerlab/indra
indra/preassembler/grounding_mapper.py
agent_texts_with_grounding
def agent_texts_with_grounding(stmts): """Return agent text groundings in a list of statements with their counts Parameters ---------- stmts: list of :py:class:`indra.statements.Statement` Returns ------- list of tuple List of tuples of the form (text: str, ((name_space: st...
python
def agent_texts_with_grounding(stmts): """Return agent text groundings in a list of statements with their counts Parameters ---------- stmts: list of :py:class:`indra.statements.Statement` Returns ------- list of tuple List of tuples of the form (text: str, ((name_space: st...
Return agent text groundings in a list of statements with their counts Parameters ---------- stmts: list of :py:class:`indra.statements.Statement` Returns ------- list of tuple List of tuples of the form (text: str, ((name_space: str, ID: str, count: int)...), total_cou...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L499-L559
sorgerlab/indra
indra/preassembler/grounding_mapper.py
ungrounded_texts
def ungrounded_texts(stmts): """Return a list of all ungrounded entities ordered by number of mentions Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- ungroundc : list of tuple list of tuples of the form (text: str, count: int) sorted in ...
python
def ungrounded_texts(stmts): """Return a list of all ungrounded entities ordered by number of mentions Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- ungroundc : list of tuple list of tuples of the form (text: str, count: int) sorted in ...
Return a list of all ungrounded entities ordered by number of mentions Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` Returns ------- ungroundc : list of tuple list of tuples of the form (text: str, count: int) sorted in descending order by count.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L563-L583
sorgerlab/indra
indra/preassembler/grounding_mapper.py
get_agents_with_name
def get_agents_with_name(name, stmts): """Return all agents within a list of statements with a particular name.""" return [ag for stmt in stmts for ag in stmt.agent_list() if ag is not None and ag.name == name]
python
def get_agents_with_name(name, stmts): """Return all agents within a list of statements with a particular name.""" return [ag for stmt in stmts for ag in stmt.agent_list() if ag is not None and ag.name == name]
Return all agents within a list of statements with a particular name.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L586-L589
sorgerlab/indra
indra/preassembler/grounding_mapper.py
save_base_map
def save_base_map(filename, grouped_by_text): """Dump a list of agents along with groundings and counts into a csv file Parameters ---------- filename : str Filepath for output file grouped_by_text : list of tuple List of tuples of the form output by agent_texts_with_grounding "...
python
def save_base_map(filename, grouped_by_text): """Dump a list of agents along with groundings and counts into a csv file Parameters ---------- filename : str Filepath for output file grouped_by_text : list of tuple List of tuples of the form output by agent_texts_with_grounding "...
Dump a list of agents along with groundings and counts into a csv file Parameters ---------- filename : str Filepath for output file grouped_by_text : list of tuple List of tuples of the form output by agent_texts_with_grounding
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L592-L614
sorgerlab/indra
indra/preassembler/grounding_mapper.py
protein_map_from_twg
def protein_map_from_twg(twg): """Build map of entity texts to validate protein grounding. Looks at the grounding of the entity texts extracted from the statements and finds proteins where there is grounding to a human protein that maps to an HGNC name that is an exact match to the entity text. Return...
python
def protein_map_from_twg(twg): """Build map of entity texts to validate protein grounding. Looks at the grounding of the entity texts extracted from the statements and finds proteins where there is grounding to a human protein that maps to an HGNC name that is an exact match to the entity text. Return...
Build map of entity texts to validate protein grounding. Looks at the grounding of the entity texts extracted from the statements and finds proteins where there is grounding to a human protein that maps to an HGNC name that is an exact match to the entity text. Returns a dict that can be used to updat...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L617-L671
sorgerlab/indra
indra/preassembler/grounding_mapper.py
save_sentences
def save_sentences(twg, stmts, filename, agent_limit=300): """Write evidence sentences for stmts with ungrounded agents to csv file. Parameters ---------- twg: list of tuple list of tuples of ungrounded agent_texts with counts of the number of times they are mentioned in the list of sta...
python
def save_sentences(twg, stmts, filename, agent_limit=300): """Write evidence sentences for stmts with ungrounded agents to csv file. Parameters ---------- twg: list of tuple list of tuples of ungrounded agent_texts with counts of the number of times they are mentioned in the list of sta...
Write evidence sentences for stmts with ungrounded agents to csv file. Parameters ---------- twg: list of tuple list of tuples of ungrounded agent_texts with counts of the number of times they are mentioned in the list of statements. Should be sorted in descending order by the count...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L674-L707
sorgerlab/indra
indra/preassembler/grounding_mapper.py
_get_text_for_grounding
def _get_text_for_grounding(stmt, agent_text): """Get text context for Deft disambiguation If the INDRA database is available, attempts to get the fulltext from which the statement was extracted. If the fulltext is not available, the abstract is returned. If the indra database is not available, uses th...
python
def _get_text_for_grounding(stmt, agent_text): """Get text context for Deft disambiguation If the INDRA database is available, attempts to get the fulltext from which the statement was extracted. If the fulltext is not available, the abstract is returned. If the indra database is not available, uses th...
Get text context for Deft disambiguation If the INDRA database is available, attempts to get the fulltext from which the statement was extracted. If the fulltext is not available, the abstract is returned. If the indra database is not available, uses the pubmed client to get the abstract. If no abstrac...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L743-L798
sorgerlab/indra
indra/preassembler/grounding_mapper.py
GroundingMapper.update_agent_db_refs
def update_agent_db_refs(self, agent, agent_text, do_rename=True): """Update db_refs of agent using the grounding map If the grounding map is missing one of the HGNC symbol or Uniprot ID, attempts to reconstruct one from the other. Parameters ---------- agent : :py:clas...
python
def update_agent_db_refs(self, agent, agent_text, do_rename=True): """Update db_refs of agent using the grounding map If the grounding map is missing one of the HGNC symbol or Uniprot ID, attempts to reconstruct one from the other. Parameters ---------- agent : :py:clas...
Update db_refs of agent using the grounding map If the grounding map is missing one of the HGNC symbol or Uniprot ID, attempts to reconstruct one from the other. Parameters ---------- agent : :py:class:`indra.statements.Agent` The agent whose db_refs will be updated...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L51-L83
sorgerlab/indra
indra/preassembler/grounding_mapper.py
GroundingMapper.map_agents_for_stmt
def map_agents_for_stmt(self, stmt, do_rename=True): """Return a new Statement whose agents have been grounding mapped. Parameters ---------- stmt : :py:class:`indra.statements.Statement` The Statement whose agents need mapping. do_rename: Optional[bool] ...
python
def map_agents_for_stmt(self, stmt, do_rename=True): """Return a new Statement whose agents have been grounding mapped. Parameters ---------- stmt : :py:class:`indra.statements.Statement` The Statement whose agents need mapping. do_rename: Optional[bool] ...
Return a new Statement whose agents have been grounding mapped. Parameters ---------- stmt : :py:class:`indra.statements.Statement` The Statement whose agents need mapping. do_rename: Optional[bool] If True, the Agent name is updated based on the mapped grounding...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L150-L217
sorgerlab/indra
indra/preassembler/grounding_mapper.py
GroundingMapper.map_agent
def map_agent(self, agent, do_rename): """Return the given Agent with its grounding mapped. This function grounds a single agent. It returns the new Agent object (which might be a different object if we load a new agent state from json) or the same object otherwise. Parameters ...
python
def map_agent(self, agent, do_rename): """Return the given Agent with its grounding mapped. This function grounds a single agent. It returns the new Agent object (which might be a different object if we load a new agent state from json) or the same object otherwise. Parameters ...
Return the given Agent with its grounding mapped. This function grounds a single agent. It returns the new Agent object (which might be a different object if we load a new agent state from json) or the same object otherwise. Parameters ---------- agent : :py:class:`indr...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L219-L268
sorgerlab/indra
indra/preassembler/grounding_mapper.py
GroundingMapper.map_agents
def map_agents(self, stmts, do_rename=True): """Return a new list of statements whose agents have been mapped Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` The statements whose agents need mapping do_rename: Optional[bool] I...
python
def map_agents(self, stmts, do_rename=True): """Return a new list of statements whose agents have been mapped Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` The statements whose agents need mapping do_rename: Optional[bool] I...
Return a new list of statements whose agents have been mapped Parameters ---------- stmts : list of :py:class:`indra.statements.Statement` The statements whose agents need mapping do_rename: Optional[bool] If True, the Agent name is updated based on the mapped gr...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L270-L301
sorgerlab/indra
indra/preassembler/grounding_mapper.py
GroundingMapper.rename_agents
def rename_agents(self, stmts): """Return a list of mapped statements with updated agent names. Creates a new list of statements without modifying the original list. The agents in a statement should be renamed if the grounding map has updated their db_refs. If an agent contains a FamPl...
python
def rename_agents(self, stmts): """Return a list of mapped statements with updated agent names. Creates a new list of statements without modifying the original list. The agents in a statement should be renamed if the grounding map has updated their db_refs. If an agent contains a FamPl...
Return a list of mapped statements with updated agent names. Creates a new list of statements without modifying the original list. The agents in a statement should be renamed if the grounding map has updated their db_refs. If an agent contains a FamPlex grounding, the FamPlex ID is use...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/grounding_mapper.py#L303-L355
sorgerlab/indra
indra/sources/hprd/processor.py
HprdProcessor.get_complexes
def get_complexes(self, cplx_df): """Generate Complex Statements from the HPRD protein complexes data. Parameters ---------- cplx_df : pandas.DataFrame DataFrame loaded from the PROTEIN_COMPLEXES.txt file. """ # Group the agents for the complex logg...
python
def get_complexes(self, cplx_df): """Generate Complex Statements from the HPRD protein complexes data. Parameters ---------- cplx_df : pandas.DataFrame DataFrame loaded from the PROTEIN_COMPLEXES.txt file. """ # Group the agents for the complex logg...
Generate Complex Statements from the HPRD protein complexes data. Parameters ---------- cplx_df : pandas.DataFrame DataFrame loaded from the PROTEIN_COMPLEXES.txt file.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L151-L176
sorgerlab/indra
indra/sources/hprd/processor.py
HprdProcessor.get_ptms
def get_ptms(self, ptm_df): """Generate Modification statements from the HPRD PTM data. Parameters ---------- ptm_df : pandas.DataFrame DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file. """ logger.info('Processing PTMs...') # Iterat...
python
def get_ptms(self, ptm_df): """Generate Modification statements from the HPRD PTM data. Parameters ---------- ptm_df : pandas.DataFrame DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file. """ logger.info('Processing PTMs...') # Iterat...
Generate Modification statements from the HPRD PTM data. Parameters ---------- ptm_df : pandas.DataFrame DataFrame loaded from the POST_TRANSLATIONAL_MODIFICATIONS.txt file.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L178-L220
sorgerlab/indra
indra/sources/hprd/processor.py
HprdProcessor.get_ppis
def get_ppis(self, ppi_df): """Generate Complex Statements from the HPRD PPI data. Parameters ---------- ppi_df : pandas.DataFrame DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt file. """ logger.info('Processing PPIs...') ...
python
def get_ppis(self, ppi_df): """Generate Complex Statements from the HPRD PPI data. Parameters ---------- ppi_df : pandas.DataFrame DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt file. """ logger.info('Processing PPIs...') ...
Generate Complex Statements from the HPRD PPI data. Parameters ---------- ppi_df : pandas.DataFrame DataFrame loaded from the BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt file.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/processor.py#L222-L243
sorgerlab/indra
indra/sources/isi/processor.py
_build_verb_statement_mapping
def _build_verb_statement_mapping(): """Build the mapping between ISI verb strings and INDRA statement classes. Looks up the INDRA statement class name, if any, in a resource file, and resolves this class name to a class. Returns ------- verb_to_statement_type : dict Dictionary mapping...
python
def _build_verb_statement_mapping(): """Build the mapping between ISI verb strings and INDRA statement classes. Looks up the INDRA statement class name, if any, in a resource file, and resolves this class name to a class. Returns ------- verb_to_statement_type : dict Dictionary mapping...
Build the mapping between ISI verb strings and INDRA statement classes. Looks up the INDRA statement class name, if any, in a resource file, and resolves this class name to a class. Returns ------- verb_to_statement_type : dict Dictionary mapping verb name to an INDRA statment class
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L167-L198
sorgerlab/indra
indra/sources/isi/processor.py
IsiProcessor.get_statements
def get_statements(self): """Process reader output to produce INDRA Statements.""" for k, v in self.reader_output.items(): for interaction in v['interactions']: self._process_interaction(k, interaction, v['text'], self.pmid, self.extr...
python
def get_statements(self): """Process reader output to produce INDRA Statements.""" for k, v in self.reader_output.items(): for interaction in v['interactions']: self._process_interaction(k, interaction, v['text'], self.pmid, self.extr...
Process reader output to produce INDRA Statements.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L38-L43
sorgerlab/indra
indra/sources/isi/processor.py
IsiProcessor._process_interaction
def _process_interaction(self, source_id, interaction, text, pmid, extra_annotations): """Process an interaction JSON tuple from the ISI output, and adds up to one statement to the list of extracted statements. Parameters ---------- source_id : str ...
python
def _process_interaction(self, source_id, interaction, text, pmid, extra_annotations): """Process an interaction JSON tuple from the ISI output, and adds up to one statement to the list of extracted statements. Parameters ---------- source_id : str ...
Process an interaction JSON tuple from the ISI output, and adds up to one statement to the list of extracted statements. Parameters ---------- source_id : str the JSON key corresponding to the sentence in the ISI output interaction: the JSON list with subject/ver...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/isi/processor.py#L59-L146
sorgerlab/indra
indra/sources/geneways/actionmention_parser.py
GenewaysActionMention.make_annotation
def make_annotation(self): """Returns a dictionary with all properties of the action mention.""" annotation = dict() # Put all properties of the action object into the annotation for item in dir(self): if len(item) > 0 and item[0] != '_' and \ not inspect...
python
def make_annotation(self): """Returns a dictionary with all properties of the action mention.""" annotation = dict() # Put all properties of the action object into the annotation for item in dir(self): if len(item) > 0 and item[0] != '_' and \ not inspect...
Returns a dictionary with all properties of the action mention.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/geneways/actionmention_parser.py#L31-L41
sorgerlab/indra
indra/sources/biopax/processor.py
_match_to_array
def _match_to_array(m): """ Returns an array consisting of the elements obtained from a pattern search cast into their appropriate classes. """ return [_cast_biopax_element(m.get(i)) for i in range(m.varSize())]
python
def _match_to_array(m): """ Returns an array consisting of the elements obtained from a pattern search cast into their appropriate classes. """ return [_cast_biopax_element(m.get(i)) for i in range(m.varSize())]
Returns an array consisting of the elements obtained from a pattern search cast into their appropriate classes.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1374-L1377
sorgerlab/indra
indra/sources/biopax/processor.py
_is_complex
def _is_complex(pe): """Return True if the physical entity is a complex""" val = isinstance(pe, _bp('Complex')) or \ isinstance(pe, _bpimpl('Complex')) return val
python
def _is_complex(pe): """Return True if the physical entity is a complex""" val = isinstance(pe, _bp('Complex')) or \ isinstance(pe, _bpimpl('Complex')) return val
Return True if the physical entity is a complex
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1379-L1383
sorgerlab/indra
indra/sources/biopax/processor.py
_is_protein
def _is_protein(pe): """Return True if the element is a protein""" val = isinstance(pe, _bp('Protein')) or \ isinstance(pe, _bpimpl('Protein')) or \ isinstance(pe, _bp('ProteinReference')) or \ isinstance(pe, _bpimpl('ProteinReference')) return val
python
def _is_protein(pe): """Return True if the element is a protein""" val = isinstance(pe, _bp('Protein')) or \ isinstance(pe, _bpimpl('Protein')) or \ isinstance(pe, _bp('ProteinReference')) or \ isinstance(pe, _bpimpl('ProteinReference')) return val
Return True if the element is a protein
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1385-L1391
sorgerlab/indra
indra/sources/biopax/processor.py
_is_rna
def _is_rna(pe): """Return True if the element is an RNA""" val = isinstance(pe, _bp('Rna')) or isinstance(pe, _bpimpl('Rna')) return val
python
def _is_rna(pe): """Return True if the element is an RNA""" val = isinstance(pe, _bp('Rna')) or isinstance(pe, _bpimpl('Rna')) return val
Return True if the element is an RNA
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1393-L1396
sorgerlab/indra
indra/sources/biopax/processor.py
_is_small_molecule
def _is_small_molecule(pe): """Return True if the element is a small molecule""" val = isinstance(pe, _bp('SmallMolecule')) or \ isinstance(pe, _bpimpl('SmallMolecule')) or \ isinstance(pe, _bp('SmallMoleculeReference')) or \ isinstance(pe, _bpimpl('SmallMoleculeReference')) ...
python
def _is_small_molecule(pe): """Return True if the element is a small molecule""" val = isinstance(pe, _bp('SmallMolecule')) or \ isinstance(pe, _bpimpl('SmallMolecule')) or \ isinstance(pe, _bp('SmallMoleculeReference')) or \ isinstance(pe, _bpimpl('SmallMoleculeReference')) ...
Return True if the element is a small molecule
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1398-L1404
sorgerlab/indra
indra/sources/biopax/processor.py
_is_physical_entity
def _is_physical_entity(pe): """Return True if the element is a physical entity""" val = isinstance(pe, _bp('PhysicalEntity')) or \ isinstance(pe, _bpimpl('PhysicalEntity')) return val
python
def _is_physical_entity(pe): """Return True if the element is a physical entity""" val = isinstance(pe, _bp('PhysicalEntity')) or \ isinstance(pe, _bpimpl('PhysicalEntity')) return val
Return True if the element is a physical entity
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1406-L1410
sorgerlab/indra
indra/sources/biopax/processor.py
_is_modification_or_activity
def _is_modification_or_activity(feature): """Return True if the feature is a modification""" if not (isinstance(feature, _bp('ModificationFeature')) or \ isinstance(feature, _bpimpl('ModificationFeature'))): return None mf_type = feature.getModificationType() if mf_type is None: ...
python
def _is_modification_or_activity(feature): """Return True if the feature is a modification""" if not (isinstance(feature, _bp('ModificationFeature')) or \ isinstance(feature, _bpimpl('ModificationFeature'))): return None mf_type = feature.getModificationType() if mf_type is None: ...
Return True if the feature is a modification
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1418-L1432
sorgerlab/indra
indra/sources/biopax/processor.py
_is_reference
def _is_reference(bpe): """Return True if the element is an entity reference.""" if isinstance(bpe, _bp('ProteinReference')) or \ isinstance(bpe, _bpimpl('ProteinReference')) or \ isinstance(bpe, _bp('SmallMoleculeReference')) or \ isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \ ...
python
def _is_reference(bpe): """Return True if the element is an entity reference.""" if isinstance(bpe, _bp('ProteinReference')) or \ isinstance(bpe, _bpimpl('ProteinReference')) or \ isinstance(bpe, _bp('SmallMoleculeReference')) or \ isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \ ...
Return True if the element is an entity reference.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1434-L1446
sorgerlab/indra
indra/sources/biopax/processor.py
_is_entity
def _is_entity(bpe): """Return True if the element is a physical entity.""" if isinstance(bpe, _bp('Protein')) or \ isinstance(bpe, _bpimpl('Protein')) or \ isinstance(bpe, _bp('SmallMolecule')) or \ isinstance(bpe, _bpimpl('SmallMolecule')) or \ isinstance(bpe, _bp('Complex')) o...
python
def _is_entity(bpe): """Return True if the element is a physical entity.""" if isinstance(bpe, _bp('Protein')) or \ isinstance(bpe, _bpimpl('Protein')) or \ isinstance(bpe, _bp('SmallMolecule')) or \ isinstance(bpe, _bpimpl('SmallMolecule')) or \ isinstance(bpe, _bp('Complex')) o...
Return True if the element is a physical entity.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1448-L1466
sorgerlab/indra
indra/sources/biopax/processor.py
_is_catalysis
def _is_catalysis(bpe): """Return True if the element is Catalysis.""" if isinstance(bpe, _bp('Catalysis')) or \ isinstance(bpe, _bpimpl('Catalysis')): return True else: return False
python
def _is_catalysis(bpe): """Return True if the element is Catalysis.""" if isinstance(bpe, _bp('Catalysis')) or \ isinstance(bpe, _bpimpl('Catalysis')): return True else: return False
Return True if the element is Catalysis.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1468-L1474
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.print_statements
def print_statements(self): """Print all INDRA Statements collected by the processors.""" for i, stmt in enumerate(self.statements): print("%s: %s" % (i, stmt))
python
def print_statements(self): """Print all INDRA Statements collected by the processors.""" for i, stmt in enumerate(self.statements): print("%s: %s" % (i, stmt))
Print all INDRA Statements collected by the processors.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L53-L56
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.save_model
def save_model(self, file_name=None): """Save the BioPAX model object in an OWL file. Parameters ---------- file_name : Optional[str] The name of the OWL file to save the model in. """ if file_name is None: logger.error('Missing file name') ...
python
def save_model(self, file_name=None): """Save the BioPAX model object in an OWL file. Parameters ---------- file_name : Optional[str] The name of the OWL file to save the model in. """ if file_name is None: logger.error('Missing file name') ...
Save the BioPAX model object in an OWL file. Parameters ---------- file_name : Optional[str] The name of the OWL file to save the model in.
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L58-L69
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.eliminate_exact_duplicates
def eliminate_exact_duplicates(self): """Eliminate Statements that were extracted multiple times. Due to the way the patterns are implemented, they can sometimes yield the same Statement information multiple times, in which case, we end up with redundant Statements that aren't from inde...
python
def eliminate_exact_duplicates(self): """Eliminate Statements that were extracted multiple times. Due to the way the patterns are implemented, they can sometimes yield the same Statement information multiple times, in which case, we end up with redundant Statements that aren't from inde...
Eliminate Statements that were extracted multiple times. Due to the way the patterns are implemented, they can sometimes yield the same Statement information multiple times, in which case, we end up with redundant Statements that aren't from independent underlying entries. To avoid this...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L71-L83
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_complexes
def get_complexes(self): """Extract INDRA Complex Statements from the BioPAX model. This method searches for org.biopax.paxtools.model.level3.Complex objects which represent molecular complexes. It doesn't reuse BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith ...
python
def get_complexes(self): """Extract INDRA Complex Statements from the BioPAX model. This method searches for org.biopax.paxtools.model.level3.Complex objects which represent molecular complexes. It doesn't reuse BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith ...
Extract INDRA Complex Statements from the BioPAX model. This method searches for org.biopax.paxtools.model.level3.Complex objects which represent molecular complexes. It doesn't reuse BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.inComplexWith query since that retrieves pairs ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L86-L109
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_modifications
def get_modifications(self): """Extract INDRA Modification Statements from the BioPAX model. To extract Modifications, this method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional constraints to specify ...
python
def get_modifications(self): """Extract INDRA Modification Statements from the BioPAX model. To extract Modifications, this method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional constraints to specify ...
Extract INDRA Modification Statements from the BioPAX model. To extract Modifications, this method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional constraints to specify the type of state change occurri...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L111-L126
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_activity_modification
def get_activity_modification(self): """Extract INDRA ActiveForm statements from the BioPAX model. This method extracts ActiveForm Statements that are due to protein modifications. This method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constr...
python
def get_activity_modification(self): """Extract INDRA ActiveForm statements from the BioPAX model. This method extracts ActiveForm Statements that are due to protein modifications. This method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constr...
Extract INDRA ActiveForm statements from the BioPAX model. This method extracts ActiveForm Statements that are due to protein modifications. This method reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional c...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L128-L185
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_regulate_activities
def get_regulate_activities(self): """Get Activation/Inhibition INDRA Statements from the BioPAX model. This method extracts Activation/Inhibition Statements and reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with add...
python
def get_regulate_activities(self): """Get Activation/Inhibition INDRA Statements from the BioPAX model. This method extracts Activation/Inhibition Statements and reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with add...
Get Activation/Inhibition INDRA Statements from the BioPAX model. This method extracts Activation/Inhibition Statements and reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional constraints to specify the gain or los...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L187-L259
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_regulate_amounts
def get_regulate_amounts(self): """Extract INDRA RegulateAmount Statements from the BioPAX model. This method extracts IncreaseAmount/DecreaseAmount Statements from the BioPAX model. It fully reuses BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateRe...
python
def get_regulate_amounts(self): """Extract INDRA RegulateAmount Statements from the BioPAX model. This method extracts IncreaseAmount/DecreaseAmount Statements from the BioPAX model. It fully reuses BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateRe...
Extract INDRA RegulateAmount Statements from the BioPAX model. This method extracts IncreaseAmount/DecreaseAmount Statements from the BioPAX model. It fully reuses BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.controlsExpressionWithTemplateReac pattern to find TemplateReaction...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L261-L342
sorgerlab/indra
indra/sources/biopax/processor.py
BiopaxProcessor.get_conversions
def get_conversions(self): """Extract Conversion INDRA Statements from the BioPAX model. This method uses a custom BioPAX Pattern (one that is not implemented PatternBox) to query for BiochemicalReactions whose left and right hand sides are collections of SmallMolecules. This pa...
python
def get_conversions(self): """Extract Conversion INDRA Statements from the BioPAX model. This method uses a custom BioPAX Pattern (one that is not implemented PatternBox) to query for BiochemicalReactions whose left and right hand sides are collections of SmallMolecules. This pa...
Extract Conversion INDRA Statements from the BioPAX model. This method uses a custom BioPAX Pattern (one that is not implemented PatternBox) to query for BiochemicalReactions whose left and right hand sides are collections of SmallMolecules. This pattern thereby extracts metabolic ...
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L344-L433