32 #include <numeric/model_quality/rms.hh>
33 #include <numeric/model_quality/maxsub.hh>
34 #include <ObjexxFCL/FArray1D.hh>
35 #include <ObjexxFCL/FArray2D.hh>
36 #include <ObjexxFCL/format.hh>
71 namespace hybridization {
74 using namespace kinematics;
75 using namespace core::scoring::constraints;
83 dynamic_cast<core::conformation::symmetry::SymmetricConformation const &> ( pose.
conformation()) );
85 nres_tgt = symm_info->num_independent_residues();
97 std::set< core::Size > ignore_res_for_AUTO) {
98 if (cen_cst_file ==
"AUTO") {
101 }
else if (!cen_cst_file.empty() && cen_cst_file !=
"NONE") {
115 if (fa_cst_file ==
"AUTO") {
118 }
else if (fa_cst_file ==
"SELF") {
120 add_constraints.
apply(pose);
121 }
else if (!fa_cst_file.empty() && fa_cst_file !=
"NONE") {
124 }
else if (cen_cst_file ==
"AUTO") {
127 }
else if (!cen_cst_file.empty() && cen_cst_file !=
"NONE") {
137 std::set< core::Size > ignore_res )
152 for (
int i=1; i<=(
int)templates.size(); ++i) {
154 for (
int j=1; j<(
int)templates[i]->total_residue(); ++j ) {
156 for (
int k=1; k<=(
int)GAPBUFFER && includeme; ++k) {
157 if ( j-k < 1 || j+k > (
int)templates[i]->total_residue() ) includeme=
false;
158 else if (templates[i]->pdb_info()->number(j+k) - templates[i]->pdb_info()->number(j) != k ) includeme=
false;
159 else if (templates[i]->pdb_info()->number(j-k) - templates[i]->pdb_info()->number(j) != -k ) includeme=
false;
161 passed_gapcheck[j] = includeme;
164 for (
core::Size j=1; j<templates[i]->total_residue(); ++j ) {
165 if (!templates[i]->residue_type(j).is_protein())
continue;
166 if (!passed_gapcheck[j])
continue;
167 for (
core::Size k=j+1; k<templates[i]->total_residue(); ++k ) {
168 if (!templates[i]->residue_type(k).is_protein())
continue;
169 if (!passed_gapcheck[k])
continue;
170 if (templates[i]->pdb_info()->number(k) - templates[i]->pdb_info()->number(j) < (
int)MINSEQSEP)
continue;
171 if ( ignore_res.count(templates[i]->pdb_info()->number(j)) ||
172 ignore_res.count(templates[i]->pdb_info()->number(k)) )
continue;
173 core::Real dist = templates[i]->residue(j).xyz(2).distance( templates[i]->residue(k).
xyz(2) );
174 if ( dist <= MAXDIST ) {
199 for (
core::Size i=1; i<=strand_pairs.size(); ++i) {
200 std::pair< core::Size, core::Size > strand_pair = strand_pairs[i];
202 if ( dist <= MAXDIST ) {
222 for (
Size ires=1; ires<=n_prot_res; ++ires) {
226 for (
Size jres=n_prot_res+1; jres<=n_nonvirt; ++jres) {
229 if ( dist <= MAXDIST ) {
242 for (
Size ires=n_prot_res+1; ires<=n_nonvirt; ++ires) {
245 for (
Size jres=ires; jres<=n_nonvirt; ++jres) {
247 if ( ires == jres && iatom >= jatom)
continue;
249 if ( dist <= MAXDIST ) {
266 if (seqpos == 1)
return true;
293 std::list < Size > residue_list;
298 residue_list.push_back(downstream_res);
300 for (
Size i_edge = 1; i_edge <= edges.size(); ++i_edge) {
301 if ( !edges[i_edge].is_polymer() )
continue;
302 Size start = edges[i_edge].start() <= edges[i_edge].stop() ? edges[i_edge].start() : edges[i_edge].stop();
303 Size stop = edges[i_edge].start() <= edges[i_edge].stop() ? edges[i_edge].stop() : edges[i_edge].start();
304 for (
Size ires = start; ires <=
stop; ++ires ) {
305 residue_list.push_back(ires);
309 residue_list.unique();
318 bool iterate_convergence,
322 std::list <core::Size> residue_list;
325 residue_list.push_back(ires);
328 partial_align( pose, ref_pose, atom_map, residue_list, iterate_convergence, distance_thresholds, min_coverage );
336 std::list <Size>
const & residue_list,
337 bool iterate_convergence,
346 if (distance_thresholds.size() == 0) {
347 distance_thresholds.push_back(6);
348 distance_thresholds.push_back(4);
349 distance_thresholds.push_back(3);
350 distance_thresholds.push_back(2);
351 distance_thresholds.push_back(1.5);
352 distance_thresholds.push_back(1);
358 if (iterate_convergence) {
365 for (
int i=1; i<=(
int)distance_thresholds.size() && coverage>=min_coverage; ++i) {
366 core::Real my_d_sq = distance_thresholds[i]*distance_thresholds[i];
367 bool converged =
false;
373 if (updated_atom_map == updated_atom_map_last_round || coverage<min_coverage) {
393 if (!aid.
valid())
continue;
414 if (!aid.
valid())
continue;
416 if (pose.
xyz(
id::AtomID( iatom,ires )).distance_squared( ref_pose.
xyz(aid) ) < distance_squared_threshold)
417 updated_atom_map[
id::AtomID( iatom,ires ) ] = aid;
420 return updated_atom_map;
435 if (!aid.
valid())
continue;
437 if (pose.
xyz(
id::AtomID( iatom,ires )).distance_squared( ref_pose.
xyz(aid) ) < distance_squared_threshold) {
454 using namespace core;
455 using namespace core::id;
457 Size total_mapped_atoms(0);
461 if (!aid.
valid())
continue;
463 ++total_mapped_atoms;
468 if (total_mapped_atoms <= 2) {
469 R.xx() = R.yy() = R.zz() = 1;
470 R.xy() = R.yx() = R.zx() = R.zy() = R.yz() = R.xz() = 0;
474 ObjexxFCL::FArray2D< core::Real > final_coords( 3, total_mapped_atoms );
475 ObjexxFCL::FArray2D< core::Real > init_coords( 3, total_mapped_atoms );
481 if (!aid.
valid())
continue;
489 for (
int j=0; j<3; ++j) {
490 init_coords(j+1,atomno) = x_i[j];
491 final_coords(j+1,atomno) = y_i[j];
496 preT /= (float) total_mapped_atoms;
497 postT /= (float) total_mapped_atoms;
498 for (
int i=1; i<=(
int)total_mapped_atoms; ++i) {
499 for (
int j=0; j<3; ++j ) {
500 init_coords(j+1,i) -= preT[j];
501 final_coords(j+1,i) -= postT[j];
507 ObjexxFCL::FArray1D< numeric::Real > ww( total_mapped_atoms, 1.0 );
508 ObjexxFCL::FArray2D< numeric::Real > uu( 3, 3, 0.0 );
511 numeric::model_quality::findUU( init_coords, final_coords, ww, total_mapped_atoms, uu, ctx );
512 R.xx( uu(1,1) ); R.xy( uu(2,1) ); R.xz( uu(3,1) );
513 R.yx( uu(1,2) ); R.yy( uu(2,2) ); R.yz( uu(3,2) );
514 R.zx( uu(1,3) ); R.zy( uu(2,3) ); R.zz( uu(3,3) );
520 std::list <Size>
const & residue_list,
523 using namespace ObjexxFCL;
528 for (std::list<Size>::const_iterator it = residue_list.begin();
529 it != residue_list.end();
553 for (
core::Size j=1; j<=nres_tgt-len+1; ++j ) {
554 bool crosses_cut =
false;
565 fragset->add( frame );
577 Size seqpos_start_templ = template_chunk[ichunk].start();
578 Size seqpos_start_target = template_pose->pdb_info()->number(seqpos_start_templ);
579 renumbered_template_chunks[ichunk].set_start( seqpos_start_target );
581 Size seqpos_stop_templ = template_chunk[ichunk].stop();
582 Size seqpos_stop_target = template_pose->pdb_info()->number(seqpos_stop_templ);
583 renumbered_template_chunks[ichunk].set_stop( seqpos_stop_target );
585 return renumbered_template_chunks;
598 ObjexxFCL::FArray2D< core::Real > p1a, p2a;