RNAblueprint-1.3.2
design::DependencyGraph< R > Class Template Reference

Dependency Graph which holds all structural constraints. More...

Public Member Functions

 DependencyGraph (std::vector< std::string > structures, std::string constraints, R rand)
 Constructor for the Dependency graph. More...
 
 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. More...
 
 DependencyGraph (std::vector< std::string > structures, std::string constraints)
 constructor for the Dependency graph using a predefined random number generator with a clock generated seed. More...
 
 DependencyGraph (std::vector< std::string > structures, R rand)
 constructor for the Dependency graph without any sequence constraints. More...
 
 DependencyGraph (std::vector< std::string > structures)
 constructor for the Dependency graph using a predefined random number generator with a clock generated seed and an empty string as sequence constraints. More...
 
 DependencyGraph (const DependencyGraph &copy)
 Copy constructor which sets a new random seed in the copy sampled from the old generator. More...
 
 ~DependencyGraph ()
 Destructor for the dependency graph object. More...
 
void set_history_size (unsigned int size)
 Set the maximum number of previous sampled sequences to memorize (Default: 100). More...
 
std::string get_graphml ()
 Returns the root graph in GraphML format as a string. More...
 
std::string get_graphml (int connected_component_ID)
 Returns the connected component graph with the connected_component_ID in GraphML format as a string. More...
 
std::string get_sequence ()
 Get the current RNA sequence as a string. More...
 
SolutionSizeType set_sequence (std::string sequence)
 Allows you to set a initial sequence as starting point for your optimization. More...
 
bool revert_sequence ()
 Reverts the sequence to the previous one. More...
 
bool revert_sequence (unsigned int jump)
 Reverts the sequence to a previous one being (jump) steps in the history;. More...
 
std::vector< std::string > get_history ()
 Returns the history of previous sampled sequences at this point. More...
 
SolutionSizeType sample ()
 Resets all bases in the whole dependency graph and samples a new sequence randomly. More...
 
SolutionSizeType sample (int position)
 Resets and samples only the smallest subgraph(s) possible containing the vertex at the given position in the sequence. More...
 
SolutionSizeType sample (int start, int end)
 Resets only the smallest subgraph(s) possible containing the vertices from position start to end. More...
 
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, etc.) with the given size and samples all positions. More...
 
SolutionSizeType sample_plocal ()
 Randomly chooses one path (either top-level a connected component, or within a block, etc.) and samples all positions. More...
 
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 component. More...
 
SolutionSizeType sample_clocal (int connected_component_ID)
 Takes the connected component with the specified ID and samples a new sequence for the whole component. More...
 
SolutionSizeType sample_clocal ()
 Takes a random connected component and samples a new sequence for the whole component. More...
 
SolutionSizeType number_of_sequences ()
 Returns the amount of solutions given the dependency graph and sequence constraints. More...
 
SolutionSizeType number_of_sequences (int connected_component_ID)
 Returns the amount of solutions for the connected component with the given ID. More...
 
int number_of_connected_components ()
 Returns the number of connected components into which the dependency graph was decomposed. More...
 
std::vector< int > component_vertices (int connected_component_ID)
 Returns a vector with all the vertices in this component of the given ID. More...
 
std::vector< int > articulation_vertices ()
 Returns a list of vertices specified as articulation vertices. More...
 
std::vector< int > articulation_vertices (int connected_component_ID)
 Returns a list of vertices in the specified connected component specified as articulation vertices. More...
 
unsigned int max_number_of_dimensions ()
 Returns the maximal number of dimensions of all dynamic programming tables. More...
 

Private Attributes

detail::DependencyGraph< R > * g
 Pointer to the internal dependency graph object. More...
 

Detailed Description

template<typename R>
class design::DependencyGraph< R >

Dependency Graph which holds all structural constraints.

This graph is used to generate valid sequences compatible to the input structures

Definition at line 192 of file RNAblueprint.h.

Constructor & Destructor Documentation

◆ DependencyGraph() [1/6]

template<typename R >
design::DependencyGraph< R >::DependencyGraph ( std::vector< std::string >  structures,
std::string  constraints,
rand 
)

Constructor for the Dependency graph.

Parameters
structuresvector of string structures in dot-bracket notation.
constraintsstring containing the sequence constraints in IUPAC notation. Can also be a empty string!
randrandom number generator of your choice. Supported at the moment is only std::mt19937, but as it is templated, it can easily be extended to support more generators.
Exceptions
std::exceptionif input is invalid or construction fails an exception is thrown.

◆ DependencyGraph() [2/6]

template<typename R >
design::DependencyGraph< R >::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.

Parameters
structuresvector of string structures in dot-bracket notation.
constraintsstring containing the sequence constraints in IUPAC notation. Can also be a empty string!
seedunsigned long to be used as seed of the random number generator.
Exceptions
std::exceptionif input is invalid or construction fails an exception is thrown.

◆ DependencyGraph() [3/6]

template<typename R >
design::DependencyGraph< R >::DependencyGraph ( std::vector< std::string >  structures,
std::string  constraints 
)

constructor for the Dependency graph using a predefined random number generator with a clock generated seed.

Parameters
structuresvector of string structures in dot-bracket notation.
constraintsstring containing the sequence constraints in IUPAC notation. Can also be a empty string!
Exceptions
std::exceptionif input is invalid or construction fails an exception is thrown.

◆ DependencyGraph() [4/6]

template<typename R >
design::DependencyGraph< R >::DependencyGraph ( std::vector< std::string >  structures,
rand 
)

constructor for the Dependency graph without any sequence constraints.

Parameters
structuresvector of string structures in dot-bracket notation.
randrandom number generator of your choice. Supported at the moment is only std::mt19937, but as it is templated, it can easily be extended to support more generators.
Exceptions
std::exceptionif input is invalid or construction fails an exception is thrown.

◆ DependencyGraph() [5/6]

template<typename R >
design::DependencyGraph< R >::DependencyGraph ( std::vector< std::string >  structures)

constructor for the Dependency graph using a predefined random number generator with a clock generated seed and an empty string as sequence constraints.

Parameters
structuresvector of string structures in dot-bracket notation.
Exceptions
std::exceptionif input is invalid or construction fails an exception is thrown.

◆ DependencyGraph() [6/6]

template<typename R >
design::DependencyGraph< R >::DependencyGraph ( const DependencyGraph< R > &  copy)

Copy constructor which sets a new random seed in the copy sampled from the old generator.

◆ ~DependencyGraph()

template<typename R >
design::DependencyGraph< R >::~DependencyGraph ( )

Destructor for the dependency graph object.

Member Function Documentation

◆ articulation_vertices() [1/2]

template<typename R >
std::vector< int > design::DependencyGraph< R >::articulation_vertices ( )

Returns a list of vertices specified as articulation vertices.

These articulation vertices are also known as cut points or attachment points and also include cycle opening cuts.

See also
articulation_vertices(int connected_component_ID)
Returns
vector of integer values specifying the positions/vertices marked as articulation vertices.

◆ articulation_vertices() [2/2]

template<typename R >
std::vector< int > design::DependencyGraph< R >::articulation_vertices ( int  connected_component_ID)

Returns a list of vertices in the specified connected component specified as articulation vertices.

These articulation vertices include cut points, articulation points and also a cycle opening cuts.

Parameters
connected_component_IDinteger specifying the connected component with its ID [ 0, number_of_connected_components() ).
See also
number_of_connected_components(), articulation_vertices()
Exceptions
std::out_of_rangeif connected_component_ID is invalid.
Returns
vector of integer values specifying the positions/vertices marked as articulation vertices in the connected component.

◆ component_vertices()

template<typename R >
std::vector<int> design::DependencyGraph< R >::component_vertices ( int  connected_component_ID)

Returns a vector with all the vertices in this component of the given ID.

Parameters
connected_component_IDinteger specifying the connected component with its ID [ 0, number_of_connected_components() ).
See also
number_of_connected_components()
Exceptions
std::out_of_rangeif connected_component_ID is invalid.
Returns
vector of integer values specifying the positions/vertices contained in the connected component.

◆ get_graphml() [1/2]

template<typename R >
std::string design::DependencyGraph< R >::get_graphml ( )

Returns the root graph in GraphML format as a string.

Get the dependency graph in the XML based GraphML format for further analysis or visualization.

Returns
string containing the GraphML notation of the dependency graph.

◆ get_graphml() [2/2]

template<typename R >
std::string design::DependencyGraph< R >::get_graphml ( int  connected_component_ID)

Returns the connected component graph with the connected_component_ID in GraphML format as a string.

Get the graph for a specific connected component in the XML based GraphML format for further analysis or visualization.

Parameters
connected_component_IDinteger specifying the connected component with its ID [ 0, number_of_connected_components() ).
See also
number_of_connected_components()
Exceptions
std::out_of_rangeif connected_component_ID is invalid.
Returns
string containing the GraphML notation of the connected component.

◆ get_history()

template<typename R >
std::vector< std::string > design::DependencyGraph< R >::get_history ( )

Returns the history of previous sampled sequences at this point.

See also
set_history_size(int size), revert_sequence(), revert_sequence(unsigned int jump)
Returns
vector of string representing the history of previous sampled sequences.

◆ get_sequence()

template<typename R >
std::string design::DependencyGraph< R >::get_sequence ( )

Get the current RNA sequence as a string.

This sequence is only N directly after construction. You need to call either set or sample a initial sequence to avoid this behavior.

See also
sample(), set_sequence()
Returns
string representing the current RNA sequence.

◆ max_number_of_dimensions()

template<typename R >
unsigned int design::DependencyGraph< R >::max_number_of_dimensions ( )

Returns the maximal number of dimensions of all dynamic programming tables.

This value is a great measure for the complexity of the graph coloring approach for the chosen input constraints.

Returns
integer specifying the maximal number of dimensions for all DP tables.

◆ number_of_connected_components()

template<typename R >
int design::DependencyGraph< R >::number_of_connected_components ( )

Returns the number of connected components into which the dependency graph was decomposed.

Returns
integer defining the number of connected components

◆ number_of_sequences() [1/2]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::number_of_sequences ( )

Returns the amount of solutions given the dependency graph and sequence constraints.

Number of sequences is the total amount of sequences possible for the given structural and sequence constraints. This defines the size of the solution space.

See also
number_of_sequences(int connected_component_ID)
Returns
number of possible sequences for this design problem.

◆ number_of_sequences() [2/2]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::number_of_sequences ( int  connected_component_ID)

Returns the amount of solutions for the connected component with the given ID.

Number of sequences is the total amount of sequences possible for the given connected component.

Parameters
connected_component_IDinteger specifying the connected component with its ID [ 0, number_of_connected_components() ).
See also
number_of_sequences(), number_of_connected_components()
Exceptions
std::out_of_rangeif connected_component_ID is invalid.
Returns
number of possible sequences for this connected component.

◆ revert_sequence() [1/2]

template<typename R >
bool design::DependencyGraph< R >::revert_sequence ( )

Reverts the sequence to the previous one.

This sets the dependency graph to the previous sampled sequence state.

See also
set_history_size(int size), revert_sequence(unsigned int jump)
Returns
boolean specifying if this move was possible. If no previous sequence is stored, it returns false.

◆ revert_sequence() [2/2]

template<typename R >
bool design::DependencyGraph< R >::revert_sequence ( unsigned int  jump)

Reverts the sequence to a previous one being (jump) steps in the history;.

Parameters
jumpinteger specifying the length of the time-jump. 2 would for example revert the sequence to the one before the previous one.
See also
set_history_size(int size), revert_sequence()
Returns
boolean specifying if this move was possible. If no such previous sequence is stored, it returns false.

◆ sample() [1/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample ( )

Resets all bases in the whole dependency graph and samples a new sequence randomly.

Call get_sequence() after you sampled a new sequence. It is not possible to retrieve the previous sequence with this move.

See also
get_sequence(), sample(int position), sample(int start, int end)
Returns
number of possible solutions for this sampling (number of all possible sequences minus the current one).

◆ sample() [2/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample ( int  position)

Resets and samples only the smallest subgraph(s) possible containing the vertex at the given position in the sequence.

This way you can optimize by targeted sampling at the given positions. All positions dependent on the chosen one will also be sampled. If your position is a articulation vertex, the whole connected component will be re-sampled. Else, in case of being a non-articulation vertex, only the smallest path containing the vertex will be sampled.

Parameters
positioninteger specifying the position to re-sample [ 0, N )
See also
get_sequence(), sample(), sample(int start, int end)
Returns
number of possible solutions for this sampling.

◆ sample() [3/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample ( int  start,
int  end 
)

Resets only the smallest subgraph(s) possible containing the vertices from position start to end.

This way you can optimize by targeted sampling at the given positions. All positions dependent on the chosen ones will also be sampled. If your positions contain articulation vertices, the whole connected components will be re-sampled. Else, in case of being only non-articulation vertex, only the smallest paths containing the vertices will be sampled. Positions for start and end are inclusive [ start, end ]

Parameters
startinteger specifying the first position to re-sample [ 0, N )
endinteger specifying the last position to re-sample [ 0, N )
See also
get_sequence(), sample(), sample(int position)
Returns
number of possible solutions for this sampling.

◆ sample_clocal() [1/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample_clocal ( )

Takes a random connected component and samples a new sequence for the whole component.

See also
sample_plocal(), sample_plocal(int min_num_pos, int max_num_pos), sample_clocal(int connected_component_ID), sample_clocal(int min_num_pos, int max_num_pos)
Returns
number of possible sequences for this sampling.

◆ sample_clocal() [2/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample_clocal ( int  connected_component_ID)

Takes the connected component with the specified ID and samples a new sequence for the whole component.

Parameters
connected_component_IDinteger specifying the connected component with its ID [ 0, number_of_connected_components() ).
See also
number_of_connected_components(), sample_plocal(), sample_plocal(int min_num_pos, int max_num_pos), sample_clocal(), sample_clocal(int min_num_pos, int max_num_pos)
Exceptions
std::out_of_rangeif connected_component_ID is invalid.
Returns
number of possible sequences for this sampling.

◆ sample_clocal() [3/3]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::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 component.

This is a more global way of sampling a new sequence as it exchanges a much bigger graph object. min_num_pos, max_num_pos set the minimal/maximal number of sampled positions, e.g., for [ 3, 5 ] only connected components with minimal 3 and maximal 5 vertices will be chosen for sampling.

Parameters
min_num_posinteger specifying the minimal size of the component to re-sample [ 1, N )
max_num_posinteger specifying the maximal size of the component to re-sample [ 1, N ). 0 defines infinity.
See also
sample_plocal(), sample_plocal(int min_num_pos, int max_num_pos), sample_clocal(), sample_clocal(int connected_component_ID)
Returns
number of possible solutions for this sampling.

◆ sample_plocal() [1/2]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample_plocal ( )

Randomly chooses one path (either top-level a connected component, or within a block, etc.) and samples all positions.

See also
sample_plocal(int min_num_pos, int max_num_pos), sample_clocal(), sample_clocal(int min_num_pos, int max_num_pos), sample_clocal(int connected_component_ID)
Returns
number of possible solutions for this sampling.

◆ sample_plocal() [2/2]

template<typename R >
SolutionSizeType design::DependencyGraph< R >::sample_plocal ( int  min_num_pos,
int  max_num_pos 
)

Randomly chooses one path (either top-level a connected component, or within a block, etc.) with the given size and samples all positions.

Articulation vertices such as cut points or articulation points will stay the same. Therefore it is guaranteed that the sampling is correct, even if we only sample a small local piece of a more complex graph object. min_num_pos and max_num_pos set the minimal/maximal number of sampled positions, e.g., for [ 3, 5 ] only paths with minimal 3 and maximal 5 non-articulation vertices will be chosen for sampling.

Parameters
min_num_posinteger specifying the minimal size of the component to re-sample [ 1, N )
max_num_posinteger specifying the maximal size of the component to re-sample [ 1, N ). 0 defines infinity.
See also
sample_plocal(), sample_clocal(), sample_clocal(int min_num_pos, int max_num_pos), sample_clocal(int connected_component_ID)
Returns
number of possible solutions for this sampling.

◆ set_history_size()

template<typename R >
void design::DependencyGraph< R >::set_history_size ( unsigned int  size)

Set the maximum number of previous sampled sequences to memorize (Default: 100).

A history of all sampled sequences is stored within the dependency graph object. Use this function to set the size of the storage stack (Minimum: 1).

Parameters
sizeinteger to set the size (>0) of the history storage container.

◆ set_sequence()

template<typename R >
SolutionSizeType design::DependencyGraph< R >::set_sequence ( std::string  sequence)

Allows you to set a initial sequence as starting point for your optimization.

Only real bases are allowed and the sequence has to fulfill all structural constraints, otherwise an error is thrown.

Parameters
sequencestring containing the sequence constraints in IUPAC notation. Only [AUGC] are allowed as bases.
Exceptions
std::exceptionif input string contains invalid characters or constraints cannot be fulfilled.
Returns
number of possible solutions for this sampling. Is 1 all the time for set_sequence()

Field Documentation

◆ g

template<typename R >
detail::DependencyGraph<R>* design::DependencyGraph< R >::g
private

Pointer to the internal dependency graph object.

Definition at line 448 of file RNAblueprint.h.


The documentation for this class was generated from the following file: