75 void encodeCompositionVector(
const String & sequence, std::vector<std::pair<Int, double> > & encoded_vector,
const String & allowed_characters =
"ACDEFGHIKLMNPQRSTVWY");
86 void encodeCompositionVectors(
const std::vector<String> & sequences,
const String & allowed_characters, std::vector<std::vector<std::pair<Int, double> > > & composition_vectors);
88 svm_node * encodeLibSVMVector(
const std::vector<std::pair<Int, double> > & feature_vector);
91 void encodeLibSVMVectors(
const std::vector<std::vector<std::pair<Int, double> > > & feature_vectors, std::vector<svm_node *> & libsvm_vectors);
94 svm_problem * encodeLibSVMProblem(
const std::vector<svm_node *> & vectors,
95 std::vector<double> & labels);
98 svm_problem * encodeLibSVMProblemWithCompositionVectors(
const std::vector<String> & sequences,
99 std::vector<double> & labels,
100 const String & allowed_characters);
107 svm_problem * encodeLibSVMProblemWithCompositionAndLengthVectors(
const std::vector<String> & sequences,
108 std::vector<double> & labels,
109 const String & allowed_characters,
110 UInt maximum_sequence_length);
117 svm_problem * encodeLibSVMProblemWithCompositionLengthAndWeightVectors(
const std::vector<String> & sequences,
118 std::vector<double> & labels,
119 const String & allowed_characters);
122 bool storeLibSVMProblem(
const String & filename,
const svm_problem * problem)
const;
125 svm_problem * loadLibSVMProblem(
const String & filename);
128 void encodeOligoBorders(
String sequence,
130 const String & allowed_characters,
132 std::vector<std::pair<Int, double> > & libsvm_vector,
134 bool unpaired =
false,
135 bool length_encoding =
false);
138 svm_problem * encodeLibSVMProblemWithOligoBorderVectors(
const std::vector<String> & sequences,
139 std::vector<double> & labels,
141 const String & allowed_characters,
144 bool unpaired =
false,
145 bool length_encoding =
false);
148 void encodeProblemWithOligoBorderVectors(
const std::vector<AASequence> & sequences,
150 const String & allowed_characters,
152 std::vector<std::vector<std::pair<Int, double> > > & vectors);
160 void libSVMVectorToString(svm_node * vector,
String & output);
168 void libSVMVectorsToString(svm_problem * vector,
String & output);
178 const String & allowed_characters,
179 std::vector<std::pair<Int, double> > & values,
180 bool is_right_border =
false);
187 static void destroyProblem(svm_problem* &problem,
bool free_nodes =
true);
191 const String & allowed_characters =
"ACDEFGHIKLMNPQRSTVWY",
192 UInt maximum_sequence_length = 50)
194 std::vector<double> predicted_retention_times;
197 std::vector<double> temp_rts;
198 temp_rts.resize(sequences.size(), 0);
199 svm_problem * prediction_data =
203 maximum_sequence_length);
204 svm.
predict(prediction_data, predicted_retention_times);
206 return predicted_retention_times;
211 static bool cmpOligos_(std::pair<Int, double> a,
212 std::pair<Int, double> b);
A more convenient string class.
Definition: String.h:58
static void destroyProblem(svm_problem *&problem, bool free_nodes=true)
frees all the memory of the svm_problem instance
Serves as a wrapper for the libsvm.
Definition: SVMWrapper.h:83
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
svm_problem * encodeLibSVMProblemWithCompositionAndLengthVectors(const std::vector< String > &sequences, std::vector< double > &labels, const String &allowed_characters, UInt maximum_sequence_length)
creates composition vectors with additional length information for 'sequences' and stores them in Lib...
Serves for encoding sequences into feature vectors.
Definition: LibSVMEncoder.h:58
Representation of a peptide/protein sequence.
Definition: AASequence.h:111
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
static std::vector< double > predictPeptideRT(const std::vector< String > &sequences, SVMWrapper &svm, const String &allowed_characters="ACDEFGHIKLMNPQRSTVWY", UInt maximum_sequence_length=50)
Definition: LibSVMEncoder.h:189
void predict(struct svm_problem *problem, std::vector< double > &predicted_labels)
predicts the labels using the trained model