RNAblueprint-1.3.2
RNAblueprint.h
Go to the documentation of this file.
1 
85 #ifndef RNADESIGN_H
86 #define RNADESIGN_H
87 
88 // include header
89 #include "common.h"
90 #include "dependency_graph.h"
91 #include "parsestruct.h"
92 #include "decompose.h"
93 
94 // boost header
95 #include <chrono>
96 #include <boost/graph/bipartite.hpp>
97 
98 
101 namespace design {
106  void initialize_library(bool debug);
112  void initialize_library(bool debug, int construction_timeout);
126  std::string structures_to_graphml(std::vector<std::string> structures, std::string constraints, bool decompose, unsigned long seed);
140  std::string structures_to_graphml(std::vector<std::string> structures, std::string constraints, bool decompose);
152  std::string structures_to_graphml(std::vector<std::string> structures, std::string constraints);
162  bool graph_is_bipartite(std::vector<std::string> structures);
173  bool sequence_structure_compatible(std::string sequence, std::vector<std::string> structures);
186  std::vector<int> incompatible_sequence_positions(std::string sequence, std::string structure);
191  template <typename R>
193  public:
201  DependencyGraph(std::vector<std::string> structures, std::string constraints, R rand);
209  DependencyGraph(std::vector<std::string> structures, std::string constraints, unsigned long seed);
216  DependencyGraph(std::vector<std::string> structures, std::string constraints);
223  DependencyGraph(std::vector<std::string> structures, R rand);
230  DependencyGraph(std::vector<std::string> structures);
244  void set_history_size(unsigned int size);
251  std::string get_graphml();
261  std::string get_graphml(int connected_component_ID);
269  std::string get_sequence();
278  SolutionSizeType set_sequence(std::string sequence);
293  bool revert_sequence(unsigned int jump);
299  std::vector< std::string > get_history();
307  SolutionSizeType sample();
319  SolutionSizeType sample(int position);
332  SolutionSizeType sample(int start, int end);
345  SolutionSizeType sample_plocal(int min_num_pos, int max_num_pos);
351  SolutionSizeType sample_plocal();
363  SolutionSizeType sample_clocal(int min_num_pos, int max_num_pos);
371  SolutionSizeType sample_clocal(int connected_component_ID);
377  SolutionSizeType sample_clocal();
386  SolutionSizeType number_of_sequences();
396  SolutionSizeType number_of_sequences(int connected_component_ID);
409  std::vector<int> component_vertices(int connected_component_ID);
417  std::vector< int > articulation_vertices();
427  std::vector< int > articulation_vertices(int connected_component_ID);
434  unsigned int max_number_of_dimensions();
435  // ??? get_articulation_probabilities(connected components ID)
436  // Returns basically the ProbabilityMatrix for all articulation vertices (remove make_internal() function) of the whole connected component
437  // hash of hash: vertex -> base_color -> number_of_sequences
438 
439  // ??? get_constrained_probabilities()
440  // Returns a hash of hash table of vertex -> base_color -> number_of_sequences for all positions given the base_color.
441  // for articulation vertices we can just call the function above and get the sums,
442  // for non-articulation we maybe have to do a constraint recalculation for every position/base combination?
443 
444 
445  private:
448  detail::DependencyGraph<R> * g;
449  };
450 }
451 
452 #endif
Dependency Graph which holds all structural constraints.
Definition: RNAblueprint.h:192
detail::DependencyGraph< R > * g
Pointer to the internal dependency graph object.
Definition: RNAblueprint.h:448
SolutionSizeType sample(int start, int end)
Resets only the smallest subgraph(s) possible containing the vertices from position start to end.
SolutionSizeType set_sequence(std::string sequence)
Allows you to set a initial sequence as starting point for your optimization.
std::string get_sequence()
Get the current RNA sequence as a string.
DependencyGraph(std::vector< std::string > structures, std::string constraints, unsigned long seed)
constructor for the Dependency graph using a predefined random number generator with the given seed.
SolutionSizeType sample_clocal(int min_num_pos, int max_num_pos)
Randomly chooses a connected component with the given size and samples a new sequence for the whole c...
SolutionSizeType number_of_sequences()
Returns the amount of solutions given the dependency graph and sequence constraints.
DependencyGraph(std::vector< std::string > structures)
constructor for the Dependency graph using a predefined random number generator with a clock generate...
SolutionSizeType number_of_sequences(int connected_component_ID)
Returns the amount of solutions for the connected component with the given ID.
SolutionSizeType sample_clocal()
Takes a random connected component and samples a new sequence for the whole component.
SolutionSizeType sample(int position)
Resets and samples only the smallest subgraph(s) possible containing the vertex at the given position...
SolutionSizeType sample()
Resets all bases in the whole dependency graph and samples a new sequence randomly.
~DependencyGraph()
Destructor for the dependency graph object.
std::vector< int > component_vertices(int connected_component_ID)
Returns a vector with all the vertices in this component of the given ID.
SolutionSizeType sample_clocal(int connected_component_ID)
Takes the connected component with the specified ID and samples a new sequence for the whole componen...
DependencyGraph(const DependencyGraph &copy)
Copy constructor which sets a new random seed in the copy sampled from the old generator.
std::vector< std::string > get_history()
Returns the history of previous sampled sequences at this point.
void set_history_size(unsigned int size)
Set the maximum number of previous sampled sequences to memorize (Default: 100).
DependencyGraph(std::vector< std::string > structures, std::string constraints)
constructor for the Dependency graph using a predefined random number generator with a clock generate...
std::vector< int > articulation_vertices(int connected_component_ID)
Returns a list of vertices in the specified connected component specified as articulation vertices.
unsigned int max_number_of_dimensions()
Returns the maximal number of dimensions of all dynamic programming tables.
std::vector< int > articulation_vertices()
Returns a list of vertices specified as articulation vertices.
std::string get_graphml()
Returns the root graph in GraphML format as a string.
int number_of_connected_components()
Returns the number of connected components into which the dependency graph was decomposed.
bool revert_sequence()
Reverts the sequence to the previous one.
bool revert_sequence(unsigned int jump)
Reverts the sequence to a previous one being (jump) steps in the history;.
std::string get_graphml(int connected_component_ID)
Returns the connected component graph with the connected_component_ID in GraphML format as a string.
SolutionSizeType sample_plocal()
Randomly chooses one path (either top-level a connected component, or within a block,...
DependencyGraph(std::vector< std::string > structures, std::string constraints, R rand)
Constructor for the Dependency graph.
SolutionSizeType sample_plocal(int min_num_pos, int max_num_pos)
Randomly chooses one path (either top-level a connected component, or within a block,...
DependencyGraph(std::vector< std::string > structures, R rand)
constructor for the Dependency graph without any sequence constraints.
This file holds all global includes, definitions and variables.
This file holds the functions to decompose the dependency graph into its subgraphs.
This file holds the class definitions for the internal representation of the DependencyGraph.
All classes and functions for the RNA design library are under the design namespace.
Definition: RNAblueprint.h:101
bool graph_is_bipartite(std::vector< std::string > structures)
Returns whether the dependency graph built from the given input structures is bipartite.
void initialize_library(bool debug)
Initialize the Libraries global variables.
bool sequence_structure_compatible(std::string sequence, std::vector< std::string > structures)
Returns whether the the given sequence is compatible to all the given structures.
std::vector< int > incompatible_sequence_positions(std::string sequence, std::string structure)
Returns whether the the given sequence is compatible to all the given structures.
std::string structures_to_graphml(std::vector< std::string > structures, std::string constraints, bool decompose, unsigned long seed)
Generate a graphml representation of structural and sequence constraints.
This file holds the functions to parse a dot-bracket representation to a boost graph and set the sequ...