21 #include <ObjexxFCL/FArray1A.hh>
22 #include <utility/io/izstream.hh>
24 #include <numeric/random/random.fwd.hh>
25 #include <utility/exit.hh>
33 #include <basic/Tracer.hh>
35 #include <utility/vector1.hh>
39 namespace ObjexxFCL { }
using namespace ObjexxFCL;
43 static basic::Tracer
TR(
"protocols.frags.VallData" );
58 utility::io::izstream data ( filename );
60 utility_exit_with_message(
"cant open vall file: " + filename );
66 bool const new_format( filename.find(
"trimmed" ) != std::string::npos );
73 data.getline( line, 250 );
74 if ( data.eof() )
break;
76 std::sscanf( line ,
"%1c", &seq);
77 std::sscanf( line+ 1,
"%1c", &ss);
80 std::sscanf( line+ 2,
"%9f", &phi);
81 std::sscanf( line+11,
"%9f", &psi);
82 std::sscanf( line+20,
"%9f", &omega);
84 add_line( seq, ss, phi, psi, omega );
91 data.getline( line, 250 );
92 if ( data.eof() )
break;
94 std::sscanf( line+6 ,
"%1c", &seq);
95 std::sscanf( line+8 ,
"%1c", &ss);
97 std::sscanf( line+52,
"%9f", &phi);
98 std::sscanf( line+61,
"%9f", &psi);
99 std::sscanf( line+70,
"%9f", &omega);
101 add_line( seq, ss, phi, psi, omega );
132 Real const seq_weight,
133 Real const ss_weight,
134 bool const exclude_gly,
135 bool const exclude_pro,
136 bool const exclude_cys_peptides,
140 Size const frag_size( target_seq.size() );
141 runtime_assert( frag_size == target_ss.size() && ss_weight >= 0.0 && seq_weight >= 0.0 );
144 Real const min_nonzero_weight
145 ( ss_weight == 0.0 ? seq_weight : ( seq_weight == 0.0 ? ss_weight : std::min( ss_weight, seq_weight ) ) );
148 FArray1D_int heap( nfrags + 2 );
149 FArray1D_float coheap( nfrags + 2 );
154 for (
Size vall_pos=1; vall_pos <= my_size - frag_size + 1; ++vall_pos ) {
157 bool bad_frag(
false );
161 for (
Size k=0; k< frag_size; ++k ) {
162 Real const phi ( phi_ [ vall_pos+k ] );
163 Real const psi ( psi_ [ vall_pos+k ] );
164 Real const omega( omega_ [ vall_pos+k ] );
165 char const seq ( sequence_ [ vall_pos+k ] );
166 char const ss ( secstruct_[ vall_pos+k ] );
167 if ( ( std::abs( phi ) < 0.01 ) ||
168 ( std::abs( psi ) + std::abs( omega ) < 0.01 ) ||
169 ( seq ==
'G' && exclude_gly && seq != target_seq[k] ) ||
170 ( seq ==
'P' && exclude_pro && seq != target_seq[k] ) ||
171 ( std::abs( omega ) < 90.0 && exclude_cys_peptides ) ) {
175 if ( ss != target_ss[k] ) {
178 if ( seq != target_seq[k] ) {
183 if ( bad_frag )
continue;
186 score += min_nonzero_weight * 0.1 * numeric::random::uniform();
190 heap_insert( heap, coheap, vall_pos, -score, err );
195 Size exact_matches(0);
196 Real worst_score(999), best_score(999);
198 for (
Size nn= nfrags; nn >=1; --nn ) {
203 runtime_assert( !err );
205 if ( score >= -0.1 * min_nonzero_weight ) ++exact_matches;
207 if ( nn == nfrags ) worst_score = -score;
208 else if ( nn == 1 ) best_score = -score;
212 for (
Size k=0; k< frag_size; ++k ) {
213 fragment->set_torsion ( k+1, 1, phi_ [ vall_pos + k ] );
214 fragment->set_torsion ( k+1, 2, psi_ [ vall_pos + k ] );
215 fragment->set_torsion ( k+1, 3, omega_ [ vall_pos + k ] );
216 fragment->set_secstruct( k+1, secstruct_[ vall_pos + k ] );
223 TR.Trace <<
"ss-frags: " <<
224 " target_ss: " << target_ss <<
225 " target_seq: " << target_seq <<
226 " exact_matches: " << exact_matches <<
227 " best_score: " << best_score <<
228 " worst_score: " << worst_score << std::endl;