34 #include <ObjexxFCL/FArray1D.hh>
38 #include <utility/pointer/owning_ptr.hh>
40 #include <numeric/xyzMatrix.hh>
49 #include <basic/Tracer.hh>
51 #include <utility/vector1.hh>
57 static basic::Tracer
TR(
"protocols.rna.rna_base_pair_classifier" ) ;
85 using namespace core::chemical;
93 if ( atom_name ==
" N1 " ||
94 atom_name ==
" C2 " ||
95 atom_name ==
" N6 " ) N_W++;
97 if ( atom_name ==
" N6 " ||
98 atom_name ==
" C5 " ||
99 atom_name ==
" C8 " ||
100 atom_name ==
" N7 " ) N_H++;
102 if ( atom_name ==
" N3 " ||
103 atom_name ==
" C2 " ||
104 atom_name ==
" C4 " ||
105 atom_name ==
" C1 " ||
106 atom_name ==
" C2 " ||
107 atom_name ==
" C3*" ||
108 atom_name ==
" O3*" ||
109 atom_name ==
" O2*" ) N_S++;
113 if ( atom_name ==
" O2 " ||
114 atom_name ==
" N3 " ||
115 atom_name ==
" N4 " ) N_W++;
117 if ( atom_name ==
" N4 " ||
118 atom_name ==
" C5 " ||
119 atom_name ==
" C6 " ) N_H++;
121 if ( atom_name ==
" O2 " ||
122 atom_name ==
" N1 " ||
123 atom_name ==
" C1*" ||
124 atom_name ==
" C2*" ||
125 atom_name ==
" C3*" ||
126 atom_name ==
" O3*" ||
127 atom_name ==
" O2*" ) N_S++;
131 if ( atom_name ==
" N1 " ||
132 atom_name ==
" N2 " ||
133 atom_name ==
" O6 " ) N_W++;
135 if ( atom_name ==
" O6 " ||
136 atom_name ==
" C5 " ||
137 atom_name ==
" C8 " ||
138 atom_name ==
" N7 " ) N_H++;
140 if ( atom_name ==
" N3 " ||
141 atom_name ==
" N2 " ||
142 atom_name ==
" C4 " ||
143 atom_name ==
" N9 " ||
144 atom_name ==
" C1*" ||
145 atom_name ==
" C2*" ||
146 atom_name ==
" O2*" ) N_S++;
150 if ( atom_name ==
" O2 " ||
151 atom_name ==
" N3 " ||
152 atom_name ==
" O4 " ) N_W++;
154 if ( atom_name ==
" O4 " ||
155 atom_name ==
" C5 " ||
156 atom_name ==
" C6 " ) N_H++;
158 if ( atom_name ==
" O2 " ||
159 atom_name ==
" N1 " ||
160 atom_name ==
" C1*" ||
161 atom_name ==
" C2*" ||
162 atom_name ==
" C3*" ||
163 atom_name ==
" O3*" ||
164 atom_name ==
" O2*" ) N_S++;
167 std::cout <<
"PROBLEM !!!! " << rsd.
aa() << std::endl;
168 utility_exit_with_message(
"Problem with base classification, residue " );
178 Size const & other_atm,
183 using namespace core::chemical;
187 if (rsd.
aa() ==
na_rad && atom_name ==
" N6 ") {
189 if ( (rsd.
xyz( rsd.
atom_index(
"1H6 ") ) - other_rsd.
xyz( other_atm )).length() <
190 (rsd.
xyz( rsd.
atom_index(
"2H6 ") ) - other_rsd.
xyz( other_atm )).length() ) {
197 if (rsd.
aa() ==
na_rcy && atom_name ==
" N4 ") {
198 if ( (rsd.
xyz( rsd.
atom_index(
"1H4 ") ) - other_rsd.
xyz( other_atm )).length() <
199 (rsd.
xyz( rsd.
atom_index(
"2H4 ") ) - other_rsd.
xyz( other_atm )).length() ) {
206 if (rsd.
aa() ==
na_rgu && atom_name ==
" N2 ") {
207 if ( (rsd.
xyz( rsd.
atom_index(
"1H2 ") ) - other_rsd.
xyz( other_atm )).length() <
208 (rsd.
xyz( rsd.
atom_index(
"2H2 ") ) - other_rsd.
xyz( other_atm )).length() ) {
221 for ( chemical::AtomIndices::const_iterator
223 anume = rsd.
Hpos_polar().end(); anum != anume; ++anum ) {
224 Size const H_atm( *anum );
225 if ( H_atm == atm )
return true;
235 for ( chemical::AtomIndices::const_iterator
237 anume = rsd.
Hpos_polar().end(); anum != anume; ++anum ) {
238 Size const H_atm( *anum );
239 if ( rsd.
atom_base( H_atm ) == atm )
return true;
249 for ( chemical::AtomIndices::const_iterator
251 anume = rsd.
accpt_pos().end(); anum != anume; ++anum ) {
252 Size const H_atm( *anum );
253 if ( H_atm == atm )
return true;
268 Size & edge_classification )
270 using namespace core::scoring::rna;
272 static Real const DIST_CUTOFF( 4.2 );
275 Size N_W( 0 ), N_H( 0 ), N_S( 0 );
288 Real const dist_ij = ( rsd_i.
xyz( m ) - rsd_j.
xyz( k ) ).length();
293 if ( dist_ij < DIST_CUTOFF /*&& angle_ij > ANGLE_CUTOFF*/ ) {
334 if ( N_W >= N_H && N_W >= N_S ) {
336 }
else if (N_H >= N_S ) {
339 edge_classification =
SUGAR;
358 using namespace core::scoring::rna;
362 rna_centroid_info.
update( pose );
368 Matrix
const & M_i( stub_i.M );
369 Vector const & z_i = M_i.col_z();
372 Matrix
const & M_j( stub_j.
M );
373 Vector const & z_j = M_j.col_z();
374 Real const cos_theta = dot_product( z_i, z_j );
376 Size const theta_bin = (cos_theta < 0) ? 1 : 2;
387 static Real const DIST_CUTOFF( 4.0 );
389 for (
Size k = rsd_i.first_sidechain_atom()+1; k <= rsd_i.nheavyatoms(); k++ ) {
391 if ( i == j )
continue;
393 if ( ( rsd_i.xyz( k ) - pose.
residue( j ).
xyz( m ) ).length() < DIST_CUTOFF ) {
415 static Real const HBOND_CUTOFF( -0.1 );
416 for (
Size n = 1; n <= hbond_set->nhbonds(); n++ ) {
420 Size const & don_hatm = hbond.don_hatm();
422 Size const & acc_res_num = hbond.acc_res();
423 Size const & acc_atm = hbond.acc_atm();
425 if ( don_res_num == i && acc_res_num == j ) {
430 if ( hbond.energy() <= HBOND_CUTOFF ) num_hbonds++;
435 if ( don_res_num == j && acc_res_num == i ) {
440 if ( hbond.energy() <= HBOND_CUTOFF ) num_hbonds++;
447 if (num_hbonds > 0 )
return num_hbonds;
450 static Real const DIST_CUTOFF( 3.0 );
454 for ( chemical::AtomIndices::const_iterator
455 anum = rsd_i.accpt_pos().begin(),
456 anume = rsd_i.accpt_pos().end(); anum != anume; ++anum ) {
458 Size const aatm( *anum ) ;
459 if ( aatm <= rsd_i.first_sidechain_atom() )
continue;
461 for ( chemical::AtomIndices::const_iterator
462 hnum = rsd_j.Hpos_polar().begin(),
463 hnume = rsd_j.Hpos_polar().end(); hnum != hnume; ++hnum ) {
464 Size const hatm( *hnum );
466 if ( rsd_j.atom_base( hatm ) <= rsd_j.first_sidechain_atom() )
continue;
468 if ( ( rsd_i.xyz( aatm ) - rsd_j.xyz( hatm ) ).length() < DIST_CUTOFF ) {
476 for ( chemical::AtomIndices::const_iterator
477 anum = rsd_j.accpt_pos().begin(),
478 anume = rsd_j.accpt_pos().end(); anum != anume; ++anum ) {
480 Size const aatm( *anum ) ;
481 if ( aatm <= rsd_j.first_sidechain_atom() )
continue;
483 for ( chemical::AtomIndices::const_iterator
484 hnum = rsd_i.Hpos_polar().begin(),
485 hnume = rsd_i.Hpos_polar().end(); hnum != hnume; ++hnum ) {
486 Size const hatm( *hnum );
488 if ( rsd_i.atom_base( hatm ) <= rsd_i.first_sidechain_atom() )
continue;
490 if ( ( rsd_j.xyz( aatm ) - rsd_i.xyz( hatm ) ).length() < DIST_CUTOFF ) {
509 using namespace core::scoring::rna;
513 rna_centroid_info.
update( pose );
518 Vector const & centroid_i( base_centroids[i] );
520 Matrix
const & M_i( stub_i.
M );
523 Vector const & z_i = M_i.col_z();
525 Vector const & centroid_j( base_centroids[j] );
528 Vector d_ij = centroid_j - centroid_i;
531 Real const dist_z = dot_product( d_ij, z_i );
533 Matrix
const & M_j( stub_j.
M );
534 Vector const & z_j = M_j.col_z();
535 Real const cos_theta = dot_product( z_i, z_j );
542 static Real const rna_basepair_stagger_cutoff_( 2.8 );
543 static Real const COS_THETA_CUTOFF( 0.6 );
544 if ( std::abs(dist_z) < rna_basepair_stagger_cutoff_ && std::abs( cos_theta ) > COS_THETA_CUTOFF )
return true;
566 using namespace core::scoring;
567 using namespace core::scoring::rna;
568 using namespace core::chemical;
570 base_pair_list.clear();
575 ObjexxFCL::FArray1D < bool > is_base_paired( pose.total_residue(), false );
584 hbond_options->use_hb_env_dep(
false );
592 for (
Size i = 1; i <= pose.total_residue(); i++ ) {
593 if ( ! pose.residue(i).is_RNA() )
continue;
594 for (
Size j = i+1; j <= pose.total_residue(); j++ ) {
595 if ( ! pose.residue(j).is_RNA() )
continue;
598 if ( num_hbonds == 0 )
continue;
601 Size edge_classification_i( 0 ), edge_classification_j( 0 );
619 if (
false ) std::cout << pose.residue( i ).name1() << i <<
" " << pose.residue(j).name1() << j <<
" " <<
get_edge_from_num( edge_classification_i ) <<
" " <<
get_edge_from_num( edge_classification_j ) <<
" " << orientation << std::endl;
628 for (
Size i = 1; i <= pose.total_residue(); i++ ) {
630 is_bulged.push_back( check_bulge );
631 if ( check_bulge &&
false ) {
632 std::cout <<
" BULGE " << i << std::endl;
644 using namespace core::scoring;
645 using namespace core::scoring::rna;
651 (*denovo_scorefxn)( pose );
655 Energy_base_stack_list const & scored_base_stack_list( rna_filtered_base_base_info.scored_base_stack_list() );
657 return scored_base_stack_list.
size();