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