LocARNA-1.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Static Public Member Functions
LocARNA::RnaStructure Class Reference

An RNA secondary structure. More...

#include <rna_structure.hh>

List of all members.

Public Types

typedef std::pair< size_t, size_t > bp_t
 base pair type
typedef std::set< bp_t,
std::less< bp_t > > 
bps_t
 base pair set type
typedef bps_t::const_iterator const_iterator
 Check whether a loop contains a position.

Public Member Functions

 RnaStructure ()
 construct empty
 RnaStructure (const std::string &structure)
 construct from dot-bracket string
bool operator== (const RnaStructure &s) const
 Equality operator.
bool contains (const bp_t &x) const
 Base pair for membership test.
size_t length () const
 sequence length
size_t size () const
 number of base pairs
void insert (const bp_t &bp)
 insert base pair
void remove (const bp_t &bp)
 remove base pair
void clear ()
 clear structure set structure to empty
const_iterator begin () const
 begin of base pair set
const_iterator end () const
 end of base pair set
std::string to_string () const
 convert to dot-bracket string
bool empty () const
 Check for empty structure / class PLAIN.
bool nested () const
 Check for nested structure / class NESTED.
bool crossing () const
 Check for crossing structure / class CROSSING.
void remove_lonely_pairs ()
 remove lonely base pairs
void apply_bpfilter (const BasePairFilter::Filter &filter)
 apply base pair filter

Static Public Member Functions

static bool empty (const bps_t &bps)
 Check base pair set for empty structure / class PLAIN.
static bool nested (const bps_t &bps)
 Check for class NESTED.
static bool crossing (const bps_t &bps)
 Check for class CROSSING.

Detailed Description

An RNA secondary structure.

Represents a structure (for a sequence of given length) as set of base pairs. Supports parsing of dot-bracket strings (potentially including pseudoknots) and traversal of base pairs.

Generally, base pairs (i,j) have to be oriented, i.e. i<j; compare private method assert_valid_bp()

Todo:
read structure in ct format from stream

Member Typedef Documentation

typedef bps_t::const_iterator LocARNA::RnaStructure::const_iterator

Check whether a loop contains a position.

Parameters:
kposition
xloop; (0,length+1) means external loop
Returns:
whether the loop enclosed by x contains k

Definition: the loop enclosed by (i,j) contains k iff i<k<j and there is no base pair (i',j') in the structure, where i<i'<k<j'<j. Note that we don't require (i,j) to be element of the structure.

k can be member of more than one loop unless nested(). constant iterator over base pairs


Constructor & Destructor Documentation

LocARNA::RnaStructure::RnaStructure ( const std::string &  structure) [explicit]

construct from dot-bracket string

Parameters:
structuredot-bracket string

We recognize different bracket pairs: (),[],{},<>, and letter pairs Aa, Bb, etc ; the structure string can encode crossing base pairs like in

.(((..[[.AA...)))..]]..aa.

The parser ignores all other symbols ( including _-,:.~ ) such that e.g. Vienna dot-bracket strings and WUSS notation is parsed correctly. Note that the parser is more general than the WUSS-specification, which forbids crossing of different bracket-symbols like [(...]), so that other common pseudoknot specifications are recognized as well.


Member Function Documentation

apply base pair filter

Applies a base pair filter to all base pairs; removes all base pairs that don't pass; in place.

begin of base pair set

Returns:
constant iterator at begin
bool LocARNA::RnaStructure::contains ( const bp_t x) const [inline]

Base pair for membership test.

Parameters:
xbase pair
Returns:
whether structure contains the base pair
bool LocARNA::RnaStructure::crossing ( const bps_t bps) [static]

Check for class CROSSING.

Parameters:
bpsset of base pairs
Returns:
whether structure is in the crossing class (i.e., not in unlimited)

A structure is in the crossing class if no base pairs share common ends.

Note:
this does *not* test for the presence of crossing base pairs. For the latter, use !nested().
bool LocARNA::RnaStructure::crossing ( ) const [inline]

Check for crossing structure / class CROSSING.

Returns:
whether structure is in crossing class
bool LocARNA::RnaStructure::empty ( const bps_t bps) [static]

Check base pair set for empty structure / class PLAIN.

Parameters:
bpsset of base pairs
Returns:
whether given base pair set represents empty structure
bool LocARNA::RnaStructure::empty ( ) const [inline]

Check for empty structure / class PLAIN.

Returns:
whether structure is empty

end of base pair set

Returns:
constant iterator at end
void LocARNA::RnaStructure::insert ( const bp_t bp) [inline]

insert base pair

Parameters:
bpbase pair
bool LocARNA::RnaStructure::nested ( const bps_t bps) [static]

Check for class NESTED.

Parameters:
bpsset of base pairs
Returns:
whether structure is in the nested class (i.e., not in classes crossing or unlimited)

A structure is in the class nested if no base pairs cross or share common ends.

See also:
in_crossing() for naming
bool LocARNA::RnaStructure::nested ( ) const [inline]

Check for nested structure / class NESTED.

Returns:
whether structure is nested class
bool LocARNA::RnaStructure::operator== ( const RnaStructure s) const [inline]

Equality operator.

Parameters:
srna structure to be compared
Returns:
whether equal
void LocARNA::RnaStructure::remove ( const bp_t bp) [inline]

remove base pair

Parameters:
bpbase pair

remove lonely base pairs

Removes the lonely base pairs in the structure; in place

std::string LocARNA::RnaStructure::to_string ( ) const

convert to dot-bracket string

Returns:
dot-bracket string

If the structure contains crossing base pairs, such base pairs are encoded using more than one pair of bracket symbols. ( see constructor from dot bracket string ). The use of bracket symbols is greedy from left to right, following the order defined in the class (by constants open_symbols_ and close_symbols_).

Precondition:
structure is in crossing class, i.e. not unlimited!

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends