Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PValuedFragmentScoreManager.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite && is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/frag_picker/scores/PValuedFragmentScoreManager.cc
11 /// @brief
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
14 
15 // package headers
17 // AUTO-REMOVED #include <protocols/frag_picker/scores/CachingScoringMethod.hh>
19 // AUTO-REMOVED #include <protocols/frag_picker/FragmentPicker.hh>
23 
25 
26 // AUTO-REMOVED #include <utility/io/izstream.hh>
27 
28 // C++
29 #include <algorithm>
30 // AUTO-REMOVED #include <utility>
31 
32 #include <utility/vector1.hh>
33 
34 
35 namespace protocols {
36 namespace frag_picker {
37 namespace scores {
38 
39 /// @brief print the scores and associated p-values
42  std::ostream& out) {
43 
44  using namespace ObjexxFCL::fmt;
45 
46  out << "#" << RJ(10, "query_pos ");
47  out << RJ(10, "vall_pos ");
48  out << RJ(6, "pdbid");
49  out << " c ss ";
50  utility::vector1<Size> w(scores_.size()*2+2);
51  for (Size i = 1; i <= scores_.size(); i++) {
52  w[i*2 - 1] = width_.find(scores_[i])->second;
53  out << " " << scores_[i]->get_score_name();
54  if (scores_[i]->get_score_name().length() > w[i*2 - 1])
55  w[i*2 - 1] = scores_[i]->get_score_name().length();
56  w[i*2] = width_.find(scores_[i])->second;
57  out << " p_" << scores_[i]->get_score_name();
58  if (scores_[i]->get_score_name().length() + 2 > w[i*2])
59  w[i*2] = scores_[i]->get_score_name().length() + 2;
60  }
61  w[scores_.size()*2+1] = 7; // 7 characters for the total score
62  w[scores_.size()*2+2] = 7; // 7 characters for the total p-value
63  out << " TOTAL p-TOTAL FRAG_ID"<<std::endl;
64 
65  for (Size iF = 1; iF <= pairs.size(); ++iF) {
66 
67  FragmentCandidateOP fr = pairs[iF].first;
68  FragmentScoreMapOP sc = pairs[iF].second;
69 
70  out << " " << I(10, fr->get_first_index_in_query());
71  out << " " << I(10, fr->get_first_index_in_vall());
72  out << " " << RJ(5, fr->get_pdb_id());
73  out << " " << fr->get_chain_id();
74  out << " " << fr->get_middle_ss();
75  Real p_val_sum = 0.0;
76  for (Size i = 1; i <= scores_.size(); i++) {
77  Size p = precision_.find(scores_[i])->second;
78  out << " " << F(w[i*2-1], p, sc->get_score_components()[i]);
79  out << " " << F(w[i*2], 3, statistics_[fr->get_first_index_in_query()][i]->p_value(sc->get_score_components()[i]));
80  p_val_sum += statistics_[fr->get_first_index_in_query()][i]->p_value(sc->get_score_components()[i]);
81  }
82  out << F(w[scores_.size()*2+1],TOTAL_PRECISION,total_score(sc));
83  out << F(w[scores_.size()*2+2],TOTAL_PRECISION,p_val_sum);
84 
85  out << I(10, fr->key() ) << std::endl;
86  }
87 }
88 
89 
91  FragmentScoreMapOP empty_map) {
92 
93  FragmentScoreManager::score_fragment(candidate,empty_map);
94 
95  Size pos = candidate->get_first_index_in_query();
96  if(statistics_.size() < pos) {
97  Size size_is = statistics_.size();
98  statistics_.resize( pos );
99  for(Size k=size_is+1;k<=pos;k++) {
100  for(Size l=1;l<=scores_.size();l++)
101  statistics_[k].push_back(new AdaptiveScoreHistogram(0.01,1));
102  }
103  }
104  for (Size iScore = 1; iScore <= empty_map->size(); iScore++) {
105  statistics_[pos][iScore]->insert( empty_map->at(iScore) );
106  }
107 
108  return true;
109 }
110 
112  FragmentScoreMapOP empty_map) {
113 
115 
116  Size pos = candidate->get_first_index_in_query();
117  if(statistics_.size() < pos) {
118  Size size_is = statistics_.size();
119  statistics_.resize( pos );
120  for(Size k=size_is+1;k<=pos;k++) {
121  for(Size l=1;l<=scores_.size();l++)
122  statistics_[k].push_back(new AdaptiveScoreHistogram(0.01,1));
123  }
124  }
125 
126  for (Size iScore = 1; iScore <= empty_map->size(); iScore++) {
127  statistics_[pos][iScore]->insert( empty_map->at(iScore) );
128  }
129 
130  return true;
131 }
132 
133 
134 } // scores
135 } // frag_picker
136 } // protocols
137 
138