15 #include <protocols/frags/VallData.hh>
16 #include <protocols/frags/TorsionFragment.hh>
18 #include <core/fragment/ConstantLengthFragSet.hh>
19 #include <core/fragment/FragSet.hh>
20 #include <core/fragment/Frame.hh>
21 #include <core/fragment/picking_old/vall/util.hh>
22 #include <core/fragment/picking_old/FragmentLibraryManager.hh>
24 #include <core/scoring/LREnergyContainer.hh>
25 #include <core/scoring/methods/Methods.hh>
26 #include <core/scoring/ScoreType.hh>
28 #include <protocols/simple_moves/BackboneMover.hh>
29 #include <protocols/simple_moves/MinMover.hh>
30 #include <protocols/moves/MonteCarlo.hh>
31 #include <protocols/moves/Mover.hh>
32 #include <protocols/moves/MoverContainer.hh>
33 #include <protocols/moves/OutputMovers.hh>
34 #include <protocols/rigid/RigidBodyMover.hh>
36 #include <protocols/moves/TrialMover.hh>
37 #include <protocols/simple_moves/PackRotamersMover.hh>
38 #include <protocols/simple_moves/RotamerTrialsMover.hh>
39 #include <protocols/moves/RepeatMover.hh>
40 #include <protocols/simple_moves/FragmentMover.hh>
42 #include <protocols/viewer/viewers.hh>
44 #include <core/types.hh>
46 #include <core/scoring/sasa.hh>
53 #include <core/chemical/AtomTypeSet.hh>
55 #include <core/chemical/AA.hh>
56 #include <core/conformation/Residue.hh>
57 #include <core/conformation/ResidueMatcher.hh>
58 #include <core/pack/rotamer_set/RotamerCouplings.hh>
59 #include <core/chemical/ResidueTypeSet.hh>
60 #include <core/conformation/ResidueFactory.hh>
61 #include <core/chemical/VariantType.hh>
62 #include <core/chemical/util.hh>
63 #include <core/chemical/ChemicalManager.hh>
65 #include <core/scoring/rms_util.hh>
66 #include <core/scoring/etable/Etable.hh>
67 #include <core/scoring/ScoringManager.hh>
68 #include <core/scoring/ScoreFunction.hh>
69 #include <core/scoring/ScoreFunctionFactory.hh>
70 #include <core/scoring/Ramachandran.hh>
71 #include <core/scoring/hbonds/HBondSet.hh>
72 #include <core/scoring/hbonds/hbonds.hh>
73 #include <core/scoring/etable/count_pair/CountPairFactory.hh>
74 #include <core/scoring/etable/count_pair/CountPairAll.hh>
75 #include <core/scoring/etable/count_pair/CountPairFunction.hh>
76 #include <core/scoring/etable/EtableEnergy.hh>
77 #include <core/scoring/etable/Etable.hh>
78 #include <core/scoring/etable/BaseEtableEnergy.tmpl.hh>
80 #include <core/pack/rotamer_trials.hh>
81 #include <core/pack/pack_rotamers.hh>
82 #include <core/pack/task/PackerTask.hh>
83 #include <core/pack/task/TaskFactory.hh>
84 #include <core/pack/task/operation/TaskOperations.hh>
85 #include <protocols/toolbox/IGEdgeReweighters.hh>
86 #include <core/pack/task/IGEdgeReweightContainer.hh>
88 #include <core/kinematics/FoldTree.hh>
89 #include <core/kinematics/MoveMap.hh>
90 #include <core/kinematics/util.hh>
92 #include <core/pose/Pose.hh>
93 #include <core/pose/util.hh>
94 #include <core/pose/PDBPoseMap.hh>
95 #include <core/pose/PDBInfo.hh>
96 #include <core/pose/metrics/CalculatorFactory.hh>
106 #include <protocols/init/init.hh>
115 #include <core/scoring/constraints/ConstraintSet.hh>
116 #include <core/scoring/func/FlatHarmonicFunc.hh>
117 #include <core/scoring/constraints/AtomPairConstraint.hh>
118 #include <core/scoring/constraints/CoordinateConstraint.hh>
119 #include <core/scoring/constraints/ConstraintIO.hh>
129 #include <basic/options/keys/in.OptionKeys.gen.hh>
130 #include <basic/options/keys/out.OptionKeys.gen.hh>
131 #include <basic/options/keys/score.OptionKeys.gen.hh>
132 #include <basic/options/keys/pepspec.OptionKeys.gen.hh>
133 #include <basic/options/keys/constraints.OptionKeys.gen.hh>
135 #include <protocols/toolbox/pose_metric_calculators/DecomposeAndReweightEnergiesCalculator.hh>
136 #include <protocols/toolbox/pose_metric_calculators/ResidueDecompositionByChainCalculator.hh>
137 #include <core/pose/metrics/simple_calculators/InterfaceNeighborDefinitionCalculator.hh>
138 #include <core/pose/metrics/simple_calculators/InterfaceSasaDefinitionCalculator.hh>
139 #include <core/pose/metrics/simple_calculators/InterfaceDeltaEnergeticsCalculator.hh>
142 #include <core/import_pose/import_pose.hh>
143 #include <core/io/pdb/pose_io.hh>
144 #include <core/util/SwitchResidueTypeSet.hh>
150 using namespace core;
151 using namespace protocols;
152 using namespace ObjexxFCL;
157 using io::pdb::dump_pdb;
160 using namespace basic::options::OptionKeys;
162 using namespace pose;
163 using namespace chemical;
164 using namespace conformation;
165 using namespace scoring;
166 using namespace optimization;
167 using namespace kinematics;
168 using namespace protocols::moves;
170 using namespace protocols::frags;
246 if ( score <= last_score_ ) {
248 if ( score <= low_score_ ) {
253 Real dE = score - last_score_;
254 Real p = std::exp( -1 * dE / temp_ );
288 case chemical::aa_ala :
291 case chemical::aa_cys :
294 case chemical::aa_asp :
297 case chemical::aa_glu :
300 case chemical::aa_phe :
303 case chemical::aa_gly :
306 case chemical::aa_his :
309 case chemical::aa_ile :
312 case chemical::aa_lys :
315 case chemical::aa_leu :
318 case chemical::aa_met :
321 case chemical::aa_asn :
324 case chemical::aa_pro :
327 case chemical::aa_gln :
330 case chemical::aa_arg :
333 case chemical::aa_ser :
336 case chemical::aa_thr :
339 case chemical::aa_val :
342 case chemical::aa_trp :
345 case chemical::aa_tyr :
361 Size n_pep_nbrs( 0 );
362 for (
Size i=1; i<= pose.total_residue(); ++i ) {
363 if ( !is_pep[i] )
continue;
364 bool cg_res_has_nbr(
false );
365 Residue
const &
rsd1( pose.residue(i) );
366 for (
Size j=1; j<= pose.total_residue(); ++j ) {
367 if ( cg_res_has_nbr )
break;
368 if ( is_pep[j] )
continue;
369 Residue
const &
rsd2( pose.residue(j) );
371 if ( cg_res_has_nbr )
break;
372 for (
Size jj=1; jj<=
rsd2.natoms(); ++jj ) {
373 if (
rsd1.xyz(
ii).distance(
rsd2.xyz(jj) ) < cutoff_cg ) {
374 cg_res_has_nbr =
true;
380 if ( cg_res_has_nbr ) ++n_pep_nbrs;
503 conformation::Residue
const & current_rsd( pose.residue( seqpos ) );
504 if ( current_rsd.aa() == new_aa )
return;
506 ResidueTypeCOP rsd_type( current_rsd.residue_type_set()->get_representative_type_aa( new_aa, current_rsd.type().variant_types() ) );
508 if ( ! rsd_type )
TR <<
"make_sequence_change failed: new_aa= "+name_from_aa(new_aa)+
" -- no matching residue types" << std::endl;
510 conformation::ResidueOP new_rsd( ResidueFactory::create_residue( *rsd_type, current_rsd, pose.conformation() ) );
511 pose.replace_residue( seqpos, *new_rsd,
false );
520 scoring::ScoreFunctionOP
const &
scorefxn,
521 Real const clash_threshold
524 using namespace scoring;
525 using namespace chemical;
527 bool is_clash(
false );
528 for (
Size seqpos = 1; seqpos <= pose.total_residue(); ++seqpos ) {
529 if ( !is_checked[ seqpos ] )
continue;
531 ( *scorefxn )(
pose );
535 Energies & energies( pose.energies() );
538 EnergyGraph & energy_graph( energies.energy_graph() );
541 for ( graph::Graph::EdgeListIter
542 iru = energy_graph.get_node( seqpos )->lower_edge_list_begin(),
543 irue = energy_graph.get_node( seqpos )->lower_edge_list_end();
544 iru != irue; ++iru ) {
545 EnergyEdge * edge( static_cast< EnergyEdge *> (*iru) );
549 EnergyMap
const &
emap( edge->fill_energy_map());
551 if ( clash > clash_threshold ) {
557 if ( is_clash ==
true )
break;
560 for ( graph::Graph::EdgeListIter
561 iru = energy_graph.get_node( seqpos )->upper_edge_list_begin(),
562 irue = energy_graph.get_node( seqpos )->upper_edge_list_end();
563 iru != irue; ++iru ) {
564 EnergyEdge * edge( static_cast< EnergyEdge *> (*iru) );
568 EnergyMap
const &
emap( edge->fill_energy_map());
570 if ( clash > clash_threshold ) {
576 if ( is_clash ==
true )
break;
585 scoring::ScoreFunctionOP
const &
scorefxn,
586 Real const clash_threshold
589 using namespace scoring;
590 using namespace chemical;
593 for (
Size seqpos = 1; seqpos <= pose.total_residue(); ++seqpos ) {
594 if ( !is_checked[ seqpos ] )
continue;
595 ( *scorefxn )(
pose );
597 Energies & energies( pose.energies() );
599 EnergyGraph & energy_graph( energies.energy_graph() );
601 for ( graph::Graph::EdgeListIter
602 iru = energy_graph.get_node( seqpos )->lower_edge_list_begin(),
603 irue = energy_graph.get_node( seqpos )->lower_edge_list_end();
604 iru != irue; ++iru ) {
605 EnergyEdge * edge( static_cast< EnergyEdge *> (*iru) );
606 Size const j( edge->get_first_node_ind() );
609 EnergyMap
const &
emap( edge->fill_energy_map());
611 if ( clash > clash_threshold ) {
612 clash_pairs.push_back( std::pair< Size, Size >( seqpos, j ) );
616 for ( graph::Graph::EdgeListIter
617 iru = energy_graph.get_node( seqpos )->upper_edge_list_begin(),
618 irue = energy_graph.get_node( seqpos )->upper_edge_list_end();
619 iru != irue; ++iru ) {
620 EnergyEdge * edge( static_cast< EnergyEdge *> (*iru) );
621 Size const j( edge->get_second_node_ind() );
624 EnergyMap
const &
emap( edge->fill_energy_map());
626 if ( clash > clash_threshold ) {
627 clash_pairs.push_back( std::pair< Size, Size >( seqpos, j ) );
642 import_pose::pose_from_pdb( ref_pose, ref_name );
645 if (
option[ pepspec::native_pep_anchor ].
user() ) ref_pep_anchor_in =
option[ pepspec::native_pep_anchor ];
647 if (
option[ pepspec::native_pep_chain ].
user() ) ref_pep_chain_in =
option[ pepspec::native_pep_chain ];
648 Size ref_pep_anchor( ref_pose.pdb_info()->pdb2pose( ref_pep_chain_in[0], ref_pep_anchor_in ) );
649 Size ref_pep_chain( ref_pose.chain( ref_pep_anchor ) );
650 Size ref_pep_begin( ref_pose.conformation().chain_begin( ref_pep_chain ) );
651 Size ref_pep_end( ref_pose.conformation().chain_end( ref_pep_chain ) );
655 Size ref_prot_chain( 1 );
656 for (
Size i = 1; i <= ref_pose.conformation().num_chains(); ++i ) {
657 if ( i == ref_pep_chain )
continue;
658 if ( !( ref_pose.residue( ref_pose.conformation().chain_begin( i ) ).is_protein() ) )
continue;
664 Size ref_prot_begin( ref_pose.conformation().chain_begin( ref_prot_chain ) );
667 Size ref_pep_nterm( ref_pep_anchor - ref_pep_begin );
669 Size ref_pep_cterm( ref_pep_end - ref_pep_anchor );
671 Size nterm( pep_nterm );
672 Size cterm( pep_cterm );
673 if ( pep_nterm < ref_pep_nterm ) ref_pep_begin += ref_pep_nterm - pep_nterm;
674 else if ( pep_nterm > ref_pep_nterm ) {
675 this_pep_begin += pep_nterm - ref_pep_nterm;
676 nterm = ref_pep_nterm;
678 if ( pep_cterm < ref_pep_cterm ) ref_pep_end -= ref_pep_cterm - pep_cterm;
679 else if ( pep_cterm > ref_pep_cterm ) {
680 this_pep_end -= pep_cterm - ref_pep_cterm;
681 cterm = ref_pep_cterm;
684 if (
option[ pepspec::native_align ] ) {
685 id::AtomID_Map< id::AtomID > atom_map;
686 pose::initialize_atomid_map( atom_map, pose, id::BOGUS_ATOM_ID );
689 id::AtomID
const id1( pose.residue( i ).atom_index(
"CA" ), i );
690 id::AtomID
const id2( ref_pose.residue( i + static_cast< int >( ref_prot_begin ) - static_cast< int >(
prot_begin ) ).atom_index(
"CA" ), i +
static_cast< int >( ref_prot_begin ) - static_cast< int >(
prot_begin ) );
691 atom_map[ id1 ] = id2;
693 core::scoring::ScoreFunctionOP full_scorefxn( get_score_function() );
694 core::scoring::superimpose_pose( pose, ref_pose, atom_map );
697 Real total_rmsd( 0 );
698 std::string rmsd_analysis(
"" );
699 for (
Size i_seq = 0; i_seq <= nterm + cterm; ++i_seq ) {
700 Size ref_pep_seqpos = ref_pep_begin + i_seq;
701 Size pep_seqpos = this_pep_begin + i_seq;
702 Real sd( ref_pose.residue( ref_pep_seqpos ).xyz(
"CA" ).distance_squared( pose.residue( pep_seqpos ).xyz(
"CA" ) ) );
704 rmsd_analysis +=
"p" +
string_of( i_seq - static_cast< int >( nterm ) ) +
"_rmsd:\t" +
string_of( std::sqrt( sd ) ) +
"\t";
706 total_rmsd = std::sqrt( total_rmsd / ( nterm+cterm+1 ) );
707 rmsd_analysis +=
"total_rmsd:\t" +
string_of( total_rmsd ) +
"\t";
708 return rmsd_analysis;
720 import_pose::pose_from_pdb( ref_pose, ref_name );
723 if (
option[ pepspec::native_pep_anchor ].
user() ) ref_pep_anchor_in =
option[ pepspec::native_pep_anchor ];
725 if (
option[ pepspec::native_pep_chain ].
user() ) ref_pep_chain_in =
option[ pepspec::native_pep_chain ];
726 Size ref_pep_anchor( ref_pose.pdb_info()->pdb2pose( ref_pep_chain_in[0], ref_pep_anchor_in ) );
727 Size ref_pep_chain( ref_pose.chain( ref_pep_anchor ) );
728 Size ref_pep_begin( ref_pose.conformation().chain_begin( ref_pep_chain ) );
729 Size ref_pep_end( ref_pose.conformation().chain_end( ref_pep_chain ) );
734 Size ref_pep_nterm( ref_pep_anchor - ref_pep_begin );
736 Size ref_pep_cterm( ref_pep_end - ref_pep_anchor );
738 Size nterm( pep_nterm );
739 Size cterm( pep_cterm );
740 if ( pep_nterm < ref_pep_nterm ) ref_pep_begin += ref_pep_nterm - pep_nterm;
741 else if ( pep_nterm > ref_pep_nterm ) {
742 this_pep_begin += pep_nterm - ref_pep_nterm;
743 nterm = ref_pep_nterm;
745 if ( pep_cterm < ref_pep_cterm ) ref_pep_end -= ref_pep_cterm - pep_cterm;
746 else if ( pep_cterm > ref_pep_cterm ) {
747 this_pep_end -= pep_cterm - ref_pep_cterm;
748 cterm = ref_pep_cterm;
751 std::string phipsi_analysis(
"" );
752 for (
Size i_seq = 0; i_seq <= nterm + cterm; ++i_seq ) {
753 Size ref_pep_seqpos = ref_pep_begin + i_seq;
754 Size pep_seqpos = this_pep_begin + i_seq;
758 Real phi(
std::abs( ref_pose.phi( ref_pep_seqpos ) - pose.phi( pep_seqpos ) ) );
759 if ( phi > 180 ) phi =
std::abs( 360 -phi );
760 ramadev += ( phi * phi );
761 phipsi_analysis +=
"p" +
string_of( i_seq - static_cast< int >( nterm ) ) +
"_phi:\t" +
string_of( phi ) +
"\t";
763 Real psi(
std::abs( ref_pose.psi( ref_pep_seqpos ) - pose.psi( pep_seqpos ) ) );
764 if ( psi > 180 ) psi =
std::abs( 360 - psi );
765 ramadev += ( psi * psi );
766 phipsi_analysis +=
"p" +
string_of( i_seq - static_cast< int >( nterm ) ) +
"_psi:\t" +
string_of( psi ) +
"\t";
768 Real omega(
std::abs( ref_pose.omega( ref_pep_seqpos ) - pose.omega( pep_seqpos ) ) );
769 if ( omega > 180 ) omega =
std::abs( 360 - omega );
770 phipsi_analysis +=
"p" +
string_of( i_seq - static_cast< int >( nterm ) ) +
"_omega:\t" +
string_of( omega ) +
"\t";
772 phipsi_analysis +=
"p" +
string_of( i_seq - static_cast< int >( nterm ) ) +
"_ramadev:\t" +
string_of( std::sqrt( ramadev / 2 ) ) +
"\t";
774 return phipsi_analysis;
782 add_lower_terminus_type_to_pose_residue( pose,
pep_begin );
783 add_upper_terminus_type_to_pose_residue( pose,
pep_end );
784 pose.conformation().update_polymeric_connection(
pep_begin );
785 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
786 pose.conformation().update_polymeric_connection(
pep_end );
787 pose.conformation().update_polymeric_connection(
pep_end - 1 );
798 ResidueTypeSet
const & rsd_set( *pose.residue(1).residue_type_set() );
799 ResidueOP vrt( ResidueFactory::create_residue( rsd_set.name_map(
"GLY" ) ) );
803 pose.conformation().safely_append_polymer_residue_after_seqpos( *vrt,
pep_end,
false );
805 pose.set_omega(
pep_end - 1, 180.0 );
806 pose.conformation().update_polymeric_connection(
pep_end );
807 pose.conformation().update_polymeric_connection(
pep_end - 1 );
808 add_variant_type_to_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_end );
812 pose.conformation().safely_prepend_polymer_residue_before_seqpos( *vrt,
pep_begin,
false );
816 pose.conformation().update_polymeric_connection(
pep_begin );
817 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
818 add_variant_type_to_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_begin );
832 pose.conformation().delete_residue_slow(
pep_end );
834 pose.conformation().update_polymeric_connection(
pep_end );
835 pose.conformation().update_polymeric_connection(
pep_end - 1 );
839 pose.conformation().delete_residue_slow(
pep_begin );
842 pose.conformation().update_polymeric_connection(
pep_begin );
843 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
856 if (
option[ pepspec::remove_input_bb ] ) {
859 pose.conformation().delete_residue_slow(
pep_begin );
862 pose.conformation().update_polymeric_connection(
pep_begin );
863 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
866 pose.conformation().delete_residue_slow(
pep_end );
868 pose.conformation().update_polymeric_connection(
pep_end );
869 pose.conformation().update_polymeric_connection(
pep_end - 1 );
874 ResidueTypeSet
const & rsd_set( *pose.residue(1).residue_type_set() );
877 std::string pep_anchor_type( pose.residue(
pep_anchor ).name3() );
887 RT
const rt( pose.conformation().get_stub_transform( upstubid, downstubid ) );
891 ResidueOP pep_anchor_res_ptr( ResidueFactory::create_residue( pose.residue( 1 ).residue_type_set()->name_map( pep_anchor_type ) ) );
892 pose.append_residue_by_jump( *pep_anchor_res_ptr,
prot_anchor,
"",
"",
true );
893 pose.conformation().set_stub_transform( upstubid, downstubid, rt );
894 for (
Size i_chi = 1; i_chi <= pose.residue(
pep_anchor ).nchi(); ++i_chi ) {
898 Residue pep_anchor_res = pose.residue(
pep_anchor );
901 pose.fold_tree( start_pose.fold_tree() );
904 std::string cg_res_type(
option[ pepspec::cg_res_type ] );
905 ResidueOP
res( ResidueFactory::create_residue( rsd_set.name_map( cg_res_type ) ) );
928 pep_cst_vector.x( pep_cst.
x );
929 pep_cst_vector.y( pep_cst.
y );
930 pep_cst_vector.z( pep_cst.
z );
931 ConstraintCOP this_cst(
ConstraintOP(
new CoordinateConstraint( AtomID( pose.residue( seqpos ).atom_index( pep_cst.
atom_name ), seqpos ), AtomID( pose.residue(
prot_anchor ).atom_index(
"CA" ),
prot_anchor ), pep_cst_vector, core::scoring::func::FuncOP(
new core::scoring::func::FlatHarmonicFunc( pep_cst.
x0, pep_cst.
sd, pep_cst.
tol ) ) ) ) );
933 pose.add_constraint( this_cst );
976 core::fragment::FragSetCOP
980 std::string
const &
seq
984 core::fragment::FragSetOP
fragset(
new core::fragment::ConstantLengthFragSet( frags_length ) );
985 std::string ss_string( frags_length,
'L' );
986 core::fragment::FragDataOPs list;
988 for (
core::Size j = start; j <= stop - frags_length + 1; ++j ) {
989 std::string
const seqsubstr( seq, j-1, frags_length );
990 list = core::fragment::picking_old::vall::pick_fragments_by_ss_plus_aa( ss_string, seqsubstr, 200,
false );
991 core::fragment::FrameOP
frame;
992 frame = core::fragment::FrameOP(
new core::fragment::Frame( j ) );
993 frame->add_fragment( list );
994 fragset->add( frame );
1000 core::fragment::FragSetCOP
1004 std::string
const &
seq,
1009 core::fragment::FragSetOP
fragset(
new core::fragment::ConstantLengthFragSet( frags_length ) );
1011 core::fragment::FragDataOPs list;
1013 for (
core::Size j = seqpos_start; j <= seqpos_stop - frags_length + 1; ++j ) {
1016 std::string ss_string(
"L" );
1017 if (
option[ pepspec::ss_type ].
user() ) ss_string = std::string(
option[ pepspec::ss_type ] );
1024 std::string
const seqsubstr( seq, j-1, frags_length );
1025 list = core::fragment::picking_old::vall::pick_fragments_by_ss_plus_aa( ss_string, seqsubstr, nfrags,
true );
1026 }
else list = core::fragment::picking_old::vall::pick_fragments_by_ss( ss_string, nfrags,
true );
1027 core::fragment::FrameOP
frame;
1028 frame = core::fragment::FrameOP(
new core::fragment::Frame( j ) );
1029 frame->add_fragment( list );
1030 fragset->add( frame );
1038 scoring::ScoreFunctionOP cen_scorefxn
1041 using namespace scoring;
1042 using namespace chemical;
1043 using namespace scoring::methods;
1044 using namespace scoring::etable;
1045 using namespace scoring::etable::count_pair;
1046 using core::pack::task::operation::TaskOperationCOP;
1048 Size n_build_loop(
option[ pepspec::n_build_loop ] );
1049 Size n_prepend(
option[ pepspec::n_prepend ] );
1050 Size n_append(
option[ pepspec::n_append ] );
1052 ( *cen_scorefxn )(
pose );
1053 Real min_score( pose.energies().total_energies()[ vdw ] );
1054 Real clash_cutoff(
option[ pepspec::clash_cutoff ] );
1055 clash_cutoff =
std::max( clash_cutoff, pose.energies().total_energies()[ fa_rep ] );
1057 Pose replace_res_pose( pose );
1058 ResidueTypeSet
const & rsd_set( *pose.residue(1).residue_type_set() );
1059 std::string cg_res_type(
option[ pepspec::cg_res_type ] );
1060 ResidueOP
res( ResidueFactory::create_residue( rsd_set.name_map( cg_res_type ) ) );
1061 Size break_loop( 0 );
1062 Size n_prepended( 0 );
1063 Size n_appended( 0 );
1065 while ( ( n_prepended < n_prepend || n_appended < n_append ) ) {
1066 Size this_prepend( n_prepend );
1067 Size this_append( n_append );
1072 if ( this_prepend + this_append == 0 )
continue;
1075 std::string this_input_seq(
input_seq );
1076 for (
Size ii = 1;
ii <= this_prepend; ++
ii ) {
1078 pose.prepend_polymer_residue_before_seqpos( *res,
pep_begin,
true );
1082 pose.conformation().update_polymeric_connection(
pep_begin );
1083 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
1085 for (
Size ii = 1;
ii <= this_append; ++
ii ) {
1087 pose.append_polymer_residue_after_seqpos( *res,
pep_end,
true );
1089 pose.set_omega(
pep_end - 1, 180.0 );
1090 pose.conformation().update_polymeric_connection(
pep_end );
1091 pose.conformation().update_polymeric_connection(
pep_end - 1 );
1094 this_input_seq.erase( n_prepended + this_prepend + 1, n_append - n_appended - this_append );
1095 this_input_seq.erase( 0, n_prepend - n_prepended - this_prepend );
1099 char this_input_seq_aa( this_input_seq[ this_input_seq_pos ] );
1100 if ( this_input_seq_aa !=
'X' ) {
1106 pose.update_residue_neighbors();
1109 if (
option[ pepspec::homol_csts ].
user() ) {
1110 cen_scorefxn->set_weight( coordinate_constraint,
option[ OptionKeys::constraints::cst_weight ] );
1117 for (
Size i = 1; i <= pose.total_residue(); ++i ) is_pep[ i ] = ( i >=
pep_begin && i <=
pep_end );
1119 kinematics::MoveMapOP mm_frag(
new kinematics::MoveMap );
1120 for (
Size ii = 1;
ii <= this_prepend + 1; ++
ii ) {
1122 mm_frag->set_bb( moveable_seqpos,
true );
1125 for (
Size ii = nres_pep;
ii >= nres_pep - this_append; --
ii ) {
1127 mm_frag->set_bb( moveable_seqpos,
true );
1131 ( *cen_scorefxn )(
pose );
1132 Real best_score( pose.energies().total_energies()[ total_score ] );
1133 MonteCarloOP mc_frag(
new MonteCarlo( pose, *cen_scorefxn, 2.0 ) );
1136 if (
option[ pepspec::no_cen_rottrials ] ) {
1138 if ( pose.residue( seqpos ).name1() !=
'G' && pose.residue( seqpos ).name1() !=
'P' ) {
1145 if ( !
option[ pepspec::use_input_bb ] && n_build_loop > 0 ) {
1150 Size( n_build_loop *
std::max( this_prepend, this_append ) /
std::max( n_prepend, n_append ) ) ) );
1153 Size const nfrags( this_build_loop );
1155 protocols::simple_moves::ClassicFragmentMover frag_mover( fragset, mm_frag );
1157 for (
Size build_loop_inner = 1; build_loop_inner <= this_build_loop; ++build_loop_inner ) {
1167 frag_mover.apply( pose );
1172 Real test_score( pose.energies().total_energies().dot( cen_scorefxn->weights() ) );
1173 if ( mc_frag->boltzmann( pose ) ) {
1175 if ( test_score <= best_score ) {
1176 best_score = test_score;
1177 mc_frag->reset( pose );
1181 mc_frag->recover_low( pose );
1183 ( *cen_scorefxn )(
pose );
1185 bool this_has_clash(
false );
1189 if (
has_clash( pose, is_pep, cen_scorefxn, clash_cutoff ) ) {
1190 this_has_clash =
true;
1193 if ( pose.residue( seqpos ).name1() !=
'G' && pose.residue( seqpos ).name1() !=
'P' ) {
1194 pose.replace_residue( seqpos, replace_res_pose.residue( seqpos ), true );
1197 }
else if (
option[ pepspec::no_cen_rottrials ] ) {
1201 for (
Size i = 1; i <= pose.total_residue() - 1; ++i ) {
1203 this_clash[ i ] =
true;
1204 if (
has_clash( pose, this_clash, cen_scorefxn, clash_cutoff ) ) {
1205 ignore_clash[ i ] =
true;
1210 pose.replace_residue( seqpos, replace_res_pose.residue( seqpos ), true );
1213 if (
has_clash( pose, is_pep, cen_scorefxn, clash_cutoff ) ) {
1217 for (
Size i = 1; i <= clash_pairs.size(); ++i ) {
1218 std::pair< Size, Size > clash_pair( clash_pairs[ i ] );
1219 Size this_clash( clash_pair.second );
1220 EnergyGraph
const & energy_graph( pose.energies().energy_graph() );
1221 for ( graph::Graph::EdgeListConstIter
1222 ir = energy_graph.get_node( this_clash )->const_edge_list_begin(),
1223 ire = energy_graph.get_node( this_clash )->const_edge_list_end();
1225 Size this_nbr( (*ir)->get_other_ind( this_clash ) );
1226 repack_this[ this_nbr ] =
true;
1230 pack::task::TaskFactoryOP rp_task_factory(
new pack::task::TaskFactory );
1231 pack::task::operation::RestrictResidueToRepackingOP restrict_to_repack_taskop(
new pack::task::operation::RestrictResidueToRepacking() );
1232 pack::task::operation::PreventRepackingOP prevent_repack_taskop(
new pack::task::operation::PreventRepacking() );
1233 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1234 if ( repack_this[ i ] ) restrict_to_repack_taskop->include_residue( i );
1235 else prevent_repack_taskop->include_residue( i );
1237 rp_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::IncludeCurrent() ) );
1238 rp_task_factory->push_back( restrict_to_repack_taskop );
1239 rp_task_factory->push_back( prevent_repack_taskop );
1240 protocols::simple_moves::RotamerTrialsMoverOP dz_rottrial(
new protocols::simple_moves::RotamerTrialsMover( cen_scorefxn, rp_task_factory ) );
1241 dz_rottrial->apply( pose );
1244 for (
Size i = 1; i <= pose.total_residue() - 1; ++i )
if ( is_pep[ i ] || ( repack_this[ i ] && !ignore_clash[ i ] ) ) check_clash[ i ] =
true;
1246 this_has_clash =
has_clash( pose, check_clash, cen_scorefxn, clash_cutoff );
1250 Real clash_score( pose.energies().total_energies()[ vdw ] );
1251 this_has_clash = ( clash_score > min_score + 0.03 );
1255 if ( break_loop < 5 && this_has_clash ) {
1258 for (
Size ii = 1;
ii <= this_prepend; ++
ii ) {
1259 pose.conformation().delete_residue_slow(
pep_begin );
1262 pose.conformation().update_polymeric_connection(
pep_begin );
1263 pose.conformation().update_polymeric_connection(
pep_begin + 1 );
1265 for (
Size ii = 1;
ii <= this_append; ++
ii ) {
1266 pose.conformation().delete_residue_slow(
pep_end );
1268 pose.conformation().update_polymeric_connection(
pep_end );
1269 pose.conformation().update_polymeric_connection(
pep_end - 1 );
1272 n_prepended += this_prepend;
1273 n_appended += this_append;
1282 kinematics::MoveMapOP mm_move,
1283 scoring::ScoreFunctionOP cen_scorefxn,
1287 ( *cen_scorefxn )(
pose );
1288 protocols::simple_moves::SmallMoverOP cg_small(
new protocols::simple_moves::SmallMover( mm_move, 5.0, 1 ) );
1289 cg_small->angle_max(
'H', 10.0 );
1290 cg_small->angle_max(
'E', 10.0 );
1291 cg_small->angle_max(
'L', 10.0 );
1293 MonteCarloOP mc_cg(
new MonteCarlo( pose, *cen_scorefxn, 2.0 ) );
1294 Real best_score( pose.energies().total_energies().dot( cen_scorefxn->weights() ) );
1295 for (
Size cgmove_loop = 1; cgmove_loop <= n_iter; cgmove_loop++ ) {
1296 cg_small->apply( pose );
1297 if ( mc_cg->boltzmann( pose ) ) {
1298 Real test_score( pose.energies().total_energies().dot( cen_scorefxn->weights() ) );
1299 if ( test_score <= best_score ) {
1300 best_score = test_score;
1301 mc_cg->reset( pose );
1305 mc_cg->recover_low( pose );
1312 ScoreFunctionOP soft_scorefxn,
1313 ScoreFunctionOP full_scorefxn
1317 assert( is_mutable.size() == pose.total_residue() );
1318 bool mutate(
false );
1322 mutate = is_mutable[ seqpos ];
1329 using core::pack::task::operation::TaskOperationCOP;
1330 pack::task::TaskFactoryOP mut_task_factory(
new pack::task::TaskFactory );
1332 pack::task::operation::RestrictResidueToRepackingOP restrict_to_repack_taskop(
new pack::task::operation::RestrictResidueToRepacking() );
1333 pack::task::operation::PreventRepackingOP prevent_repack_taskop(
new pack::task::operation::PreventRepacking() );
1334 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1335 if ( i == seqpos ) restrict_to_repack_taskop->include_residue( i );
1336 else prevent_repack_taskop->include_residue( i );
1338 mut_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::InitializeFromCommandline() ) );
1339 mut_task_factory->push_back( restrict_to_repack_taskop );
1340 mut_task_factory->push_back( prevent_repack_taskop );
1342 protocols::simple_moves::RotamerTrialsMoverOP mut_rottrial(
new protocols::simple_moves::RotamerTrialsMover( soft_scorefxn, mut_task_factory ) );
1343 mut_rottrial->apply( pose );
1347 EnergyGraph
const & energy_graph( pose.energies().energy_graph() );
1348 for ( graph::Graph::EdgeListConstIter
1349 ir = energy_graph.get_node( seqpos )->const_edge_list_begin(),
1350 ire = energy_graph.get_node( seqpos )->const_edge_list_end();
1352 Size i_nbr( (*ir)->get_other_ind( seqpos ) );
1353 is_nbr[ i_nbr ] =
true && ( i_nbr !=
pep_anchor );
1357 pack::task::TaskFactoryOP rp_task_factory(
new pack::task::TaskFactory );
1359 pack::task::operation::RestrictResidueToRepackingOP restrict_to_repack_taskop(
new pack::task::operation::RestrictResidueToRepacking() );
1360 pack::task::operation::PreventRepackingOP prevent_repack_taskop(
new pack::task::operation::PreventRepacking() );
1361 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1362 if ( ( i == seqpos || is_nbr[ i ] ) && i !=
pep_anchor ) restrict_to_repack_taskop->include_residue( i );
1363 else prevent_repack_taskop->include_residue( i );
1365 rp_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::InitializeFromCommandline() ) );
1366 rp_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::IncludeCurrent() ) );
1367 rp_task_factory->push_back( restrict_to_repack_taskop );
1368 rp_task_factory->push_back( prevent_repack_taskop );
1370 protocols::simple_moves::RotamerTrialsMoverOP rp_rottrial(
new protocols::simple_moves::RotamerTrialsMover( soft_scorefxn, rp_task_factory ) );
1371 rp_rottrial->apply( pose );
1387 kinematics::MoveMapOP mm_min(
new kinematics::MoveMap );
1388 mm_min->set_chi( seqpos );
1389 mm_min->set_chi( is_nbr );
1390 protocols::simple_moves::MinMoverOP
min_mover(
new protocols::simple_moves::MinMover( mm_min, full_scorefxn,
"dfpmin", 0.001,
true ) );
1391 min_mover->apply( pose );
1397 scoring::ScoreFunctionOP full_scorefxn
1400 pose.update_residue_neighbors();
1401 ( *full_scorefxn )(
pose );
1402 pack::task::PackerTaskOP
task( pack::task::TaskFactory::create_packer_task( pose ));
1403 task->initialize_from_command_line().or_include_current(
true );
1404 task->restrict_to_repacking();
1405 protocols::simple_moves::PackRotamersMoverOP
pack(
new protocols::simple_moves::PackRotamersMover( full_scorefxn, task, 1 ) );
1406 pack->apply( pose );
1407 kinematics::MoveMapOP
mm(
new kinematics::MoveMap );
1408 mm->set_chi(
true );
1409 protocols::simple_moves::MinMoverOP
min_mover(
new protocols::simple_moves::MinMover( mm, full_scorefxn,
"dfpmin", 0.001,
true ) );
1410 min_mover->apply( pose );
1417 ScoreFunctionOP full_scorefxn
1420 ( *full_scorefxn )(
pose );
1421 Real total_score( pose.energies().total_energies().dot( full_scorefxn->weights() ) );
1422 Pose pep_pose( *pose.split_by_chain( pep_chain ) );
1424 ( *full_scorefxn )( pep_pose );
1425 Real pep_score = pep_pose.energies().total_energies().dot( full_scorefxn->weights() );
1426 Real bind_score = total_score - pep_score;
1433 std::string pdb_name,
1434 std::fstream & out_file,
1437 ScoreFunctionOP full_scorefxn,
1442 ( *full_scorefxn )(
pose );
1443 std::string output_seq;
1445 output_seq.append( 1, pose.residue( i ).name1() );
1447 Real total_score( pose.energies().total_energies().dot( full_scorefxn->weights() ) );
1448 out_file << pdb_name +
"\t" << output_seq <<
"\t" << pose.energies().total_energies().weighted_string_of( full_scorefxn->weights() );
1449 out_file<<
"\ttotal_score:\t"<<total_score<<
"\t";
1450 out_file<<
"total-prot_score:\t"<<total_score - prot_score<<
"\t";
1451 if (
option[ pepspec::homol_csts ].
user() ) {
1452 full_scorefxn->set_weight( coordinate_constraint,
option[ OptionKeys::constraints::cst_weight ] );
1453 ( *full_scorefxn )(
pose );
1454 out_file <<
"coordinate_constraint:\t" << pose.energies().total_energies()[ coordinate_constraint ] <<
"\t";
1455 out_file <<
"total_cst_score:\t" << pose.energies().total_energies().dot( full_scorefxn->weights() ) <<
"\t";
1457 full_scorefxn->set_weight( coordinate_constraint, 0 );
1458 ( *full_scorefxn )(
pose );
1461 if (
option[ pepspec::binding_score ] ) {
1470 out_file<<
"binding_score:\t"<<bind_score<<
"\t";
1471 out_file<<
"binding-prot_score:\t"<<bind_score - prot_score<<
"\t";
1474 if (
option[ pepspec::upweight_interface ] ) {
1476 pose.metric(
"energy_decomposition",
"weighted_total", weighted_interface_score);
1477 out_file <<
"reweighted_score:\t" +
string_of( weighted_interface_score.
value() ) +
"\t";
1480 pose.metric(
"interface_delta_energies",
"weighted_total", interface_score );
1481 out_file <<
"interface_score:\t" +
string_of( interface_score.
value() ) +
"\t";
1482 if (
option[ pepspec::calc_sasa ] ) {
1484 pose.metric(
"sasa_interface",
"delta_sasa", delta_sasa );
1485 out_file <<
"interface_sasa:\t" +
string_of( delta_sasa.
value() ) +
"\t";
1489 out_file<<std::endl;
1490 if ( dump_pdb ) pose.dump_scored_pdb( pdb_name, *full_scorefxn );
1498 Size n_peptides(
option[ pepspec::n_peptides ] );
1499 Size n_cgrelax_loop(
option[ pepspec::n_cgrelax_loop ] );
1502 std::string out_nametag(
"data" );
1504 std::string pdb_dir( out_nametag +
".pdbs" );
1505 std::string pdb_name;
1507 std::string out_file_name_str( out_nametag +
".spec" );
1508 char const *out_file_name = out_file_name_str.c_str();
1509 std::fstream out_file( out_file_name, std::ios::out );
1515 std::string pdb_list_filename(
option[ pepspec::pdb_list ] );
1516 std::ifstream pdb_list_data( pdb_list_filename.c_str() );
1517 if ( !pdb_list_data.good() ) {
1520 std::string pdb_list_line;
1521 while ( !
getline( pdb_list_data, pdb_list_line,
'\n' ).eof() ) {
1522 std::string this_filename( pdb_list_line );
1523 pdb_filenames.push_back( this_filename );
1530 Size n_prepend(
option[ pepspec::n_prepend ] );
1531 Size n_append(
option[ pepspec::n_append ] );
1533 bool const save_low_pdbs(
option[ pepspec::save_low_pdbs ] );
1534 bool const save_all_pdbs(
option[ pepspec::save_all_pdbs ] );
1537 if (
option[ pepspec::homol_csts ].
user() ) {
1539 std::string cst_filename(
option[ pepspec::homol_csts ] );
1540 std::ifstream
cst_file( cst_filename.c_str() );
1541 std::string str_buffer;
1548 std::istringstream istr_buffer( str_buffer );
1549 istr_buffer >> pep_cst.
pep_pos;
1553 std::istringstream istr_buffer( str_buffer );
1554 istr_buffer >> pep_cst.
x;
1558 std::istringstream istr_buffer( str_buffer );
1559 istr_buffer >> pep_cst.
y;
1563 std::istringstream istr_buffer( str_buffer );
1564 istr_buffer >> pep_cst.
z;
1568 std::istringstream istr_buffer( str_buffer );
1569 istr_buffer >> pep_cst.
x0;
1573 std::istringstream istr_buffer( str_buffer );
1574 istr_buffer >> pep_cst.
sd;
1578 std::istringstream istr_buffer( str_buffer );
1579 istr_buffer >> pep_cst.
tol;
1587 core::scoring::ScoreFunctionOP full_scorefxn( get_score_function() );
1588 core::scoring::ScoreFunctionOP soft_scorefxn( ScoreFunctionFactory::create_score_function(
option[ pepspec::soft_wts ] ) );
1589 core::scoring::ScoreFunctionOP cen_scorefxn(
new core::scoring::ScoreFunction() );
1591 cen_scorefxn = ScoreFunctionFactory::create_score_function(
option[ pepspec::cen_wts ] );
1593 cen_scorefxn->set_weight( fa_rep, 0.5 );
1606 core::pose::metrics::CalculatorFactory & calculator_factory(core::pose::metrics::CalculatorFactory::Instance());
1607 protocols::toolbox::pose_metric_calculators::ResidueDecompositionByChainCalculatorOP res_decomp_calculator(
new protocols::toolbox::pose_metric_calculators::ResidueDecompositionByChainCalculator() );
1608 calculator_factory.register_calculator(
"residue_decomposition", res_decomp_calculator);
1609 protocols::toolbox::pose_metric_calculators::DecomposeAndReweightEnergiesCalculatorOP decomp_reweight_calculator(
new protocols::toolbox::pose_metric_calculators::DecomposeAndReweightEnergiesCalculator(
"residue_decomposition" ) );
1610 vector1< Real > reweight_vector( 1, 3.0 ); reweight_vector.push_back( 2.0 );
1611 decomp_reweight_calculator->master_weight_vector( reweight_vector );
1612 decomp_reweight_calculator->num_sets( (
Size ) 2 );
1613 calculator_factory.register_calculator(
"energy_decomposition", decomp_reweight_calculator);
1614 core::pose::metrics::PoseMetricCalculatorOP int_calculator(
new core::pose::metrics::simple_calculators::InterfaceNeighborDefinitionCalculator( (
Size)1, (
Size)2 ) );
1615 calculator_factory.register_calculator(
"interface", int_calculator );
1616 core::pose::metrics::PoseMetricCalculatorOP int_delta_energy_calculator(
new core::pose::metrics::simple_calculators::InterfaceDeltaEnergeticsCalculator(
"interface" ) );
1617 calculator_factory.register_calculator(
"interface_delta_energies", int_delta_energy_calculator );
1618 core::pose::metrics::PoseMetricCalculatorOP int_sasa_calculator(
new core::pose::metrics::simple_calculators::InterfaceSasaDefinitionCalculator( (
Size)1, (
Size)2 ) );
1619 calculator_factory.register_calculator(
"sasa_interface", int_sasa_calculator );
1621 int pose_index( 0 );
1622 if (
option[ pepspec::run_sequential ] ) n_peptides = pdb_filenames.size();
1623 for (
Size peptide_loop = 1; peptide_loop <= n_peptides; ++peptide_loop ) {
1643 if (
option[ pepspec::run_sequential ] ) ++pose_index;
1645 std::string
pdb_filename( pdb_filenames[ pose_index ] );
1646 TR<<
"Initializing "<< out_nametag +
"_" +
string_of( peptide_loop ) +
" with " + pdb_filename << std::endl;
1647 import_pose::pose_from_pdb( pose, pdb_filename );
1654 pep_anchor = pose.pdb_info()->pdb2pose( pep_chain_in[ 0 ], pep_anchor_in );
1666 for (
Size i = 1; i <= pose.conformation().num_chains(); ++i ) {
1668 if ( !( pose.residue( pose.conformation().chain_begin( i ) ).is_protein() ) )
continue;
1682 FoldTree
f( pose.total_residue() );
1684 std::string pep_anchor_root(
"CB" );
1685 if ( pose.residue(
pep_anchor ).name1() ==
'G' ) pep_anchor_root =
"CA";
1689 f.set_jump_atoms(
pep_jump,
"CA", pep_anchor_root );
1694 f.set_jump_atoms(
pep_jump, pep_anchor_root,
"CA" );
1699 TR <<
f << std::endl;
1702 pose.fold_tree(
f );
1706 ( *full_scorefxn )( prot_pose );
1708 Real prot_score( prot_pose.energies().total_energies().dot( full_scorefxn->weights() ) );
1710 protocols::viewer::add_conformation_viewer( pose.conformation(),
"pepspec_pose" );
1716 input_seq = std::string( n_prepend + n_append + 1,
'X' );
1724 Residue pep_anchor_res = pose.residue(
pep_anchor );
1727 if ( !
option[ pepspec::no_cen ] ) core::util::switch_to_residue_type_set( pose, core::chemical::CENTROID );
1728 ( *cen_scorefxn )(
pose );
1730 Real min_vdw( pose.energies().total_energies()[ vdw ] );
1734 if (
option[ pepspec::homol_csts ].
user() ) {
1735 cen_scorefxn->set_weight( coordinate_constraint,
option[ OptionKeys::constraints::cst_weight ] );
1739 ( *cen_scorefxn )(
pose );
1740 if ( peptide_loop > 1 && pose.energies().total_energies()[ vdw ] > min_vdw + 0.1 ) {
1746 vector1< bool > is_pep( pose.total_residue(), false ), is_mutable( pose.total_residue(), false ), is_prot( pose.total_residue(), false ), is_anchor( pose.total_residue(), false );
1748 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1750 if ( is_pep[ i ] ) pep_res_vec.push_back( i );
1758 Pose restart_cgrelax_pose( pose );
1762 for (
Size cgrelax_loop = 1; cgrelax_loop <= n_cgrelax_loop; cgrelax_loop++ ) {
1763 pose = restart_cgrelax_pose;
1769 kinematics::MoveMapOP mm_min(
new kinematics::MoveMap );
1770 mm_min->set_chi( is_pep );
1773 kinematics::MoveMapOP mm_move(
new kinematics::MoveMap );
1774 mm_move->set_bb( is_pep );
1777 Size n_cgperturb_iter( 100 );
1778 if (
option[ pepspec::use_input_bb ] ) n_cgperturb_iter =
option[ pepspec::n_build_loop ];
1779 if ( cgrelax_loop > 1 ||
option[ pepspec::use_input_bb ] ) {
1784 if (
option[ pepspec::dump_cg_bb ] ) {
1786 std::string pdb_name( pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
".pdb" );
1787 if ( n_cgrelax_loop > 1 ) pdb_name = pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
"_" +
string_of( cgrelax_loop ) +
".pdb";
1788 if (
option[ pepspec::save_low_pdbs ] ) pose.dump_scored_pdb( pdb_name, *full_scorefxn );
1789 ( *cen_scorefxn )(
pose );
1790 out_file << pdb_name +
"\t"<<pose.energies().total_energies().weighted_string_of( cen_scorefxn->weights() );
1791 out_file<<
"\ttotal_score:\t"<<pose.energies().total_energies()[ total_score ]<<
"\t";
1794 out_file<<std::endl;
1799 if (
option[ pepspec::add_buffer_res ] ) {
1800 core::pose::remove_variant_type_from_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_begin );
1801 core::pose::remove_variant_type_from_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_end );
1803 core::util::switch_to_residue_type_set( pose, core::chemical::FA_STANDARD );
1804 if (
option[ pepspec::add_buffer_res ] ) {
1805 core::pose::add_variant_type_to_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_begin );
1806 core::pose::add_variant_type_to_pose_residue( pose, core::chemical::VIRTUAL_BB,
pep_end );
1811 pose.replace_residue(
resnum, start_pose.residue(
resnum ), true );
1813 pose.replace_residue(
pep_anchor, pep_anchor_res,
true );
1818 full_scorefxn->set_weight( coordinate_constraint, 0 );
1821 if ( !(
option[ pepspec::no_design ] ||
option[ pepspec::input_seq ].
user() ) ) {
1834 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1835 Residue
const &
rsd1( pose.residue(i) );
1836 if ( is_pep[i] )
continue;
1837 for (
Size j=1; j<= pose.total_residue(); ++j ) {
1838 Residue
const &
rsd2( pose.residue(j) );
1839 if ( !is_pep[j] )
continue;
1840 if ( is_pep_nbr[i] )
break;
1842 if ( is_pep_nbr[i] )
break;
1843 for (
Size jj=1; jj<=
rsd2.natoms(); ++jj ) {
1844 if (
rsd1.xyz(
ii).distance(
rsd2.xyz(jj) ) < cutoff ) {
1845 is_pep_nbr[i] =
true;
1846 nbr_res_vec.push_back( i );
1853 mm_min->set_chi( is_pep_nbr );
1856 protocols::simple_moves::MinMoverOP
min_mover(
new protocols::simple_moves::MinMover( mm_min, full_scorefxn,
"dfpmin", 0.001,
true ) );
1858 MonteCarloOP mc_relax(
new MonteCarlo( pose, *full_scorefxn, 1.0 ) );
1861 myMC mc_bind( pose, bind_score, 1.0 );
1864 pack::task::TaskFactoryOP dz_task_factory(
new pack::task::TaskFactory );
1866 pack::task::operation::RestrictResidueToRepackingOP restrict_to_repack_taskop(
new pack::task::operation::RestrictResidueToRepacking() );
1867 pack::task::operation::PreventRepackingOP prevent_repack_taskop(
new pack::task::operation::PreventRepacking() );
1868 for (
Size i=1; i<= pose.total_residue(); ++i ) {
1871 restrict_to_repack_taskop->include_residue( i );
1873 }
else if ( is_pep_nbr[i] && is_prot[i] ) {
1874 restrict_to_repack_taskop->include_residue( i );
1876 prevent_repack_taskop->include_residue( i );
1879 using core::pack::task::operation::TaskOperationCOP;
1880 if ( !
option[ pepspec::diversify_pep_seqs ].
user() ) dz_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::InitializeFromCommandline() ) );
1881 dz_task_factory->push_back( TaskOperationCOP(
new pack::task::operation::IncludeCurrent() ) );
1882 dz_task_factory->push_back( restrict_to_repack_taskop );
1883 dz_task_factory->push_back( prevent_repack_taskop );
1888 pack::task::PackerTaskOP dz_task( dz_task_factory->create_task_and_apply_taskoperations( pose ));
1891 if (
option[ pepspec::upweight_interface ] ) {
1892 Real upweight( 2.0 );
1893 core::pack::task::IGEdgeReweightContainerOP IGreweight = dz_task->set_IGEdgeReweights();
1894 core::pack::task::IGEdgeReweighterOP upweighter(
new protocols::toolbox::ResidueGroupIGEdgeUpweighter( upweight, pep_res_vec, nbr_res_vec ) );
1895 IGreweight->add_reweighter( upweighter );
1898 protocols::simple_moves::PackRotamersMoverOP dz_pack(
new protocols::simple_moves::PackRotamersMover( full_scorefxn, dz_task, 1 ) );
1899 protocols::simple_moves::RotamerTrialsMoverOP dz_rottrial(
new protocols::simple_moves::RotamerTrialsMover( full_scorefxn, dz_task_factory ) );
1900 SequenceMoverOP design_seq(
new SequenceMover );
1901 design_seq->add_mover( dz_pack );
1902 design_seq->add_mover( dz_rottrial );
1903 design_seq->add_mover( min_mover );
1904 ( *full_scorefxn )(
pose );
1905 design_seq->apply( pose );
1906 if (
option[ pepspec::binding_score ] ) {
1908 mc_bind.
roll( pose, bind_score );
1909 }
else mc_relax->boltzmann( pose );
1910 pdb_name = pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
"_full.pdb";
1911 print_pep_analysis( pdb_name, out_file, pose, prot_score, full_scorefxn, save_all_pdbs );
1915 pack::task::PackerTaskOP dz_task( dz_task_factory->create_task_and_apply_taskoperations( pose ));
1918 if (
option[ pepspec::upweight_interface ] ) {
1919 Real upweight( 2.0 );
1920 core::pack::task::IGEdgeReweightContainerOP IGreweight = dz_task->set_IGEdgeReweights();
1921 core::pack::task::IGEdgeReweighterOP upweighter(
new protocols::toolbox::ResidueGroupIGEdgeUpweighter( upweight, pep_res_vec, nbr_res_vec ) );
1922 IGreweight->add_reweighter( upweighter );
1925 protocols::simple_moves::PackRotamersMoverOP dz_pack(
new protocols::simple_moves::PackRotamersMover( soft_scorefxn, dz_task, 1 ) );
1926 protocols::simple_moves::RotamerTrialsMoverOP dz_rottrial(
new protocols::simple_moves::RotamerTrialsMover( soft_scorefxn, dz_task_factory ) );
1927 SequenceMoverOP design_seq(
new SequenceMover );
1928 design_seq->add_mover( dz_pack );
1929 design_seq->add_mover( dz_rottrial );
1930 design_seq->add_mover( min_mover );
1931 ( *soft_scorefxn )(
pose );
1932 design_seq->apply( pose );
1933 if (
option[ pepspec::binding_score ] ) {
1935 mc_bind.
roll( pose, bind_score );
1936 }
else mc_relax->boltzmann( pose );
1937 pdb_name = pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
"_soft.pdb";
1938 print_pep_analysis( pdb_name, out_file, pose, prot_score, full_scorefxn, save_all_pdbs );
1941 if (
option[ pepspec::diversify_pep_seqs ] ) {
1942 Size iter_per_res(
option[ pepspec::diversify_lvl ] );
1945 pdb_name = pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
"_mc" +
string_of(
ii ) +
".pdb";
1946 print_pep_analysis( pdb_name, out_file, pose, prot_score, full_scorefxn, save_all_pdbs );
1947 if (
option[ pepspec::binding_score ] ) {
1949 mc_bind.
roll( pose, bind_score );
1950 }
else mc_relax->boltzmann( pose );
1955 else mc_relax->recover_low( pose );
1956 pdb_name = pdb_dir +
"/" + out_nametag +
"_" +
string_of( peptide_loop ) +
".pdb";
1957 print_pep_analysis( pdb_name, out_file, pose, prot_score, full_scorefxn, save_low_pdbs );
1978 using namespace basic::options::OptionKeys;
1982 protocols::viewer::viewer_main(
my_main );
1985 std::cout <<
"caught exception " << e.
msg() << std::endl;
Real get_binding_score(Pose pose, Size pep_chain, ScoreFunctionOP full_scorefxn)
#define utility_exit_with_message(m)
Exit with file + line + message.
core::fragment::FragSetCOP make_frags(core::Size const start, core::Size const stop, std::string const &seq)
helper code for fragments generation, copied from S.M.Lewis
utility::pointer::shared_ptr< Constraint > ConstraintOP
void remove_pep_res(pose::Pose &pose, bool add_nterm, bool add_cterm)
virtual std::string const msg() const
myMC(Pose pose, Real score, Real temp_init)
RandomGenerator & rg()
Return the one-per-thread "singleton" random generator.
void mutate_random_residue(Pose &pose, vector1< bool > is_mutable, ScoreFunctionOP soft_scorefxn, ScoreFunctionOP full_scorefxn)
std::istream & getline(std::istream &stream, Fstring &s)
Get Line from Stream.
BooleanOptionKey const user("options:user")
vector1< std::pair< Size, Size > > get_clash_pairs(pose::Pose pose, vector1< bool > is_checked, scoring::ScoreFunctionOP const &scorefxn, Real const clash_threshold)
Platform independent operations on files (except I/O)
Size aa2index(chemical::AA aa)
bool has_clash(pose::Pose pose, vector1< bool > is_checked, scoring::ScoreFunctionOP const &scorefxn, Real const clash_threshold)
void recover_low(Pose &pose)
Random number generator system.
common derived classes for thrown exceptions
std::string start_file()
kind of like the old -s – just one file
void add_pep_res(pose::Pose &pose, bool add_nterm, bool add_cterm)
bool create_directory(std::string const &dir_path)
Create a directory if it doesn't already exist.
Fstring::size_type index(Fstring const &s, Fstring const &ss)
First Index Position of a Substring in an Fstring.
void roll(Pose &pose, Real &score)
core::fragment::FragSetCOP make_1mer_frags(core::Size const seqpos_start, core::Size const seqpos_stop, std::string const &seq, Size const nfrags)
void gen_pep_bb_sequential(pose::Pose &pose, scoring::ScoreFunctionOP cen_scorefxn)
void add_termini(pose::Pose &pose)
void packmin_unbound_pep(pose::Pose &pose, scoring::ScoreFunctionOP full_scorefxn)
Functions for opening database files.
int main(int argc, char *argv[])
void set_pep_csts(pose::Pose &pose)
T abs(T const &x)
std::abs( x ) == | x |
std::vector with 1-based indexing
rule< Scanner, options_closure::context_t > options
void make_sequence_change(Size const seqpos, AA const &new_aa, pose::Pose &pose)
list resnum
if line_edit[13:14]=='P': #Nucleic acid? Skip.
static THREAD_LOCAL basic::Tracer TR("apps.public.pepspec")
void perturb_pep_bb(pose::Pose &pose, kinematics::MoveMapOP mm_move, scoring::ScoreFunctionOP cen_scorefxn, Size n_iter)
void initialize_peptide(pose::Pose &pose)
ocstream cout(std::cout)
Wrapper around std::cout.
utility::pointer::shared_ptr< Constraint const > ConstraintCOP
BooleanOptionKey const exit("options:exit")
vector1: std::vector with 1-based indexing
Size get_n_pep_nbrs(pose::Pose const &pose, vector1< bool > const is_pep, Real const cutoff_cg)
std::string pep_phipsi_analysis(pose::Pose pose)
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
double uniform()
Generate a random number between 0 and 1. Threadsafe since each thread uses its own random generator...
std::string string_of(Fstring const &s)
string of an Fstring
void print_pep_analysis(std::string pdb_name, std::fstream &out_file, Pose pose, Real prot_score, ScoreFunctionOP full_scorefxn, bool dump_pdb)
void init()
set global 'init_was_called' to true
vector1< pep_coord_cst > pep_coord_csts
Fast (x,y,z)-coordinate numeric vector.
std::string pep_rmsd_analysis(pose::Pose pose)
void frame(const utility::vector1< utility::vector1< Real > > &R, utility::vector1< utility::vector1< Real > > &U)
rule< Scanner, option_closure::context_t > option