63 #include <basic/Tracer.hh>
65 #include <basic/prof.hh>
67 #include <utility/io/ozstream.hh>
68 #include <utility/vector1.hh>
75 #include <ObjexxFCL/format.hh>
76 #include <ObjexxFCL/FArray2D.hh>
85 #include <utility/vector0.hh>
92 namespace pose_metric_calculators{
94 static basic::Tracer
TR(
"seqrecovery");
97 using namespace protocols;
98 using namespace basic::options;
99 using namespace basic::options::OptionKeys;
101 using namespace ObjexxFCL::fmt;
107 using namespace core::pack::task::operation;
112 return task_factory_;
120 std::set< Size > designable_set;
124 TR<<
"Task is: \n" << *(design_task) << std::endl;
128 for (
Size ii = 1; ii<= design_task->total_residue(); ++ii ) {
129 if( design_task->being_designed( ii ) )
130 designable_set.insert( ii );
133 return designable_set;
146 core::conformation::find_neighbors<core::conformation::PointGraphVertexData,core::conformation::PointGraphEdgeData>( pg, 10.0 );
157 num_nbs[ ii ] = pg->get_vertex(ii).num_neighbors_counting_self();
183 Size n_correct_total(0);
Size n_total(0);
184 Size n_correct_total_core(0);
Size n_total_core(0);
185 Size n_correct_total_surface(0);
Size n_total_surface(0);
187 Size surface_exposed_cutoff(surface_exposure_);
188 Size core_cutoff(core_cutoff_);
194 while( ( native_itr != native_last ) && (redesign_itr != redesign_last ) ) {
202 std::set< Size > design_set;
206 setup_tf( task_factory );
207 design_set = fill_designable_set( native_pose, task_factory );
208 fill_num_neighbors( native_pose, num_neighbors );
217 for ( std::set< core::Size >::const_iterator it = design_set.begin(),
end = design_set.end(); it !=
end; ++it ) {
224 native_sequence[ *it ] = native_pose.
residue( *it ).
aa();
225 n_native[ native_pose.
residue(*it).
aa() ]++;
228 if ( num_neighbors[*it] >= core_cutoff ) {
229 n_native_core[ native_pose.
residue(*it).
aa() ]++;
233 if ( num_neighbors[*it] < surface_exposed_cutoff ) {
234 n_native_surface[ native_pose.
residue(*it).
aa() ]++;
241 for ( std::set< core::Size >::const_iterator it = design_set.begin(),
end = design_set.end(); it !=
end; ++it ) {
248 n_designed[ redesign_pose.
residue(*it).
aa() ]++;
250 if ( num_neighbors[*it] >= core_cutoff ) { n_designed_core[ redesign_pose.
residue(*it).
aa() ]++; }
251 if ( num_neighbors[*it] < surface_exposed_cutoff ) { n_designed_surface[ redesign_pose.
residue(*it).
aa() ]++; }
254 if ( native_sequence[ *it ] == redesign_pose.
residue(*it).
aa() ) {
255 n_correct[ redesign_pose.
residue(*it).
aa() ]++;
257 if ( num_neighbors[*it] >= core_cutoff ) {
258 n_correct_core[ redesign_pose.
residue(*it).
aa() ]++;
259 n_correct_total_core++;
261 if ( num_neighbors[*it] < surface_exposed_cutoff ) {
262 n_correct_surface[ redesign_pose.
residue(*it).
aa() ]++;
263 n_correct_total_surface++;
275 native_itr++; redesign_itr++;
279 utility::io::ozstream outputFile(
"sequencerecovery.txt" ) ;
282 outputFile <<
"Residue\tNo.correct core\tNo.native core\tNo.designed core\tNo.correct/ No.native core\tNo.correct/ No.designed core\t"
283 <<
"No.correct\tNo.native\tNo.designed\tNo.correct/ No.native\tNo.correct/ No.designed\t"
284 <<
"Residue\tNo.correct surface\tNo.native surface\tNo.designed surface\tNo.correct/ No.native\tNo.correct/ No.designed" << std::endl;
290 << n_correct_core[ ii ] <<
"\t" << n_native_core[ ii ] <<
"\t" << n_designed_core[ ii ] <<
"\t";
292 if ( n_native_core[ii] != 0 ) outputFile << F(4,2, (
float)n_correct_core[ii]/n_native_core[ii] ) <<
"\t";
293 else outputFile <<
"---\t";
294 if ( n_designed_core[ii] != 0 ) outputFile << F(4,2, (
float)n_correct_core[ii]/n_designed_core[ii] ) <<
"\t";
295 else outputFile <<
"---\t";
301 outputFile << n_correct[ ii ] <<
"\t" << n_native[ ii ] <<
"\t" << n_designed[ ii ] <<
"\t";
302 if ( n_native[ii] != 0 ) outputFile << F(4,2, (
float)n_correct[ii]/n_native[ii] ) <<
"\t";
303 else outputFile <<
"---\t";
304 if ( n_designed[ii] != 0 ) outputFile << F(4,2, (
float)n_correct[ii]/n_designed[ii] ) <<
"\t";
305 else outputFile <<
"---\t";
312 << n_correct_surface[ ii ] <<
"\t" << n_native_surface[ ii ] <<
"\t" << n_designed_surface[ ii ] <<
"\t";
314 if ( n_native_surface[ii] != 0 ) outputFile << F(4,2, (
float)n_correct_surface[ii]/n_native_surface[ii] ) <<
"\t";
315 else outputFile <<
"---\t";
316 if ( n_designed_surface[ii] != 0 ) outputFile << F(4,2, (
float)n_correct_surface[ii]/n_designed_surface[ii] ) <<
"\t";
317 else outputFile <<
"---\t";
323 outputFile << std::endl;
327 outputFile <<
"Total\t"
328 << n_correct_total_core <<
"\t" << n_total_core <<
"\t\t" << F(5,3, (
float)n_correct_total_core/n_total_core ) <<
"\t\t"
329 << n_correct_total <<
"\t" << n_total <<
"\t\t" << F(5,3, (
float)n_correct_total/n_total ) <<
"\t\tTotal\t"
330 << n_correct_total_surface <<
"\t" << n_total_surface <<
"\t\t" << F(5,3, (
float)n_correct_total_surface/n_total_surface )
335 utility::io::ozstream matrixFile(
"submatrix.txt" ) ;
338 matrixFile <<
"AA_TYPE" <<
"\t" ;
342 matrixFile<<std::endl;
349 matrixFile<<
"\t" << sub_matrix( jj, ii );
351 matrixFile << std::endl;
366 native_poses.push_back(native);
367 redesign_poses.push_back(designed);
369 get_sequence_recovery(native_poses, redesign_poses);
375 if ( native_poses.size() != redesign_poses.size() ) {
376 utility_exit_with_message(
"Size of native pdb list file does not equal size of redesign pdb list! \n" );
379 TR <<
"Measuring sequence recovery" << std::endl;
380 measure_sequence_recovery( native_poses, redesign_poses );