TEES (indra.sources.tees)

The TEES processor requires an installaton of TEES. To install TEES:

  1. Clone the latest stable version of TEES using

    git clone https://github.com/jbjorne/TEES.git

  2. Put this TEES cloned repository in one of these three places: the same directory as INDRA, your home directory, or ~/Downloads. If you put TEES in a location other than one of these three places, you will need to pass this directory to indra.sources.tees.tees_api.process_text each time you call it.

  3. Run configure.py within the TEES installation to install TEES dependencies.

TEES API (indra.sources.tees.tees_api)

This module provides a simplified API for invoking the Turku Event Extraction System (TEES) on text and extracting INDRA statement from TEES output.

See publication: Jari Björne, Sofie Van Landeghem, Sampo Pyysalo, Tomoko Ohta, Filip Ginter, Yves Van de Peer, Sofia Ananiadou and Tapio Salakoski, PubMed-Scale Event Extraction for Post-Translational Modifications, Epigenetics and Protein Structural Relations. Proceedings of BioNLP 2012, pages 82-90, 2012.

indra.sources.tees.tees_api.process_text(text, pmid=None, tees_path=None, python2_path=None)[source]

Processes the specified plain text with TEES and converts output to supported INDRA statements.

Parameters:
  • text (str) – Plain text to process with TEES
  • pmid (str) – The PMID from which the paper comes from, to be stored in the Evidence object of statements. Set to None if this is unspecified.
  • tees_path (str) – The path of the TEES installation directory containing classify.py. If None, searches several common paths.
  • python2_path (str) – TEES is only compatible with python 2. This processor invokes this external python 2 interpreter so that the processor can be run in either python 2 or python 3. If None, searches for an executible named python2 in the PATH environment variable.
Returns:

tp – A TEESProcessor object which contains a list of INDRA statements extracted from TEES extractions

Return type:

TEESProcessor

TEES Processor (indra.sources.tees.processor)

This module takes the TEES parse graph generated by parse_tees and converts it into INDRA statements.

See publication: Jari Björne, Sofie Van Landeghem, Sampo Pyysalo, Tomoko Ohta, Filip Ginter, Yves Van de Peer, Sofia Ananiadou and Tapio Salakoski, PubMed-Scale Event Extraction for Post-Translational Modifications, Epigenetics and Protein Structural Relations. Proceedings of BioNLP 2012, pages 82-90, 2012.

class indra.sources.tees.processor.TEESProcessor(text, pmid, tees_path, python2_path)[source]

Converts the specified text into a series of INDRA statmenets.

Only extracts a subset of INDRA statements. Currently supported statements are: * Phosphorylation

Parameters:
  • text (str) – Plain text from biomedical publications from which to extract INDRA statements.
  • pmid (int) – The pmid which the text comes from, or None if we don’t want to specify at the moment. Stored in the Evidence object for each statement.
  • tees_path (str) – Path to the directory containing the TEES installation, in particular containing TEES’ classify.py.
  • python2_path (str) – Absolute path to a python 2 interpreter. This is needed to run TEES because TEES is only compatabile with python 2. If None then searches for an executable named python2 in the path.
statements

list[indra.statements.Statement] – A list of INDRA statements extracted from the provided text via TEES

connected_subgraph(node)[source]

Returns the subgraph containing the given node, its ancestors, and its descendants.

Parameters:node (str) – We want to create the subgraph containing this node.
Returns:subgraph – The subgraph containing the specified node.
Return type:networkx.DiGraph
find_event_parent_with_event_child(parent_name, child_name)[source]

Finds all event nodes (is_event node attribute is True) that are of the type parent_name, that have a child event node with the type child_name.

find_event_with_outgoing_edges(event_name, desired_relations)[source]

Gets a list of event nodes with the specified event_name and outgoing edges annotated with each of the specified relations.

Parameters:
  • event_name (str) – Look for event nodes with this name
  • desired_relations (list[str]) – Look for event nodes with outgoing edges annotated with each of these relations
Returns:

event_nodes – Event nodes that fit the desired criteria

Return type:

list[str]

general_node_label(node)[source]

Used for debugging - gives a short text description of a graph node.

get_entity_text_for_relation(node, relation)[source]

Looks for an edge from node to some other node, such that the edge is annotated with the given relation. If there exists such an edge, and the node at the other edge is an entity, return that entity’s text. Otherwise, returns None.

Looks for an edge from node to some other node, such that the edge is annotated with the given relation. If there exists such an edge, returns the name of the node it points to. Otherwise, returns None.

node_has_edge_with_label(node_name, edge_label)[source]

Looks for an edge from node_name to some other node with the specified label. Returns the node to which this edge points if it exists, or None if it doesn’t.

Parameters:
  • G – The graph object
  • node_name – Node that the edge starts at
  • edge_label – The text in the relation property of the edge
node_to_evidence(entity_node, is_direct)[source]

Computes an evidence object for a statement.

We assume that the entire event happens within a single statement, and get the text of the sentence by getting the text of the sentence containing the provided node that corresponds to one of the entities participanting in the event.

The Evidence’s pmid is whatever was provided to the constructor (perhaps None), and the annotations are the subgraph containing the provided node, its ancestors, and its descendants.

print_parent_and_children_info(node)[source]

Used for debugging - prints a short description of a a node, its children, its parents, and its parents’ children.

process_binding_statements()[source]

Looks for Binding events in the graph and extracts them into INDRA statements.

In particular, looks for a Binding event node with outgoing edges with relations Theme and Theme2 - the entities these edges point to are the two constituents of the Complex INDRA statement.

process_decrease_expression_amount()[source]

Looks for Negative_Regulation events with a specified Cause and a Gene_Expression theme, and processes them into INDRA statements.

process_increase_expression_amount()[source]

Looks for Positive_Regulation events with a specified Cause and a Gene_Expression theme, and processes them into INDRA statements.

process_phosphorylation_statements()[source]

Looks for Phosphorylation events in the graph and extracts them into INDRA statements.

In particular, looks for a Positive_regulation event node with a child Phosphorylation event node.

If Positive_regulation has an outgoing Cause edge, that’s the subject If Phosphorylation has an outgoing Theme edge, that’s the object If Phosphorylation has an outgoing Site edge, that’s the site

indra.sources.tees.processor.s2a(s)[source]

Makes an Agent from a string describing the agent.