next up previous contents index
Next: String Matching Algorithms ( Up: Alignment Data Types Previous: Alignment Data Types   Contents   Index


Alphabet ( alphabet )

Definition

An instance A of the data type alphabet is an object containing a collection of letters. During a creation phase, letters can be added to or removed from the alphabet. If the final set of letters has been created, the alphabet has to be finished. Afterwards no further changes are accepted. The letters are lexicographically ordered in the alphabet.
Remark: This data type is experimental. It can significantly change in future versions.

#include < LEDA/string/alphabet.h >

Creation

alphabet A creates an instance A of type alphabet.

alphabet A(const string seq) creates an instance A of type alphabet and initializes A to be the set of all different letters in seq . The alphabet is set to be finished by this constructor.

Operations

void A.setStandard() sets the standard alphabet consisting of the upper case letters A-Z and finishes the alphabet construction phase.

bool A.isStandard() returns true if the alphabet consists of the upper case letters A-Z, false otherwise.

void A.setDNA() sets the alphabet to the set consisting of the letters A,C,T, and G and finishes the alphabet construction phase.

bool A.isDNA() returns true if the alphabet consists of the letters A,C,T, and G.

void A.addLetter(char ch) adds letter ch to A .
Precondition A is not yet finished. If it is finished, an exception is thrown.

void A.delLetter(char ch) deletes letter ch from A if contained; otherwise, nothing happens.
Precondition A is not yet finished. If it is finished, an exception is thrown.

char A.getLetter(unsigned i) returns the letter at position i of the lexicographically ordered set of letters, starting with position 0 . If i is too big, an exception is thrown.
Precondition A is finished. Otherwise an exception is thrown.

void A.setFinished() finishes the alphabet.

bool A.getFinished() returns true if A is finished, false otherwise.

bool A.isFinished() returns true if A is finished, false otherwise.

string A.getLetters() returns a string containing all letters of A in lexicographical order.
Precondition A is finished. Otherwise an exception is thrown.

int A.getLength() returns the size of A , that is the number of different letters in A.
Precondition A is finished. Otherwise an exception is thrown.

int A.getSize() same as getLength() .


next up previous contents index
Next: String Matching Algorithms ( Up: Alignment Data Types Previous: Alignment Data Types   Contents   Index
Christian Uhrig 2017-04-07