Skip to content
Jack Tierney edited this page Jul 2, 2024 · 1 revision

Welcome to the RDG wiki!

Graph Construction

Here are the steps for constructing a Ribosome Decision Graph (RDG) using the RDG Python class:

  1. Initialize an empty RDG object:

    • Create a new instance of the RDG class, specifying the locus start, locus stop, and name.
    • The constructor automatically creates a minimal graph with a 5' node, a 3' node, and an untranslated edge connecting them.
  2. Add translons to the graph:

    • Use the add_open_reading_frame method to add a translon to the graph.
    • Specify the start codon position, stop codon position, and optional reinitiation and upstream limit parameters.
    • The method handles all necessary graph modifications, including:
      • Finding edges that clash with the new translon (i.e., the start codon is within the range of a non-translated edge).
      • Creating new start and stop nodes for the translon.
      • Creating a new coding edge from the start node to the stop node.
      • Updating the clashing edge to start at the new start node and adding a new untranslated edge from the start node to the old terminal node.
      • Creating a new terminal node and connecting it to the stop node with an untranslated edge.
  3. Add stop codon readthrough events (optional):

    • Use the add_stop_codon_readthrough method to add a readthrough event at a specific stop codon position.
    • Specify the readthrough codon position and the position of the next stop codon.
    • The method handles the necessary graph modifications, including:
      • Converting the stop node at the specified position into a branch point.
      • Adding a new stop node downstream and connecting it to the branch point with a translated edge.
      • Connecting the branch point to the old terminal node with an untranslated edge.
  4. Add frameshift events (optional):

    • Use the add_frameshift method to add a frameshift event to the graph.
    • Specify the frameshift position, the position of the next stop codon after the frameshift, and the shift value (e.g., -1 or +1).
    • The method handles the necessary graph modifications, including:
      • Splitting the translated edge containing the frameshift position into two edges.
      • Adding a frameshift node at the specified position.
      • Connecting the frameshift node to the old stop node with a translated edge (representing the non-frameshifted path).
      • Adding a new stop node and connecting it to the frameshift node with a translated edge (representing the frameshifted path).
      • Adding a new terminal node and connecting it to the new stop node with an untranslated edge.
  5. Visualize and analyze the constructed RDG:

    • Use the various methods provided by the RDG class to explore and analyze the graph, such as:
      • get_branch_points: Get a list of nodes that are branch points (i.e., have more than one output edge).
      • get_endpoints: Get a list of terminal node keys (i.e., nodes with no output edges).
      • get_startpoints: Get a list of start node keys (i.e., nodes with no input edges, representing the 5' end of the locus or TSS).
      • get_start_nodes: Get a list of translation start node keys (i.e., nodes with two output edges, one for translation starting at that site and one for no translation).
      • get_stop_nodes: Get a list of translation stop node keys (i.e., nodes with "stop" in their node type).
      • get_translons: Get a list of coordinates (start, stop) describing the translons in the graph.
      • get_frameshifts: Get a list of keys for all frameshift nodes.
      • get_unique_paths: Get a list of lists of nodes describing the unique paths through the graph.
      • statistics: Get a dictionary of statistics about the graph, such as the number of nodes, edges, and node types.
      • describe: Get a text-based description of the graph.
      • newick: Get a Newick representation of the graph for visualization purposes.

These steps outline the general process of constructing an RDG using the Python class. The class offers flexibility in adding translons, readthrough events, and frameshift events to the graph, as well as various methods for exploring and analyzing the resulting graph structure.

Clone this wiki locally