21 #include <utility/io/ozstream.hh>
25 #include <basic/options/option.hh>
26 #include <basic/options/keys/OptionKeys.hh>
27 #include <basic/options/keys/in.OptionKeys.gen.hh>
28 #include <basic/options/keys/frags.OptionKeys.gen.hh>
33 #include <boost/tuple/tuple.hpp>
36 #include <basic/Tracer.hh>
39 #include <utility/vector1.hh>
43 namespace frag_picker {
46 using namespace basic::options;
47 using namespace basic::options::OptionKeys;
50 "protocols.frag_picker.scores.CSScore");
65 trCSScore.Debug <<
"READING SHIFTS!" << std::endl;
66 CS2ndShift secondary_shift_calculator(reader,
true);
67 trCSScore.Debug <<
"SHOULD BE DONE WRITING 2nd SHIFTS" << std::endl;
83 trCSScore.Debug <<
"caching CS score for " << current_chunk->get_pdb_id()
84 <<
" of size " << current_chunk->size() << std::endl;
94 std::pair< Real, Real > empty(0,0);
100 Real a( option[frags::sigmoid_cs_A]() );
101 Real b( option[frags::sigmoid_cs_B]() );
108 for (
Size i = 1; i <= current_chunk->size(); ++i) {
111 for (
Size d = 1; d <= query_residue_shifts.size(); ++d) {
120 Size q_shift_type(query_residue_shifts[d].first);
121 Real q_shift(query_residue_shifts[d].second);
128 if ( res->secondary_shifts().size() < q_shift_type*2 ) {
129 trCSScore.Debug <<
"Chunk has not enough secondary shifts to perform this query at position "
130 << i <<
" " << std::endl
131 <<
"pdb_id: " << current_chunk->get_pdb_id() << std::endl
132 <<
"chain_id: " << current_chunk->get_chain_id() << std::endl
133 <<
"sequence: " << current_chunk->get_sequence() << std::endl;
137 Real v_shift(res->secondary_shifts()[(q_shift_type*2)-1]);
139 Real v_sigma(res->secondary_shifts()[ q_shift_type*2 ]);
144 Real sig_diff(std::abs((q_shift - v_shift) / v_sigma ));
145 Real sigmoid_diff( 1 / ( 1 + exp((-a*sig_diff)+b) ) );
167 if ( ( count == 0 ) && ( query_residue_shifts.size() != 0 ) ) {
175 tmp = ( tmp / count ) * query_residue_shifts.size();
178 temp[i][r].first = tmp;
179 temp[i][r].second = count;
187 trCSScore.Debug <<
"caching CS score for " << current_chunk->get_pdb_id()
188 <<
" of size " << current_chunk->size()
189 <<
". The matrix is: "<<
scores_.size()<<
" x "<<
scores_[1].size()<<std::endl;
198 std::string & tmp = fragment->get_chunk()->chunk_key();
208 Real totalScore = 0.0;
209 Real totalCount = 0.0;
211 for (
Size i = 1; i <= fragment->get_length(); i++) {
212 runtime_assert(fragment->get_first_index_in_vall() + i - 1 <=
scores_.size());
213 runtime_assert(fragment->get_first_index_in_query() + i - 1 <=
scores_[1].size());
216 std::pair< Real, Real> tmp =
scores_[fragment->get_first_index_in_vall() + i - 1]
217 [fragment->get_first_index_in_query() + i - 1];
222 totalScore += tmp.first;
223 totalCount += tmp.second;
228 totalScore /= (
Real) fragment->get_length();
230 scores->set_score_component(totalScore,
id_);
245 if (option[in::file::talos_cs].user()) {
246 CSTalosIO in(option[in::file::talos_cs]());
249 lowest_acceptable_value, use_lowest,in);
252 utility_exit_with_message(
253 "Can't read CS data. Provide a chemical shifts file in TALOS format.");