-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrim_seqs.cpp
32 lines (31 loc) · 1.01 KB
/
trim_seqs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "peptide.cpp"
//implement main
int main() {
try {
std::string whitespace("\\s");
InputData input;
std::vector<std::string> prots;
input.next_into_str_vector(prots, whitespace);
std::vector<std::size_t> spectrum;
input.next_into_int_type_vector<std::size_t>(spectrum, whitespace);
std::size_t N = input.next_as_int_type<std::size_t>();
std::vector<Peptide> leaders;
std::map<Peptide, std::size_t> scores;
for(std::size_t i=0; i<prots.size();i++){
Peptide p = Peptide(prots[i]);
std::size_t score = p.score_spectrum(spectrum);
scores[p] = score;
leaders.push_back(p);
}
trim_leaderboard(leaders,spectrum,scores,N);
std::cout<<Peptide::pep_container_to_string(leaders.begin(), leaders.end(), " ")<<std::endl;
return 0;
} catch(std::exception& e){
std::cerr << "\nException occurred: " << std::endl << std::flush;
std::cerr << e.what() << std::endl << std::flush;
std::exit(-1);
} catch(...) {
std::cerr << "\nUnexpected Exception" << std::endl << std::flush;
std::exit(-1);
}
}