Victor
 All Data Structures Functions Variables Friends Pages
AlignmentBase Class Reference

Abstract base class for all sorts of alignments. More...

+ Inheritance diagram for AlignmentBase:

Public Member Functions

 AlignmentBase ()
 Default constructor.
 
 AlignmentBase (const AlignmentBase &orig)
 Copy constructor.
 
virtual ~AlignmentBase ()
 Destructor.
 
virtual void addAlignment (const AlignmentBase &other)
 Combine two multiple sequence alignments of same target. More...
 
virtual double calculateIdentity ()
 Calculate overall identity. More...
 
virtual double calculatePairwiseIdentity (const string &seq1, const string &seq2)
 Calculate pairwise identity between seq1 and seq2. More...
 
virtual void clearAlignment ()
 Clear alignment data.
 
virtual void clearTemplate ()
 Clear template data.
 
virtual void copy (const AlignmentBase &orig)
 Copy orig object to this object ("deep copy"). More...
 
virtual void cutTemplate (unsigned int index)
 Remove all templates below index. More...
 
string deleteChar (const string &s, unsigned int n)
 Delete n-th character. More...
 
void deletePos (unsigned int p)
 Delete character (or '-') from target and all templates at position p. More...
 
unsigned int getLength ()
 Return length of alignment.
 
virtual vector< vector< int > > getMatchSubset ()
 
unsigned int getSequenceLength (const string &seq)
 Return length of seq. More...
 
virtual string getTarget () const
 Return target sequence.
 
virtual int getTargetAminoAcidOffset () const
 Return target aa offset (only needed for alignment, default = 0).
 
virtual string getTargetName () const
 Return target name.
 
virtual char getTargetPos (unsigned int p) const
 Return target position p.
 
virtual string getTemplate (unsigned int index=0) const
 Return template index sequence.
 
virtual int getTemplateAminoAcidOffset (unsigned int index=0) const
 Return template index aa offset (counting from zero).
 
virtual string getTemplateName (unsigned int index=0) const
 Return template index name.
 
virtual char getTemplatePos (unsigned int p, unsigned int index=0) const
 Return template index position p.
 
vector< string > getTokens (const string &text)
 Return vector of words of a line of text. More...
 
void insertCharacter (unsigned int p, char c)
 Insert character c in target and all templates at position p. More...
 
void insertDash (unsigned int p)
 Insert character '-' in target and all templates at position p. More...
 
virtual bool isConserved (unsigned int p, unsigned int index=9999) const
 Check for conservation. If index is 9999 check on all templates. More...
 
virtual bool isDeletion (unsigned int p) const
 Check for deletion at position p. More...
 
virtual bool isGap (unsigned int p, unsigned int index=0) const
 Check for gap at position p. More...
 
virtual bool isInsertion (unsigned int p, unsigned int index=0) const
 Check for insertion at position p. More...
 
virtual double matchPositionVector (vector< int > CeTarget, vector< int > CeTemplate, vector< int > seqTarget, vector< int > seqTemplate)
 Companion class to the previous. More...
 
virtual AlignmentBasenewCopy ()
 Construct a new "deep copy" of this object. More...
 
AlignmentBaseoperator= (const AlignmentBase &orig)
 Assignment operator. More...
 
void purgeTargetInsertions ()
 Delete all gaps from target and all templates.
 
virtual void saveClustal (ostream &output) const
 Save as CLUSTAL like output. More...
 
virtual void saveFasta (ostream &output) const
 Save as FASTA like output. More...
 
virtual void setTarget (string t, string tName="target")
 Set target to t.
 
virtual void setTargetAminoAcidOffset (int orig)
 Set target aa offset (only needed for alignment, default = 0).
 
virtual void setTargetPos (unsigned int p, char res)
 Set target residue to res.
 
virtual void setTemplate (string t, string tName="template")
 Set template to t. More...
 
virtual void setTemplateAminoAcidOffset (unsigned int index, int val)
 Set template index aa offset (counting from zero).
 
virtual void setTemplatePos (unsigned int p, char res, unsigned int index=0)
 Set template index residue to res.
 
virtual vector< int > shiftMatchSubset (vector< int > inputVector, int newStartPos)
 Return a new vector with positions shifted, depending on new position. More...
 
unsigned int size () const
 Return size of alignment.
 
virtual void swapTemplate (unsigned int index1, unsigned int index2)
 Swap templates index1 and index2. More...
 

Static Public Member Functions

static unsigned int getNewPos (const string &s, unsigned int p)
 Return position of original index if '-' are now present. More...
 
static unsigned int getOrigPos (const string &s, unsigned int p)
 Return position of index if '-' would not be there (counting from zero). More...
 
static string getPureSequence (const string &s)
 Return sequence without '-' characters. More...
 
static void saveClustal (string t, string tName, ostream &output, unsigned int from)
 Save single line in CLUSTAL format.
 
static void saveFasta (string t, string tName, ostream &output)
 Save single sequence in FASTA format.
 

Protected Attributes

vector< string > seqTemplate
 Template sequences.
 
vector< string > seqTemplateName
 Template names.
 
int startAaTarget
 Start target aa offset.
 
vector< int > startAaTemplates
 Start templates aa offsets.
 
string target
 Target sequence.
 
string targetName
 Target name.
 

Detailed Description

Abstract base class for all sorts of alignments.

Member Function Documentation

void addAlignment ( const AlignmentBase orig)
virtual

Combine two multiple sequence alignments of same target.

The algorithm is so long, because 6 cases are distinguished:

  • leading insertion for target A or target B
  • normal insertion for target A or target B
  • trailing insertion for target A or target B If ignoreInsertion is set, insertions of target A are ignored.
Parameters
orig
double calculateIdentity ( )
virtual

Calculate overall identity.

Returns
double calculatePairwiseIdentity ( const string &  seq1,
const string &  seq2 
)
virtual

Calculate pairwise identity between seq1 and seq2.

Parameters
seq1
seq2
Returns
void copy ( const AlignmentBase orig)
virtual

Copy orig object to this object ("deep copy").

Parameters
orig
void cutTemplate ( unsigned int  index)
virtual

Remove all templates below index.

Parameters
index

Reimplemented in Alignment.

string deleteChar ( const string &  s,
unsigned int  n 
)

Delete n-th character.

Parameters
s
n
Returns
void deletePos ( unsigned int  p)

Delete character (or '-') from target and all templates at position p.

Parameters
p
vector< vector< int > > getMatchSubset ( )
virtual

Return a vector of int containing the aligned aa in target and template. Each position of the vector contains the aa position in the target and in the template (-1 means gap).

Returns
unsigned int getNewPos ( const string &  s,
unsigned int  p 
)
static

Return position of original index if '-' are now present.

Parameters
s
p
Returns
unsigned int getOrigPos ( const string &  s,
unsigned int  p 
)
static

Return position of index if '-' would not be there (counting from zero).

If original index points to a dash, it returns the position of the first non-dash left character, again taking '-' not into account.

Parameters
s
p
Returns
string getPureSequence ( const string &  s)
static

Return sequence without '-' characters.

Parameters
s
Returns
unsigned int getSequenceLength ( const string &  seq)

Return length of seq.

Parameters
seq
Returns
vector< string > getTokens ( const string &  text)

Return vector of words of a line of text.

Parameters
text
Returns
void insertCharacter ( unsigned int  p,
char  c 
)

Insert character c in target and all templates at position p.

Parameters
p
c
void insertDash ( unsigned int  p)

Insert character '-' in target and all templates at position p.

Parameters
p
bool isConserved ( unsigned int  p,
unsigned int  index = 9999 
) const
virtual

Check for conservation. If index is 9999 check on all templates.

Parameters
p
index
Returns
bool isDeletion ( unsigned int  p) const
virtual

Check for deletion at position p.

Parameters
p
Returns
bool isGap ( unsigned int  p,
unsigned int  index = 0 
) const
virtual

Check for gap at position p.

Parameters
p
index
Returns
bool isInsertion ( unsigned int  p,
unsigned int  index = 0 
) const
virtual

Check for insertion at position p.

Parameters
p
index
Returns
double matchPositionVector ( vector< int >  CeTarget,
vector< int >  CeTemplate,
vector< int >  seqTarget,
vector< int >  seqTemplate 
)
virtual

Companion class to the previous.

Parameters
CeTarget
CeTemplate
seqTarget
seqTemplate
Returns
AlignmentBase * newCopy ( )
virtual

Construct a new "deep copy" of this object.

Returns
AlignmentBase & operator= ( const AlignmentBase orig)

Assignment operator.

Parameters
orig
Returns
void saveClustal ( ostream &  output) const
virtual

Save as CLUSTAL like output.

Parameters
output
void saveFasta ( ostream &  output) const
virtual

Save as FASTA like output.

Parameters
output

Reimplemented in Alignment.

void setTemplate ( string  t,
string  tName = "template" 
)
virtual

Set template to t.

Parameters
t
tName
vector< int > shiftMatchSubset ( vector< int >  inputVector,
int  newStartPos 
)
virtual

Return a new vector with positions shifted, depending on new position.

Parameters
inputVector
newStartPos
Returns
void swapTemplate ( unsigned int  index1,
unsigned int  index2 
)
virtual

Swap templates index1 and index2.

Parameters
index1
index2

Reimplemented in Alignment.


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