19 #include <core/io/pdb/pose_io.hh>
23 #include <core/pose/Pose.hh>
24 #include <core/conformation/Residue.hh>
25 #include <core/conformation/Atom.hh>
26 #include <core/pose/PDBPoseMap.hh>
27 #include <core/pose/PDBInfo.hh>
30 #include <core/scoring/ScoreFunction.hh>
31 #include <core/scoring/ScoreFunctionFactory.hh>
32 #include <core/scoring/hbonds/HBondSet.hh>
33 #include <core/scoring/hbonds/hbonds.hh>
35 #include <core/conformation/Conformation.hh>
42 #include <core/id/AtomID_Map.hh>
45 #include <core/scoring/ScoringManager.hh>
46 #include <core/scoring/methods/EnergyMethodOptions.hh>
47 #include <core/scoring/methods/EnergyMethod.hh>
49 #include <core/scoring/EnergyMap.hh>
52 #include <core/scoring/etable/EtableEnergy.hh>
56 #include <protocols/rigid/RigidBodyMover.hh>
57 #include <protocols/rigid/RollMover.hh>
58 #include <protocols/moves/Mover.hh>
59 #include <protocols/moves/StructureRestrictor.hh>
63 #include <basic/options/keys/run.OptionKeys.gen.hh>
64 #include <basic/options/keys/jd2.OptionKeys.gen.hh>
65 #include <basic/options/keys/score.OptionKeys.gen.hh>
68 #include <protocols/jd2/JobDistributor.hh>
69 #include <protocols/jd2/Job.hh>
92 using namespace utility;
93 using namespace protocols;
94 using namespace protocols::moves;
96 using namespace basic::options::OptionKeys;
111 0.5 * ( a.
x() + b.
x() ),
112 0.5 * ( a.
y() + b.
y() ),
113 0.5 * ( a.
z() + b.
z() )
126 return "HDmakerMover";
153 scorefxn_ = core::scoring::get_score_function();
156 pdb_chain_ =
option[run::chain].def(
"A");
166 midpoint = (xpoints+ypoints);
188 for (
Size j = 1; j <= pose.total_residue(); ++j ) {
189 core::conformation::Residue
const &
res( pose.residue(j) );
190 core::chemical::AtomIndices bb_ai(
res.mainchain_atoms() );
193 for (
Size jj = 1; jj <= bb_ai.size(); ++jj ) {
194 if ( chain_num == 1 ) {
195 chain1_bb_atoms.push_back(
res.atom(jj) );
196 }
else if ( chain_num == aligned_chain_num ) {
197 chain2_bb_atoms.push_back(
res.atom(jj) );
201 if ( pose.conformation().num_chains() >= 3 && chain_num != 1 ) {
202 all_bb_atoms.push_back(
res.atom(jj) );
210 core::scoring::methods::EnergyMethodOptions
const & emo(scorefxn->energy_method_options());
211 core::scoring::etable::Etable
const & et(*(core::scoring::ScoringManager::get_instance()->etable(emo).lock()));
213 if (
basic::options::option[ basic::options::OptionKeys::score::analytic_etable_evaluation ] || emo.analytic_etable_evaluation() ) {
214 utility_exit_with_message(
"homodimer_maker is incompatible with analytic_etable_evaluation. Please either fix the code or add '-analytic_etable_evalution 0' to the command line.");
216 core::scoring::etable::TableLookupEtableEnergy ete( et, emo );
220 core::scoring::EMapVector tbemv;
221 core::Real atr_wt( (*scorefxn).get_weight(core::scoring::fa_atr) );
222 core::Real rep_wt( (*scorefxn).get_weight(core::scoring::fa_rep) );
223 for (
Size ii = 1;
ii <= chain1_bb_atoms.size(); ++
ii ) {
224 for (
Size jj = 1; jj <= chain2_bb_atoms.size(); ++jj ) {
227 ete.atom_pair_energy( chain1_bb_atoms[
ii], chain2_bb_atoms[jj], 1, tbemv, d2 );
230 core::Real bb_energy (rep_wt * tbemv[core::scoring::fa_rep] + atr_wt * tbemv[core::scoring::fa_atr] );
234 if ( pose.conformation().num_chains() >= 3 ) {
236 core::scoring::EMapVector tbemv_all;
237 core::scoring::etable::TableLookupEtableEnergy ete_all( et, emo );
238 for (
Size ii = 1;
ii <= chain1_bb_atoms.size(); ++
ii ) {
239 for (
Size jj = 1; jj <= all_bb_atoms.size(); ++jj ) {
242 ete.atom_pair_energy( chain1_bb_atoms[
ii], all_bb_atoms[jj], 1, tbemv_all, d2_all );
245 all_energy = (rep_wt * tbemv_all[core::scoring::fa_rep] + atr_wt * tbemv_all[core::scoring::fa_atr] );
247 all_energy = bb_energy ;
249 TR<<
"Number of chains: " <<pose.conformation().num_chains()
250 <<
" Backbone-backbone score: " << all_energy << std::endl;
261 protocols::jd2::JobOP
const job_me( protocols::jd2::JobDistributor::get_instance()->current_job() );
267 TR <<
"Deleting according to structure file..."<< std::endl;
268 moves::StructureRestrictorOP restrictor(
new moves::StructureRestrictor( struct_filename ) );
269 restrictor->apply(pose);
272 if ( pose.conformation().num_chains() > 1 ) {
273 TR <<
"pose is not a monomer, skipping..."<< std::endl;
274 set_last_move_status(protocols::moves::FAIL_BAD_INPUT);
278 (*scorefxn_)(
pose );
279 core::scoring::hbonds::HBondSet
hbond_set;
280 core::scoring::hbonds::fill_hbond_set(
287 hbond_set.setup_for_residue_pair_energies(pose);
290 char chain( pdb_chain_[0] );
292 Size sheet_end( pose.pdb_info()->pdb2pose(chain, sheet_stop_) );
295 Size n_residues (pose.total_residue());
299 pose.append_residue_by_jump(copy_pose.residue( 1 ), pose.total_residue(),
"" ,
"",
true );
300 for (
Size n = 2; n <= copy_pose.total_residue(); ++n ) {
301 pose.append_residue_by_bond( copy_pose.residue ( n ) );
307 TR <<
"Sheet Length: " << sheet_length;
310 window = sheet_length;
314 TR <<
" Window size: "<< window << std::endl;
315 Size last_start( sheet_end - window + 1 );
318 for (
Size jj = sheet_start; jj <= last_start; ++jj ) {
321 if ( hbond_set.acc_bbg_in_bb_bb_hbond(jj) && hbond_set.don_bbg_in_bb_bb_hbond(jj) ) {
325 Size this_end( jj + window -1 );
327 Size center_residue(0);
328 if ( window % 2 == 0 ) {
329 center_residue = jj + (window / 2);
330 }
else { center_residue = jj + ((window - 1) / 2); }
331 TR <<
"Sheet from: "<< jj <<
" to "<< this_end <<
" Window: " << window_num
332 <<
" Center residue: " << center_residue <<std::endl;
335 std::string
const atom_to_use(
"CA" );
344 TR <<
"Parl axis is from pose residue: " <<jj <<
" to " << this_end <<
"\n"
345 <<
"The vector between these two residues is: " << parl_vector <<
"\n"
346 <<
"The midpoint is : "<< midpoint << std::endl;
358 TR <<
"Anti axis is from pose residue: " <<jj <<
" to " << this_end <<
"\n"
359 <<
"The normal to these two residues is: " << anti_vector <<
"\n"
360 <<
"The midpoint is : "<< midpoint << std::endl;
364 Real const min_angle (180.0);
365 Real const max_angle(180.0);
367 pose::Pose anti_pose (pose), parl_pose (pose);
368 rigid::RollMoverOP parl_roll_mover(
new rigid::RollMover(1 , n_residues , min_angle, max_angle, parl_vector, center_xyz ) );
369 rigid::RollMoverOP anti_roll_mover(
new rigid::RollMover(1 , n_residues , min_angle, max_angle, anti_vector, center_xyz ) );
372 anti_roll_mover->apply( anti_pose );
373 parl_roll_mover->apply( parl_pose );
378 Real anti_dist (6.0);
379 Real parl_dist (5.5);
381 rigid::RigidBodyTransMoverOP push_apart_mover(
new rigid::RigidBodyTransMover );
384 TR <<
"C-O vector on center res is" << CO_plane_vector <<
", ";
386 if ( hbond_set.acc_bbg_in_bb_bb_hbond(center_residue) && hbond_set.don_bbg_in_bb_bb_hbond(center_residue) ) {
389 CO_plane_vector *= scaler;
390 TR <<
"Direction of translation is: " << CO_plane_vector << std::endl;
391 push_apart_mover->trans_axis(CO_plane_vector);
393 push_apart_mover->step_size(anti_dist);
394 push_apart_mover->apply(anti_pose);
395 push_apart_mover->step_size(parl_dist);
396 push_apart_mover->apply(parl_pose);
404 start_xyz = pose.residue(jj).atom(atom_to_use).xyz() ;
405 end_xyz = pose.residue(this_end).atom(atom_to_use).xyz() ;
406 parl_vector = end_xyz - start_xyz;
413 }
else if ( window <= 6 ) {
415 }
else if ( window <= 8 ) {
417 }
else if ( window <= 10 ) {
419 }
else if ( window <= 12 ) {
423 TR<<
"Number of RB steps to search: "<< numsteps << std::endl;
426 rigid::RigidBodyTransMoverOP sheet_trans_mover(
new rigid::RigidBodyTransMover );
428 sheet_trans_mover->trans_axis(parl_vector * (-1));
429 sheet_trans_mover->step_size(3.6);
430 sheet_trans_mover->apply(parl_pose);
436 sheet_trans_mover->trans_axis(parl_vector);
437 for (
int ii = (-1)*numsteps ;
ii <= numsteps; ++
ii ) {
438 Real trans_dist (7.0);
439 sheet_trans_mover->step_size(trans_dist*
ii);
440 sheet_trans_mover->apply(anti_pose);
441 sheet_trans_mover->apply(parl_pose);
442 TR<<
"Translate step: "<< ii <<
" distance: " << trans_dist * ii << std::endl;
445 Real const anti_bb_score (bb_score(anti_pose,2, scorefxn_));
446 Real const parl_bb_score (bb_score(parl_pose,2, scorefxn_));
449 std::stringstream anti_ss;
450 std::stringstream parl_ss;
451 int pdb_res( pose.pdb_info()->number(jj) );
452 char pdb_chain( pose.pdb_info()->chain(jj) );
453 anti_ss << pdb_file_name.base() <<
"_"<< pdb_chain << pdb_res <<
"_anti_wind_"<< window_num <<
"_step_" << ii <<
".pdb";
454 parl_ss << pdb_file_name.base() <<
"_"<< pdb_chain << pdb_res <<
"_parl_wind_" << window_num <<
"_step_" << ii <<
".pdb";
455 std::string anti_filename (anti_ss.str());
456 std::string parl_filename (parl_ss.str());
458 std::cout <<
"FILE: "<< anti_filename <<
" bb_score: " << anti_bb_score << std::endl;
459 std::cout <<
"FILE: "<< parl_filename <<
" bb_score: " << parl_bb_score << std::endl;
462 if ( anti_bb_score < maxE_ ) {
463 anti_pose.dump_pdb(anti_filename);
465 if ( parl_bb_score < maxE_ ) {
466 parl_pose.dump_pdb(parl_filename);
470 anti_pose = saved_anti;
471 parl_pose = saved_parl;
485 main(
int argc,
char* argv[] ) {
488 option.add(
sheet_start,
"Start of beta sheet (PDBNum) to do rolls and translates about");
489 option.add(
sheet_stop,
"End of beta sheet (PDBNum) to do rolls and translates about");
499 protocols::jd2::JobDistributor::get_instance()->go( protocols::moves::MoverOP(
new HDmakerMover ) );
501 TR<<
"Complete." << std::endl;
503 std::cout <<
"caught exception " << e.
msg() << std::endl;
#define utility_exit_with_message(m)
Exit with file + line + message.
virtual numeric::xyzVector< core::Real > find_midpoint(numeric::xyzVector< core::Real > &xpoints, numeric::xyzVector< core::Real > &ypoints)
virtual std::string const msg() const
Automatic hidden index key for integer options.
virtual void apply(core::pose::Pose &pose)
RealOptionKey const E_cutoff("E_cutoff")
virtual std::string get_name() const
vector0: std::vector with assert-checked bounds
numeric::xyzVector< core::Real > xyz_center_vector(numeric::xyzVector< core::Real > const &a, numeric::xyzVector< core::Real > const &b)
void init(int argc, char *argv[])
Command line init() version.
Value const & z() const
Value z const.
core::scoring::ScoreFunctionOP scorefxn_
Automatic hidden index key for real options.
Automatic hidden index key for string options.
xyzVector input/output functions
File name class supporting Windows and UN*X/Linux format names.
xyzVector< Real > xyz(Real const &r1, Real const &omega1, Real const &t, Real const &dz1, Real const &delta_omega1, Real const &delta_z1)
Returns the x-, y-, and z-coordinates of a point on a helix given r1, omega1, and t...
T distance_squared(xyzTriple< T > const &a, xyzTriple< T > const &b)
Distance squared.
common derived classes for thrown exceptions
xyzTriple< T > midpoint(xyzTriple< T > const &a, xyzTriple< T > const &b)
Midpoint of 2 xyzTriples.
Value const & y() const
Value y const.
std::vector with 1-based indexing
File name class supporting Windows and UN*X/Linux format names.
rule< Scanner, options_closure::context_t > options
IntegerOptionKey const sheet_start("sheet_start")
utility::options::OptionCollection option
OptionCollection global.
Value const & x() const
Value x const.
ocstream cout(std::cout)
Wrapper around std::cout.
vector1: std::vector with 1-based indexing
virtual Real bb_score(pose::Pose &pose, core::Size aligned_chain_num, core::scoring::ScoreFunctionOP &scorefxn)
StringOptionKey const struct_file("struct_file")
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
IntegerOptionKey const window_size("window_size")
void cross(const utility::vector1< Real > &L, const utility::vector1< Real > &r0, utility::vector1< Real > &r)
int main(int argc, char *argv[])
virtual MoverOP clone() const
Program options global and initialization function.
Fast (x,y,z)-coordinate numeric vector.
static void clone(T *&dst, S *src, int n)
static THREAD_LOCAL basic::Tracer TR("apps.public.beta_strand_homodimer_design.homodimer_maker")
rule< Scanner, option_closure::context_t > option
IntegerOptionKey const sheet_stop("sheet_stop")
virtual MoverOP fresh_instance() const