00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENMS_DATASTRUCTURES_SUFFIXARRAYTRYPTICCOMPRESSED_H
00029 #define OPENMS_DATASTRUCTURES_SUFFIXARRAYTRYPTICCOMPRESSED_H
00030
00031 #include <OpenMS/CONCEPT/Exception.h>
00032 #include <OpenMS/DATASTRUCTURES/SuffixArray.h>
00033
00034
00035 namespace OpenMS {
00036 class String;
00037
00045 class SuffixArrayTrypticCompressed : public SuffixArray {
00046
00047 public:
00048
00057 SuffixArrayTrypticCompressed(const String& st, const String& sa_file_name) throw (Exception::InvalidValue, Exception::FileNotFound);
00058
00062 SuffixArrayTrypticCompressed(const SuffixArrayTrypticCompressed & sa);
00063
00067 virtual ~SuffixArrayTrypticCompressed();
00068
00072 String toString();
00073
00082 void findSpec(std::vector<std::vector<std::pair<std::pair<int, int>, float > > >& candidates, const std::vector<double> & spec) throw (Exception::InvalidValue);
00083
00090 bool save(const String& file_name) throw (Exception::UnableToCreateFile);
00097 bool open(const String& file_name) throw (Exception::FileNotFound);
00098
00104 void setTolerance(double t) throw (Exception::InvalidValue);
00105
00110 double getTolerance() const;
00111
00118 bool isDigestingEnd(const char aa1, const char aa2) const;
00119
00125 void setTags(const std::vector<String>& tags) throw (Exception::InvalidValue);
00126
00131 const std::vector<String>& getTags ();
00132
00137 void setUseTags(bool use_tags);
00138
00143 bool getUseTags();
00144
00149 void setNumberOfModifications(unsigned int number_of_mods);
00150
00155 unsigned int getNumberOfModifications ();
00156
00160 void printStatistic ();
00161
00162 protected:
00163
00167 SuffixArrayTrypticCompressed();
00168
00174 int getNextSep_(const int p) const;
00175
00182 int getLCP_(const std::pair<int, int>& last_point, const std::pair<int, int>& current_point);
00183
00191 int findFirst_(const std::vector<double>& spec, double& m);
00192
00202 int findFirst_(const std::vector<double>& spec, double& m, int start, int end);
00203
00216 void parseTree_(int start_index, int stop_index, int depth, int walked_in, int edge_len, std::vector<std::pair<int,int> >& out_number, std::vector<std::pair<int,int> >& edge_length, std::vector<int>& leafe_depth);
00217
00224 bool hasMoreOutgoings_(int start_index, int stop_index, int walked_in);
00225
00226 const String& s_;
00227
00228 double tol_;
00229
00230 std::vector<std::pair<int,int> > indices_;
00231
00232 std::vector<int> lcp_;
00233
00234 std::vector<int> skip_;
00235
00236
00237
00238 double masse_[256];
00239
00240 int number_of_modifications_;
00241
00242 std::vector<String> tags_;
00243
00244 bool use_tags_ ;
00245
00246 int progress_;
00247 };
00248 }
00249
00250 #endif //OPENMS_DATASTRUCTURES_SUFFIXARRAYTRYPTICCOMPRESSED_H