ppALIGN API documentation

Align Class Reference

#include <align.hpp>

List of all members.

Classes

class  GapsAlignedError

Public Types

typedef std::vector< AlignEntryparent_t

Public Member Functions

 Align ()
 Align (const std::string &str)
 Align (const Sequence &s1, const Sequence &s2, Pair startPos=Pair(0, 0))
void SetStartPos (Pair p)
void push_back (const AlignEntry &v)
void push_back (long i, long j)
Pair FirstPair () const
Pair LastPair () const
Pair SeqOffset () const
Pair SeqEnd () const
Alignment analysis



int Score (const Sequence::const_iterator &first_begin, const Sequence::const_iterator &second_begin, const ScoreMatrix &scoreMatrix, int gap_open, int gap_extension, bool local=false) const
int Score (const Sequence &s1, const Sequence &s2, const ScoreMatrix &scoreMatrix, int gap_open, int gap_extension, bool local=false) const
int Gaps () const
int Identity (const Sequence &s1, const Sequence &s2) const
int Positive (const Sequence &s1, const Sequence &s2, const ScoreMatrix &s) const
Pair MakeLocal (Sequence &seq1, Sequence &seq2)
Pair MakeLocal (Align &align, Sequence &seq1, Sequence &seq2, long offset=0) const

Friends

std::ostream & operator<< (std::ostream &ost, const Align &a)

Detailed Description

A sequence of alignment states.

Examples:

alternative_alignments.cpp.

Definition at line 189 of file align.hpp.


Member Typedef Documentation

typedef std::vector<AlignEntry> Align::parent_t

The parent type std::vector<value_type>

Definition at line 196 of file align.hpp.


Constructor & Destructor Documentation

Align::Align (  )  [inline]

Constructor. construct an empty alignment.

Definition at line 220 of file align.hpp.

Align::Align ( const std::string &  str  ) 

Constructor. Constructs an alignment from a sequence of states.

Parameters:
str string of states (M, I or D for Match, Insertion or Deletion)
Align::Align ( const Sequence s1,
const Sequence s2,
Pair  startPos = Pair(0, 0) 
)

Constructor. Constructs an alignment from a pair of sequences s1 and s2 and the starting position in startPos. The sequences s1 and s2 may contain the gap symbol. The startPos is an offset that is added to each AlignEntry::pair. The alignment can be constructed as

   DnaSequence seq1("AAGG--GTCT");
   DnaSequence seq2("AAGGCCGT-T");
   Align align(seq1,seq2);
Parameters:
s1 first sequence
s2 second sequence
startPos offset of the alignment, if the alignment is local.

Member Function Documentation

Pair Align::FirstPair (  )  const [inline]

First match. Determine the positions of the first match state in the sequences

Returns:
a Pair object of sequence coordinates

Definition at line 283 of file align.hpp.

int Align::Gaps (  )  const [inline]
Returns:
number of gaps

Definition at line 393 of file align.hpp.

Pair Align::LastPair (  )  const [inline]

Last match. Determine the positions of the first match state in the sequences

Returns:
a Pair object of sequence coordinates

Definition at line 296 of file align.hpp.

Pair Align::MakeLocal ( Align align,
Sequence seq1,
Sequence seq2,
long  offset = 0 
) const

Transforms the alignment to a local alignment.

Like MakeLocal(Sequence & seq1, Sequence & seq2) but the alignment is not changed. Instead a copy of the aligned part of the alignment is returned to align. This is an alignment of the modified sequences

Parameters:
[out] align alignment where padding states
[in,out] seq1 sequence
[in,out] seq2 sequence
Returns:
first pair of the original sequences
Pair Align::MakeLocal ( Sequence seq1,
Sequence seq2 
)

Transforms the alignment to a local alignment.

Removes padding parts of the alignment and removes unaligned part of the sequences.

Parameters:
[in,out] seq1 sequence
[in,out] seq2 sequence
Returns:
first pair of the original sequences
int Align::Positive ( const Sequence s1,
const Sequence s2,
const ScoreMatrix s 
) const [inline]
Returns:
number of positive scoring pairs

Definition at line 416 of file align.hpp.

void Align::push_back ( long  i,
long  j 
) [inline]

Extend the alignment. Extend the alignment by one pair or gap.

  • If i>=0 and j >=0 a pair is added
  • If i=-1 and j >=0 an inseration is added
  • If i>=0 and j =-1 a deletion is added.
Parameters:
i position in the first sequence
j position in the second sequence

Definition at line 276 of file align.hpp.

void Align::push_back ( const AlignEntry v  )  [inline]

Extend the alignment by a pair or a gap.

  • If v.i>=0 and v.j >=0 a pair is added
  • If v.i=-1 and v.j >=0 an inseration is added
  • If v.i>=0 and v.j =-1 a deletion is added.
    Parameters:
    v entry

Definition at line 263 of file align.hpp.

int Align::Score ( const Sequence s1,
const Sequence s2,
const ScoreMatrix scoreMatrix,
int  gap_open,
int  gap_extension,
bool  local = false 
) const [inline]

Compute the score of the alignment for an affine gap cost model.

Parameters:
s1 first sequence
s2 second sequence
scoreMatrix score matrix
gap_open costs to open a gap
gap_extension costs to extend a gap
local if true compute only the local score (from the first match to the last match)
Returns:
score of the alignment

Definition at line 376 of file align.hpp.

int Align::Score ( const Sequence::const_iterator &  first_begin,
const Sequence::const_iterator &  second_begin,
const ScoreMatrix scoreMatrix,
int  gap_open,
int  gap_extension,
bool  local = false 
) const

Compute the score of the alignment for an affine gap cost model.

Parameters:
first_begin iterator of the starting point in the first sequence
second_begin iterator of the starting point in the second sequence
scoreMatrix score matrix
gap_open costs to open a gap
gap_extension costs to extend a gap
local if true compute only the local score (from the first match to the last match)
Returns:
score of the alignment
Pair Align::SeqEnd (  )  const [inline]

Last positions in sequence coordinates. Let Pair ppair = a.SeqOffset(). pair.i is the index in the first sequence directly after the alignment.

Returns:
last positions in the sequences.

Definition at line 328 of file align.hpp.

Pair Align::SeqOffset (  )  const [inline]

Starting positions in sequence coordinates.

Returns:
starting positions in the sequences.

Definition at line 309 of file align.hpp.

void Align::SetStartPos ( Pair  p  ) 

Set start position in the sequence position. Iterate throught the alignment and add the offsets p.i and p.j to all pairs and gaps.

Parameters:
p positions in the sequences

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ost,
const Align a 
) [friend]

write sequence of states in forward direction


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