LocARNA-1.8.11
Public Member Functions | Static Public Member Functions | List of all members
LocARNA::SequenceAnnotation Class Reference

Annotation of a sequence. More...

#include <sequence_annotation.hh>

Public Member Functions

 SequenceAnnotation (size_type name_length=0)
 Construct empty. More...
 
 SequenceAnnotation (const std::string &annotation_string)
 Construct single string. More...
 
 SequenceAnnotation (const std::vector< std::string > &annotation_strings)
 Construct from vector of strings. More...
 
 SequenceAnnotation (const AlignmentEdges &edges, const SequenceAnnotation &annotationA, const SequenceAnnotation &annotationB)
 Construct as consensus annotation. More...
 
size_t length () const
 Size of the represented range. More...
 
bool empty () const
 Check empty. More...
 
size_t name_length () const
 Name length. More...
 
const std::string & annotation_string (size_t i) const
 
std::string single_string (char sep='#') const
 
bool is_neutral_pos (size_t i) const
 Test neutral name at a position. More...
 
std::string name (size_t i) const
 Access name at position. More...
 
void push_back_name (const name_t &name)
 Push back name to the annotation strings in annotation_. More...
 
bool duplicate_names () const
 

Static Public Member Functions

static const SequenceAnnotationempty_instance ()
 initialize the static member empty_instance
 
static bool is_neutral_char (char c)
 Test for neutral character. More...
 
static bool is_neutral (const name_t &name)
 Test neutral name. More...
 
static bool clashing_names (const AlignmentEdges &edges, const SequenceAnnotation &annotationA, const SequenceAnnotation &annotationB)
 

Detailed Description

Annotation of a sequence.

Defines names for positions from 1..size; allows construct as consensus of two aligned annotation sequences.

Constructor & Destructor Documentation

LocARNA::SequenceAnnotation::SequenceAnnotation ( size_type  name_length = 0)
inlineexplicit

Construct empty.

Parameters
name_lengthlength of names
LocARNA::SequenceAnnotation::SequenceAnnotation ( const std::string &  annotation_string)
explicit

Construct single string.

Parameters
annotation_stringstring of '#'-separated sub-strings
LocARNA::SequenceAnnotation::SequenceAnnotation ( const std::vector< std::string > &  annotation_strings)
explicit

Construct from vector of strings.

Parameters
annotation_stringsvector of annotation strings

The strings specify names of uniform length. The name of a position i is the string annotation_strings[0][i]+...+annotation_strings[k-1][i], where k=annotation_strings.size()

LocARNA::SequenceAnnotation::SequenceAnnotation ( const AlignmentEdges edges,
const SequenceAnnotation annotationA,
const SequenceAnnotation annotationB 
)

Construct as consensus annotation.

Parameters
edgesalignment edges between A and B
annotationAannotation A
annotationBannotation B
Returns
consensus annotation of A and B
Note
If two different names are aligned (name clash!), the lexicographically smaller name is selected to resolve the conflict
If two equal names are not aligned, this can result in duplicate names in the consensus

The consensus contains all names that appear in either A or B or both at the position of the corresponding alignment edge.

Precondition
names in annotationA and annotationB must have the same lengths

Member Function Documentation

const std::string& LocARNA::SequenceAnnotation::annotation_string ( size_t  i) const
inline

Access to annotation strings

Parameters
iindex; 0-based
Returns
annotation string with index i
bool LocARNA::SequenceAnnotation::empty ( ) const
inline

Check empty.

Returns
whether empty
bool LocARNA::SequenceAnnotation::is_neutral ( const name_t &  name)
static

Test neutral name.

Returns
whether name is neutral, i.e. contains no non-neutral characters
static bool LocARNA::SequenceAnnotation::is_neutral_char ( char  c)
inlinestatic

Test for neutral character.

Parameters
c
Returns
whether c is neutral
bool LocARNA::SequenceAnnotation::is_neutral_pos ( size_t  i) const

Test neutral name at a position.

Parameters
iposition of name
Returns
whether name at position i is neutral, i.e. contains no non-neutral characters
size_t LocARNA::SequenceAnnotation::length ( ) const
inline

Size of the represented range.

Returns
size, where represented range of positions is 1..size
std::string LocARNA::SequenceAnnotation::name ( size_t  i) const

Access name at position.

Parameters
iposition
Returns
name at position i
size_t LocARNA::SequenceAnnotation::name_length ( ) const
inline

Name length.

Returns
length of names
void LocARNA::SequenceAnnotation::push_back_name ( const name_t &  name)

Push back name to the annotation strings in annotation_.

Parameters
nameName
std::string LocARNA::SequenceAnnotation::single_string ( char  sep = '#') const

Annotation description as single string

Parameters
sepseparator between annotation strings
Returns
string of annotation strings separated by sep

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