LocARNA-2.0.0
Public Types | 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 Types

typedef std::string name_t
 an anchcor name
 

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...
 

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

◆ SequenceAnnotation() [1/4]

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

Construct empty.

Parameters
name_lengthlength of names

◆ SequenceAnnotation() [2/4]

LocARNA::SequenceAnnotation::SequenceAnnotation ( const std::string &  annotation_string)
explicit

Construct single string.

Parameters
annotation_stringstring of '#'-separated sub-strings

◆ SequenceAnnotation() [3/4]

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()

◆ SequenceAnnotation() [4/4]

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

◆ annotation_string()

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

◆ empty()

bool LocARNA::SequenceAnnotation::empty ( ) const
inline

Check empty.

Returns
whether empty

◆ is_neutral()

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

◆ is_neutral_char()

static bool LocARNA::SequenceAnnotation::is_neutral_char ( char  c)
inlinestatic

Test for neutral character.

Parameters
c
Returns
whether c is neutral

◆ is_neutral_pos()

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

◆ length()

size_t LocARNA::SequenceAnnotation::length ( ) const
inline

Size of the represented range.

Returns
size, where represented range of positions is 1..size

◆ name()

std::string LocARNA::SequenceAnnotation::name ( size_t  i) const

Access name at position.

Parameters
iposition
Returns
name at position i

◆ name_length()

size_t LocARNA::SequenceAnnotation::name_length ( ) const
inline

Name length.

Returns
length of names

◆ push_back_name()

void LocARNA::SequenceAnnotation::push_back_name ( const name_t name)

Push back name to the annotation strings in annotation_.

Parameters
nameName

◆ single_string()

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: