Victor
 All Data Structures Functions Variables Friends Pages
Alignment Class Reference

Implement a simple alignment type. More...

+ Inheritance diagram for Alignment:
+ Collaboration diagram for Alignment:

Public Member Functions

 Alignment ()
 Default constructor.
 
 Alignment (const Alignment &orig)
 Copy constructor.
 
virtual ~Alignment ()
 Destructor.
 
virtual void addAlignment (const Alignment &other)
 Combine two multiple sequence alignments of same target.
 
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.
 
virtual void copy (const Alignment &orig)
 Copy orig object to this object ("deep copy").
 
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...
 
virtual void doMatchPlusHeader (ostream &os, string headerTarget, int startTarget, int endTarget, string headerTemplate, int startTemplate, int endTemplate, string alignType, string gapOpen, string gapExtension, double pWeigth, double sWeigth, double tWeigth, string seqTarget, string seqTemplat) const
 
double getEvalue (unsigned int index=0) const
 Return E-value of template index.
 
unsigned int getLength ()
 Return length of alignment.
 
virtual vector< vector< int > > getMatchSubset ()
 
double getScore (unsigned int index=0) const
 Return score of template index.
 
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...
 
int getTrueMapFromPdb (istream &is, string startingChain, int structEntryMapCe)
 
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...
 
void loadBlastMode6 (istream &input)
 Read BLAST output produced with blast option -m 6 this stands for a convenient form of multiple sequence alignment.
 
void loadBlastMode6FullSeq (istream &input, string masterTarget)
 Read BLAST output produced with blast option -m 4 this stands for a convenient form of multiple sequence alignment (safe version).
 
void loadCE (istream &input)
 Read output of CE program.
 
void loadCEBody (istream &input)
 Read output of CE program. More...
 
void loadFasta (istream &input)
 
vector< vector< int > > loadMap (istream &is)
 Read map file and build a matrix 2*N .
 
void loadMSAF (istream &input)
 Read MSAF.
 
void loadPsiBlastMode4 (istream &input)
 Read BLAST output produced with blast option -m 4 this stands for a convenient form of multiple sequence alignment.
 
vector< int > mapStructureCE2Sequence (vector< vector< int > > mapIn, istream &pdbstream, string startingChain, vector< int > shiftedSeqresEntries)
 Return the first aminoacids on the sequence that match the first on CE.
 
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...
 
Alignmentoperator= (const Alignment &orig)
 Assignment operator.
 
void purgeTargetInsertions ()
 Delete all gaps from target and all templates.
 
virtual void RemoveLowerAll (double ID)
 
virtual void RemoveLowerSimple (double ID)
 
virtual void RemoveUpperAll (double ID)
 
virtual void RemoveUpperSimple (double ID)
 
virtual void saveClustal (ostream &output) const
 Save as CLUSTAL like output. More...
 
virtual void saveFasta (ostream &output) const
 Save as FASTA like output. More...
 
void saveMSAF (ostream &output) const
 Save as MSAF (Mannheim Sequence Alignment Format) like output. More...
 
void setEvalue (long double val, unsigned int index=0)
 Set E-value of template index.
 
void setScore (double val, unsigned int index=0)
 Set score of template index.
 
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", double tScore=0.0, double tEvalue=-1.0)
 Set template to t.
 
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

Implement a simple alignment type.

Member Function Documentation

void addAlignment ( const AlignmentBase orig)
virtualinherited

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

Calculate overall identity.

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

Calculate pairwise identity between seq1 and seq2.

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

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

Parameters
orig
void cutTemplate ( unsigned int  index)
virtual

Remove all templates below index.

Parameters
index

Reimplemented from AlignmentBase.

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

Delete n-th character.

Parameters
s
n
Returns
void deletePos ( unsigned int  p)
inherited

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

Parameters
p
void doMatchPlusHeader ( ostream &  os,
string  headerTarget,
int  startTarget,
int  endTarget,
string  headerTemplate,
int  startTemplate,
int  endTemplate,
string  alignType,
string  gapOpen,
string  gapExtension,
double  pWeigth,
double  sWeigth,
double  tWeigth,
string  seqTarget,
string  seqTemplate 
) const
virtual

Output of alignment including headers of the 2 sequences.

Parameters
os
headerTarget
startTarget
endTarget
headerTemplate
startTemplate
endTemplate
alignType
gapOpen
gapExtension
pWeigth
sWeigth
tWeigth
seqTarget
seqTemplate
vector< vector< int > > getMatchSubset ( )
virtualinherited

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

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

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

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

Return sequence without '-' characters.

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

Return length of seq.

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

Return vector of words of a line of text.

Parameters
text
Returns
int getTrueMapFromPdb ( istream &  is,
string  startingChain,
int  structEntryMapCe 
)

Companion function to the previous: check if SEQRES and ATOM in pdb entry are the same otherwise it returns the correct enumeration based on ATOM.

void insertCharacter ( unsigned int  p,
char  c 
)
inherited

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

Parameters
p
c
void insertDash ( unsigned int  p)
inherited

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

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

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

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

Check for deletion at position p.

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

Check for gap at position p.

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

Check for insertion at position p.

Parameters
p
index
Returns
void loadCEBody ( istream &  input)

Read output of CE program.

Parameters
input
void loadFasta ( istream &  input)

Read FASTA format input.

Parameters
input
double matchPositionVector ( vector< int >  CeTarget,
vector< int >  CeTemplate,
vector< int >  seqTarget,
vector< int >  seqTemplate 
)
virtualinherited

Companion class to the previous.

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

Construct a new "deep copy" of this object.

Returns
void RemoveLowerAll ( double  ID)
virtual

For removing templates with identity lower than x (between 0 and 1); this compare all with all.

void RemoveLowerSimple ( double  ID)
virtual

For removing templates with identity lower than x (between 0 and 1); this compare only the first with the others.

void RemoveUpperAll ( double  ID)
virtual

For removing templates with identity upper than x (between 0 and 1); this compare all with all.

void RemoveUpperSimple ( double  ID)
virtual

For removing templates with identity upper than x (between 0 and 1); this compare only the first with the others.

void saveClustal ( ostream &  output) const
virtualinherited

Save as CLUSTAL like output.

Parameters
output
void saveFasta ( ostream &  output) const
virtual

Save as FASTA like output.

Parameters
output

Reimplemented from AlignmentBase.

void saveMSAF ( ostream &  output) const

Save as MSAF (Mannheim Sequence Alignment Format) like output.

Parameters
output
void setTemplate ( string  t,
string  tName = "template" 
)
virtualinherited

Set template to t.

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

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


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