26 #include <basic/options/option.hh>
27 #include <basic/options/keys/OptionKeys.hh>
28 #include <basic/options/keys/in.OptionKeys.gen.hh>
30 #include <basic/Tracer.hh>
34 #include <ObjexxFCL/FArray1D.hh>
35 #include <basic/prof.hh>
38 #include <utility/vector1.hh>
49 namespace frag_picker {
52 using namespace basic::options;
53 using namespace basic::options::OptionKeys;
55 static basic::Tracer
tr(
56 "protocols.frag_picker.scores.PhiPsiSquareWell");
62 Size n_atoms_ = reference_pose->total_residue();
68 for (
Size i = 1; i <= n_atoms_; ++i) {
91 for (
Size i = 1; i <= n_atoms_; ++i) {
95 tr.Warning <<
"Lack of data for position " << i
100 if ( (reader.
quality(i) ==
"Warn")
101 || (reader.
quality(i) ==
"Dyn")
102 || (reader.
quality(i) ==
"None") ) {
104 tr.Info <<
"Untrustworthy data at position " << i <<
" due to prediction class " << reader.
quality(i)
111 if ((reader.
phi(i) > 181) || (reader.
phi(i) < -181)
112 || (reader.
psi(i) > 181) || (reader.
psi(i) < -181)) {
115 <<
"Unphysical Phi/Psi observation at position " << i
130 chunk_phi_.redimension(current_chunk->size());
131 chunk_psi_.redimension(current_chunk->size());
132 for (
Size i = 1; i <= current_chunk->size(); ++i) {
142 return score(fragment, scores);
201 PROF_START( basic::FRAGMENTPICKING_PHIPSI_SCORE );
202 Size offset_q = fragment->get_first_index_in_query() - 1;
203 Size offset_v = fragment->get_first_index_in_vall() - 1;
209 values.resize(fragment->get_length());
211 for (
Size i = 1; i < fragment->get_length(); ++i) {
219 tmp = std::abs(r->phi() -
query_phi_(i + offset_q));
221 if ( tmp > 180.0 ) tmp = std::abs(tmp - 360.0);
232 d += 1 / ( 1 + exp( -5*( tmp /
query_d_phi_(i + offset_q) ) + 5) );
235 tmp = std::abs(r->psi() -
query_psi_(i + offset_q));
237 if ( tmp > 180.0 ) tmp = std::abs(tmp - 360.0);
246 d += 1 / ( 1 + exp( -5*( tmp /
query_d_psi_(i + offset_q) ) + 5) );
249 values[i] = std::sqrt(d);
255 std::sort( values.begin(), values.end() );
258 for (
Size i = 1; i <= fragment->get_length(); i++) {
260 Real sigmoid_weight( 1 / ( 1 + exp( (10*( (
Real) i ) / fragment->get_length()) - 7 ) ) );
262 score += sigmoid_weight*values[i];
266 score = score / ((
Real) fragment->get_length());
267 PROF_STOP( basic::FRAGMENTPICKING_PHIPSI_SCORE );
269 scores->set_score_component(score,
id_);
294 if (input_file !=
"") {
295 Size pos = input_file.find(
".pdb");
296 if (pos != std::string::npos) {
300 <<
"Reference file for Phi,Psi scoring loaded from "
301 << input_file << std::endl;
302 tr.Debug <<
"its sequence is:\n"
303 << nativePose->sequence() << std::endl;
306 lowest_acceptable_value, use_lowest, nativePose);
308 pos = input_file.find(
".tab");
309 if (pos != std::string::npos) {
311 <<
"Reference file for Phi,Psi scoring loaded from a TALOS file: "
312 << input_file << std::endl;
316 lowest_acceptable_value, use_lowest, in);
320 if (option[in::file::talos_phi_psi].user()) {
322 <<
"Reference file for Phi,Psi scoring loaded from a TALOS file: "
323 << input_file << std::endl;
327 lowest_acceptable_value, use_lowest, in);
329 if (option[in::file::s].user()) {
332 tr.Info <<
"Reference file for Phi,Psi scoring loaded from "
333 << option[in::file::s]()[1] << std::endl;
334 tr.Debug <<
"its sequence is:\n"
335 << nativePose->sequence() << std::endl;
338 lowest_acceptable_value, use_lowest, nativePose);
340 if (option[in::file::native].user()) {
343 tr.Info <<
"Reference file for Phi,Psi scoring loaded from "
344 << option[in::file::native]() << std::endl;
345 tr.Debug <<
"its sequence is:\n"
346 << nativePose->sequence() << std::endl;
349 lowest_acceptable_value, use_lowest, nativePose);
352 utility_exit_with_message(
353 "Can't read a reference Phi,Psi data. Provide a structure with in::file::s flag\n\t or a Phi-Psi prediction in TALOS format.");