Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types

SuffixArraySeqan Class Reference

Class that uses SEQAN library for a suffix array. It can be used to find peptide Candidates for a MS spectrum. More...

#include <OpenMS/DATASTRUCTURES/SuffixArraySeqan.h>

Inheritance diagram for SuffixArraySeqan:
SuffixArray WeightWrapper SuffixArrayTrypticSeqan

List of all members.

Public Member Functions

 SuffixArraySeqan (const String &st, const String &filename, const WeightWrapper::WEIGHTMODE weight_mode=WeightWrapper::MONO)
 constructor
 SuffixArraySeqan (const SuffixArraySeqan &source)
 copy constructor
virtual ~SuffixArraySeqan ()
 destructor
String toString ()
 converts suffix array to a printable string
void findSpec (std::vector< std::vector< std::pair< std::pair< SignedSize, SignedSize >, DoubleReal > > > &candidates, const std::vector< DoubleReal > &spec)
 the function that will find all peptide candidates for a given spectrum
bool save (const String &filename)
 saves the suffix array to disc
bool open (const String &filename)
 opens the suffix array
void setTolerance (DoubleReal t)
 setter for tolerance
DoubleReal getTolerance () const
 getter for tolerance
bool isDigestingEnd (const char aa1, const char aa2) const
 returns if an enzyme will cut after first character
void setTags (const std::vector< OpenMS::String > &tags)
 setter for tags
const std::vector
< OpenMS::String > & 
getTags ()
 getter for tags
void setUseTags (bool use_tags)
 setter for use_tags
bool getUseTags ()
 getter for use_tags
void setNumberOfModifications (Size number_of_mods)
 setter for number of modifications
Size getNumberOfModifications ()
 getter for number of modifications
void printStatistic ()

Protected Member Functions

void goNextSubTree_ (TIter &it, DoubleReal &m, std::stack< DoubleReal > &allm, std::stack< std::map< DoubleReal, SignedSize > > &mod_map)
 overwriting goNextSubTree_ from seqan index_esa_stree.h for mass update during suffix array traversal
void goNextSubTree_ (TIter &it)
 goes to the next sub tree
void goNext_ (TIter &it, DoubleReal &m, std::stack< DoubleReal > &allm, std::stack< std::map< DoubleReal, SignedSize > > &mod_map)
 overwriting goNext from seqan index_esa_stree.h for mass update during suffix array traversal
void parseTree_ (TIter &it, std::vector< std::pair< SignedSize, SignedSize > > &out_number, std::vector< std::pair< SignedSize, SignedSize > > &edge_length, std::vector< SignedSize > &leafe_depth)
SignedSize findFirst_ (const std::vector< DoubleReal > &spec, DoubleReal &m)
 binary search for finding the index of the first element of the spectrum that matches the desired mass within the tolerance.
SignedSize findFirst_ (const std::vector< DoubleReal > &spec, DoubleReal &m, SignedSize start, SignedSize end)
 binary search for finding the index of the first element of the spectrum that matches the desired mass within the tolerance. it searches recursivly.

Protected Attributes

TIndex index_
 seqan suffix array
TIterit_
 seqan suffix array iterator
const Strings_
 reference to strings for which the suffix array is build
DoubleReal masse_ [255]
 amino acid masses
SignedSize number_of_modifications_
 number of allowed modifications
std::vector< Stringtags_
 all tags
bool use_tags_
 if tags are used
DoubleReal tol_
 tolerance

Private Types

typedef seqan::TopDown
< seqan::ParentLinks<> > 
TIterSpec
typedef seqan::Index
< seqan::String< char >
, seqan::IndexEsa< TIterSpec > > 
TIndex
typedef seqan::Iter< TIndex,
seqan::VSTree< TIterSpec > > 
TIter

Detailed Description

Class that uses SEQAN library for a suffix array. It can be used to find peptide Candidates for a MS spectrum.

This class uses SEQAN suffix array. It can just be used for finding peptide Candidates for a given MS Spectrum within a certain mass tolerance. The suffix array can be saved to disc for reused so it has to be build just once.


Member Typedef Documentation

typedef seqan::Index<seqan::String<char>, seqan::IndexEsa<TIterSpec> > TIndex [private]
typedef seqan::Iter<TIndex, seqan::VSTree<TIterSpec> > TIter [private]
typedef seqan::TopDown<seqan::ParentLinks<> > TIterSpec [private]

Constructor & Destructor Documentation

SuffixArraySeqan ( const String st,
const String filename,
const WeightWrapper::WEIGHTMODE  weight_mode = WeightWrapper::MONO 
)

constructor

Parameters:
st const string reference with the string for which the suffix array should be build
filename const string reference with filename for opening or saving the suffix array
weight_mode if not monoistopic weight should be used, this parameters can be set to AVERAGE
Exceptions:
FileNotFound is thrown if the given file is not found
InvalidValue if the given suffix array string is invalid
SuffixArraySeqan ( const SuffixArraySeqan source  ) 

copy constructor

virtual ~SuffixArraySeqan (  )  [virtual]

destructor


Member Function Documentation

SignedSize findFirst_ ( const std::vector< DoubleReal > &  spec,
DoubleReal m 
) [protected]

binary search for finding the index of the first element of the spectrum that matches the desired mass within the tolerance.

Parameters:
spec const reference to spectrum
m mass
Returns:
SignedSize with the index of the first occurence
Note:
requires that there is at least one occurence
SignedSize findFirst_ ( const std::vector< DoubleReal > &  spec,
DoubleReal m,
SignedSize  start,
SignedSize  end 
) [protected]

binary search for finding the index of the first element of the spectrum that matches the desired mass within the tolerance. it searches recursivly.

Parameters:
spec const reference to spectrum
m mass
start start index
end end index
Returns:
SignedSize with the index of the first occurence
Note:
requires that there is at least one occurence
void findSpec ( std::vector< std::vector< std::pair< std::pair< SignedSize, SignedSize >, DoubleReal > > > &  candidates,
const std::vector< DoubleReal > &  spec 
)

the function that will find all peptide candidates for a given spectrum

Parameters:
spec const reference of DoubleReal vector describing the spectrum
candidates output parameters which holds the candidates of the masses given in spec after call
Returns:
a vector of SignedSize pairs.

for every mass within the spectrum all candidates described by as pairs of ints are returned. All masses are searched for the same time in just one suffix array traversal. In order to accelerate the traversal the skip and lcp table are used. The mass wont be calculated for each entry but it will be updated during traversal using a stack datastructure

Size getNumberOfModifications (  ) 

getter for number of modifications

Returns:
number of modifications
const std::vector<OpenMS::String>& getTags (  ) 

getter for tags

Returns:
const reference to vector of strings
DoubleReal getTolerance (  )  const

getter for tolerance

Returns:
DoubleReal with tolerance
bool getUseTags (  ) 

getter for use_tags

Returns:
bool indicating whether tags are used or not
void goNext_ ( TIter it,
DoubleReal m,
std::stack< DoubleReal > &  allm,
std::stack< std::map< DoubleReal, SignedSize > > &  mod_map 
) [inline, protected]

overwriting goNext from seqan index_esa_stree.h for mass update during suffix array traversal

the suffix array is treated as a suffix tree. this function goes to the next node that has not been visited yet. During this traversal the mass will be updated using the stack with edge masses.

Parameters:
it reference to the suffix array iterator
m reference to actual mass
allm reference to the stack with history of traversal
mod_map input parameters which specifies the modification masses allowed in the candidates
See also:
goNextSubTree_
void goNextSubTree_ ( TIter it  )  [inline, protected]

goes to the next sub tree

Parameters:
it reference to the suffix array iterator
See also:
goNext
void goNextSubTree_ ( TIter it,
DoubleReal m,
std::stack< DoubleReal > &  allm,
std::stack< std::map< DoubleReal, SignedSize > > &  mod_map 
) [inline, protected]

overwriting goNextSubTree_ from seqan index_esa_stree.h for mass update during suffix array traversal

the suffix array is treated as a suffix tree. this function skips the subtree under the actual node and goes directly to the next subtree that has not been visited yet. During this traversal the mass will be updated using the stack with edge masses.

Parameters:
it reference to the suffix array iterator
m reference to actual mass
allm reference to the stack with history of traversal
mod_map input parameters which specifies the modification massen allowed in the candidates
See also:
goNext
bool isDigestingEnd ( const char  aa1,
const char  aa2 
) const

returns if an enzyme will cut after first character

Parameters:
aa1 const char as first aminoacid
aa2 const char as second aminoacid
Returns:
bool descibing if it is a digesting site

Reimplemented in SuffixArrayTrypticSeqan.

bool open ( const String filename  ) 

opens the suffix array

Parameters:
filename const reference string describing the filename
Returns:
bool if operation was succesful
Exceptions:
FileNotFound is thrown if the given file could not be found
void parseTree_ ( TIter it,
std::vector< std::pair< SignedSize, SignedSize > > &  out_number,
std::vector< std::pair< SignedSize, SignedSize > > &  edge_length,
std::vector< SignedSize > &  leafe_depth 
) [inline, protected]
void printStatistic (  ) 
bool save ( const String filename  ) 

saves the suffix array to disc

Parameters:
filename const reference string describing the filename
Returns:
bool if operation was succesful
Exceptions:
UnableToCreateFile is thrown if the output files could not be created
void setNumberOfModifications ( Size  number_of_mods  ) 

setter for number of modifications

Parameters:
number_of_mods 
void setTags ( const std::vector< OpenMS::String > &  tags  ) 

setter for tags

Parameters:
tags reference to vector of strings with tags
Note:
sets use_tags = true
void setTolerance ( DoubleReal  t  ) 

setter for tolerance

Parameters:
t DoubleReal with tolerance, only 0 or greater is allowed
Exceptions:
InvalidValue is thrown if given tolerance is negative
void setUseTags ( bool  use_tags  ) 

setter for use_tags

Parameters:
use_tags indicating whether tags should be used or not
String toString (  ) 

converts suffix array to a printable string


Member Data Documentation

TIndex index_ [protected]

seqan suffix array

TIter* it_ [protected]

seqan suffix array iterator

DoubleReal masse_[255] [protected]

amino acid masses

number of allowed modifications

const String& s_ [protected]

reference to strings for which the suffix array is build

std::vector<String> tags_ [protected]

all tags

DoubleReal tol_ [protected]

tolerance

bool use_tags_ [protected]

if tags are used


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1