14 #ifndef INCLUDED_protocols_toolbox_Cluster_impl_hh
15 #define INCLUDED_protocols_toolbox_Cluster_impl_hh
20 #include <ObjexxFCL/FArray2D.hh>
23 #include <utility/vector1.hh>
24 #include <basic/Tracer.hh>
25 #include <utility/exit.hh>
26 #include <ObjexxFCL/string.functions.hh>
36 static basic::Tracer
_impl_tr(
"protocols.toolbox.cluster");
38 template<
typename SilentStructIterator,
typename StructureContainer >
41 SilentStructIterator input_decoys_begin,
42 SilentStructIterator input_decoys_end,
43 StructureContainer& new_structs,
54 template<
typename SilentStructIterator,
typename StructureContainer >
56 SilentStructIterator input_decoys_begin,
57 SilentStructIterator input_decoys_end,
58 StructureContainer& new_structs,
67 _impl_tr.Info <<
"compute distance matrix" << std::endl;
72 cluster.set_n_max_cluster( 1000000 );
74 _impl_tr.Info <<
"compute clusters" << std::endl;
75 cluster.do_clustering();
78 _impl_tr.Info <<
"sort clusters by energy" << std::endl;
79 runtime_assert( CA_set.
all_energies().size() == n_decoys );
88 _impl_tr.Info <<
" clustering: " << clusterlist.size() <<
" clusters found. ";
90 _impl_tr.Info <<
" cluster size limited to "
101 _impl_tr.Info <<
" generate new tags... " << std::endl;
102 for (
core::Size i=1; i<=clusterlist.size(); i++ ) {
103 for (
core::Size j=1; j<=clusterlist[i].size(); j++ ) {
104 using namespace ObjexxFCL;
106 kept_tags[ clusterlist[i][j-1] ] =
"c."+lead_zero_string_of( i-1,4 )+
"."+lead_zero_string_of( j-1,3 );
110 _impl_tr.Info <<
"copy remaining structures to output... " << std::endl;
113 for ( SilentStructIterator it=input_decoys_begin; it!=input_decoys_end; ++it, ++tags_it, ++ct ) {
116 if ( tags_it->size() == 0 ) {
117 _impl_tr.Info <<
"removed decoy " << it->decoy_tag() <<
" with score " << it->get_energy(
"score" ) <<
"\n";
122 _impl_tr.Info <<
"keep decoy "<< it->decoy_tag() <<
" with score " << it->get_energy(
"score" ) <<
" as " << *tags_it <<
"\n";
127 new_decoy->add_string_value(
"decoy_tag", it->decoy_tag() );
128 new_decoy->set_decoy_tag( *tags_it );
131 new_structs.push_back( new_decoy );
134 kept_orig_tags[ ct ] = it->decoy_tag();
138 cluster.print_summary( kept_orig_tags, CA_set.
all_energies() );