27 #include <utility/vector1.hh>
28 #include <basic/Tracer.hh>
29 #include <ObjexxFCL/format.hh>
33 #include <utility/exit.hh>
38 #include <utility/tag/Tag.hh>
39 #include <utility/string_util.hh>
43 #include <boost/tuple/tuple.hpp>
44 #include <boost/tuple/tuple_comparison.hpp>
45 #include <boost/lexical_cast.hpp>
46 #include <boost/foreach.hpp>
47 #include "boost/assign.hpp"
49 #define foreach BOOST_FOREACH
51 static basic::Tracer
TR(
"protocols.fldsgn.MatchResidues");
73 std::map< core::id::AtomID, core::id::AtomID > atom_id_map;
74 for(
Size i = 1; i < comb.size(); i++) {
77 atom_id_map.insert( std::make_pair< core::id::AtomID, core::id::AtomID >(mod_id, ref_id) );
87 for (
Size i = 1; i < comb.size(); ++i ) {
90 atom_map.
set( mod_id, ref_id);
99 Real smallest_rms = 99999;
102 if( rms < smallest_rms ) {
107 TR <<
"best fit:" <<std::endl;
108 TR <<
"ref_pos\tmod_pos" << std::endl;
109 for(
Size i = 1; i <= best_fit.size(); i++)
111 TR << std::endl <<
"rmsd matched positions " << smallest_rms << std::endl;
121 VecVecSize::const_iterator me,
122 VecVecSize::const_iterator
end)
const
132 for(VecSize::const_iterator it = mevi.begin();
136 cart_product(rvvi, rvi, me+1,
end);
146 cart_product(tmp, outputTemp, input.begin(), input.end());
148 foreach(
VecSize const & vec, tmp) {
149 std::set<Size> comb(vec.begin(), vec.end());
150 if(comb.size() == vec.size())
151 output.push_back(vec);
173 std::map< std::string, boost::tuple< core::Size, core::Size> > ss_seg;
174 if(blueprint !=
"") {
183 if( pairs_tag->getName() ==
"match" ) {
184 const Size ref_pos = pairs_tag->getOption<
Size >(
"ref_pos");
185 Size mod_pos_start= 0;
186 Size mod_pos_end = 0;
187 if( pairs_tag->hasOption(
"segment") ) {
188 assert( blueprint !=
"");
189 boost::tuple< Size, Size>
range = ss_seg[ pairs_tag->getOption<
std::string >(
"segment") ];
190 mod_pos_start = boost::get<0>(
range);
191 mod_pos_end = boost::get<1>(
range);
193 }
else if( pairs_tag->hasOption(
"mod_pos_start") || pairs_tag->hasOption(
"mod_pos_end") ) {
194 mod_pos_start = pairs_tag->getOption<
Size >(
"mod_pos_start");
195 mod_pos_end = pairs_tag->getOption<
Size >(
"mod_pos_end");
197 }
else if( pairs_tag->hasOption(
"mod_pos") ) {
198 mod_pos_start = mod_pos_end = pairs_tag->getOption<
Size >(
"mod_pos");
201 utility_exit_with_message(
"need to specify a segment to be matched in the modified structure");
204 for(
Size n = mod_pos_start; n <= mod_pos_end; n++)
207 TR <<
"Residue " << ref_pos <<
" from the reference structure matches against segment [" << mod_pos_start <<
"," << mod_pos_end <<
"]" << std::endl;
209 mod_match_segments.push_back( vrange );
212 utility_exit_with_message(
"wrong tag \"" + pairs_tag->getName() +
"\" used in MatchResidues.");
219 std::map< std::string, boost::tuple< core::Size, core::Size> >
222 std::map< std::string, boost::tuple<Size, Size> > ss_map;
223 std::map< char, Size > ss_seg_count = boost::assign::map_list_of (
'L', 0 ) (
'H', 0 ) (
'E', 0 );
225 ss_seg_count[ last ] += 1;
229 for(
Size i = 1; i < ss.size(); i++) {
230 if( ss[i] == last ) {
232 if(i + 1 == ss.size())
233 ss_map.insert( std::make_pair<
std::string, boost::tuple<Size, Size> >( last + boost::lexical_cast< std::string >( ss_seg_count[ss[i - 1] ] ), boost::make_tuple(start, i) ) );
237 ss_map.insert( std::make_pair<
std::string, boost::tuple<Size, Size> >( last + boost::lexical_cast< std::string >( ss_seg_count[ss[i - 1] ] ), boost::make_tuple(start, end) ) );
238 ss_seg_count[ ss[i] ] += 1;