Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
theta_ligand.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 /// @brief
10 /// @author Ragul Gowthaman
11 
12 // Project Headers
13 #include <devel/init.hh>
14 #include <core/io/pdb/pose_io.hh>
15 #include <core/pose/Pose.hh>
16 #include <basic/MetricValue.hh>
17 
18 #include <basic/options/util.hh>
19 #include <basic/options/option.hh>
20 #include <basic/options/keys/relax.OptionKeys.gen.hh>
21 #include <basic/options/keys/in.OptionKeys.gen.hh>
22 #include <basic/options/keys/out.OptionKeys.gen.hh>
23 #include <basic/options/keys/docking.OptionKeys.gen.hh>
26 
27 #include <protocols/simple_moves/ScoreMover.hh>
28 #include <core/pose/metrics/CalculatorFactory.hh>
29 #include <core/pose/metrics/simple_calculators/SasaCalculatorLegacy.hh>
30 #include <protocols/toolbox/pose_metric_calculators/NumberHBondsCalculator.hh>
31 #include <protocols/toolbox/pose_metric_calculators/PackstatCalculator.hh>
32 #include <protocols/toolbox/pose_metric_calculators/BuriedUnsatisfiedPolarsCalculator.hh>
33 
34 #include <protocols/rigid/RigidBodyMover.hh>
35 #include <protocols/rigid/RB_geometry.hh>
36 #include <core/chemical/ResidueTypeSet.hh>
37 #include <core/conformation/ResidueFactory.hh>
38 #include <core/conformation/Residue.hh>
39 #include <core/optimization/MinimizerOptions.hh>
40 #include <core/optimization/AtomTreeMinimizer.hh>
41 #include <core/pack/task/TaskFactory.hh>
42 #include <core/pack/task/PackerTask.hh>
43 #include <core/pack/pack_rotamers.hh>
44 #include <core/scoring/sasa.hh>
45 
46 // Utility Headers
47 #include <utility/vector1.hh>
48 #include <utility/io/ozstream.hh>
49 
50 // C++ Headers
51 #include <iostream>
52 #include <iomanip>
53 #include <fstream>
54 #include <ostream>
55 #include <string>
56 #include <sstream>
57 #include <cmath>
58 #include <map>
59 
60 //Auto Headers
61 #include <core/io/pdb/pose_io.hh>
62 #include <core/import_pose/import_pose.hh>
63 #include <core/kinematics/MoveMap.hh>
64 #include <protocols/rigid/RigidBodyMover.hh>
65 #include <core/scoring/constraints/CoordinateConstraint.hh>
66 #include <core/conformation/Residue.hh>
67 #include <core/pose/Pose.hh>
68 #include <core/pose/PDBInfo.hh>
69 #include <core/pose/util.hh>
70 #include <core/pose/metrics/CalculatorFactory.hh>
71 #include <core/scoring/Energies.hh>
72 #include <core/scoring/EnergyGraph.hh>
73 #include <core/scoring/ScoreFunction.hh>
74 #include <core/scoring/ScoreType.hh>
75 #include <core/scoring/rms_util.hh>
76 #include <core/scoring/rms_util.tmpl.hh>
77 #include <core/scoring/constraints/util.hh>
78 #include <core/scoring/ScoreFunctionFactory.hh>
79 #include <core/scoring/rms_util.hh>
80 #include <core/id/AtomID.hh>
81 #include <core/id/AtomID_Map.hh>
82 
83 using namespace core;
84 using namespace core::pose::datacache;
85 using namespace core::optimization;
86 using namespace core::pose::metrics;
87 using namespace core::scoring;
88 using namespace core::scoring::constraints;
89 using namespace core::id;
90 using namespace basic::options;
91 using namespace basic::options::OptionKeys;
92 using namespace conformation;
93 using namespace protocols::simple_moves;
94 using namespace protocols::rigid;
95 
96 OPT_KEY( String, input_protein_ligand_complex )
97 OPT_KEY( String, input_protein )
98 OPT_KEY( String, input_ligand )
99 
100 int main( int argc, char * argv [] ){
101  try{
102 
103  NEW_OPT( input_protein_ligand_complex, "bound protein-ligand file name", "bound.pdb" );
104  NEW_OPT( input_protein, "unbound protein file name", "unbound.pdb" );
105  NEW_OPT( input_ligand, "unbound ligand file name", "ligand.pdb" );
106 
107  devel::init(argc, argv);
108 
109  std::string const bound_protein = option[ input_protein_ligand_complex ];
110  std::string const unbound_protein = option[ input_protein ];
111  std::string const inp_ligand = option[ input_ligand ];
112 
113  //setup scorefxn
114  scoring::ScoreFunctionOP scorefxn(get_score_function());
115  scoring::ScoreFunctionOP repack_scorefxn(get_score_function());
116 
117  //Register calculators
118  std::string sasa_calc_name = "sasa";
119  std::string hbond_calc_name = "hbond";
120  std::string packstat_calc_name = "packstat";
121  std::string burunsat_calc_name = "burunsat";
122  core::pose::metrics::PoseMetricCalculatorOP sasa_calculator( new core::pose::metrics::simple_calculators::SasaCalculatorLegacy );
123  core::pose::metrics::CalculatorFactory::Instance().register_calculator( sasa_calc_name, sasa_calculator );
124 
125  core::pose::metrics::PoseMetricCalculatorOP hb_calc( new protocols::toolbox::pose_metric_calculators::NumberHBondsCalculator() );
126  core::pose::metrics::CalculatorFactory::Instance().register_calculator( hbond_calc_name, hb_calc );
127 
128  core::pose::metrics::PoseMetricCalculatorOP packstat_calc( new protocols::toolbox::pose_metric_calculators::PackstatCalculator() );
129  core::pose::metrics::CalculatorFactory::Instance().register_calculator( packstat_calc_name, packstat_calc );
130 
131  core::pose::metrics::PoseMetricCalculatorOP burunsat_calc( new protocols::toolbox::pose_metric_calculators::BuriedUnsatisfiedPolarsCalculator(sasa_calc_name, hbond_calc_name) );
132  core::pose::metrics::CalculatorFactory::Instance().register_calculator( burunsat_calc_name, burunsat_calc );
133 
134  pose::Pose bound_protein_pose, unbound_protein_pose, ligand_pose;
135  core::import_pose::pose_from_pdb( bound_protein_pose, bound_protein );
136  core::import_pose::pose_from_pdb( unbound_protein_pose, unbound_protein );
137  core::import_pose::pose_from_pdb( ligand_pose, inp_ligand );
138  basic::MetricValue<Real> total_sasa_mval;
139  core::Real ligand_pose_sasa = 0.0, bound_pose_sasa = 0.0, unbound_pose_sasa = 0.0, Total_pose_exposed_SASA = 0.0;
140  ligand_pose.metric(sasa_calc_name,"total_sasa",total_sasa_mval);
141  ligand_pose_sasa = total_sasa_mval.value();
142  bound_protein_pose.metric(sasa_calc_name,"total_sasa",total_sasa_mval);
143  bound_pose_sasa = total_sasa_mval.value();
144  unbound_protein_pose.metric(sasa_calc_name,"total_sasa",total_sasa_mval);
145  unbound_pose_sasa = total_sasa_mval.value();
146  Total_pose_exposed_SASA = 1 - ((((unbound_pose_sasa + ligand_pose_sasa) - bound_pose_sasa)/2)/ligand_pose_sasa);
147  core::Real theta_ligand = Total_pose_exposed_SASA;
148 
149  //hydrophobic and polar SASA
150  /*
151  utility::vector1< core::Real > complex_rsd_sasa( bound_protein_pose.total_residue(), 0.0 );
152  utility::vector1< core::Real > separated_rsd_sasa( unbound_protein_pose.total_residue(), 0.0 );
153  utility::vector1< core::Real > complex_rsd_hsasa( bound_protein_pose.total_residue(), 0.0 ); // hydrophobic SASA only
154  utility::vector1< core::Real > separated_rsd_hsasa( unbound_protein_pose.total_residue(), 0.0 ); // hydrophobic SASA only
155 
156  core::Real probe_radius = basic::options::option[basic::options::OptionKeys::pose_metrics::sasa_calculator_probe_radius];
157 
158  core::scoring::calc_per_res_hydrophobic_sasa( bound_protein_pose, complex_rsd_sasa, complex_rsd_hsasa, probe_radius, false );
159  core::scoring::calc_per_res_hydrophobic_sasa( unbound_protein_pose, separated_rsd_sasa, separated_rsd_hsasa, probe_radius, false );
160 
161  core::Size lig_res_num = 0;
162  for ( int j = 1, resnum = bound_protein_pose.total_residue(); j <= resnum; ++j ) {
163  if (!bound_protein_pose.residue(j).is_protein()){
164  lig_res_num = j;
165  break;
166  }
167  }
168  if (lig_res_num == 0){
169  std::cout<<"No ligand given in bound protein PDB structure. Cannot identify interface."<<std::endl;
170  exit (1);
171  }
172 
173  core::Real complex_sasa = 0.0;
174  core::Real complex_polar_sasa = 0.0;
175  core::Real complex_hydrophobic_sasa = 0.0;
176  core::Real separated_sasa = 0.0;
177  core::Real separated_polar_sasa = 0.0;
178  core::Real separated_hydrophobic_sasa = 0.0;
179 
180  for ( core::uint j = 1, resnum = bound_protein_pose.total_residue(); j <= resnum; ++j ) {
181  if ( j == lig_res_num ) continue;
182  complex_sasa += complex_rsd_sasa[j];
183  complex_hydrophobic_sasa += complex_rsd_hsasa[j];
184  separated_sasa += separated_rsd_sasa[j];
185  separated_hydrophobic_sasa += separated_rsd_hsasa[j];
186  }
187  complex_polar_sasa = complex_sasa - complex_hydrophobic_sasa;
188  separated_polar_sasa = separated_sasa - separated_hydrophobic_sasa;
189 
190  core::Real interface_sasa = std::abs(complex_sasa - separated_sasa);
191  core::Real interface_hydrophobic_sasa = (std::abs(complex_hydrophobic_sasa - separated_hydrophobic_sasa))/interface_sasa;
192  core::Real interface_polar_sasa = (std::abs(complex_polar_sasa - separated_polar_sasa))/interface_sasa;
193  std::cout << "Scores: interface_hydrophobic_sasa "<<bound_protein<<" "<< interface_hydrophobic_sasa <<std::endl;
194  std::cout << "Scores: interface_polar_sasa "<<bound_protein<<" "<< interface_polar_sasa <<std::endl;
195  */
196  std::cout << "Scores: theta_ligand "<<bound_protein<<"\t"<< theta_ligand <<std::endl;
197 
198 
199  } catch ( utility::excn::EXCN_Base const & e ) {
200  std::cerr << "caught exception " << e.msg() << std::endl;
201  return -1;
202  }
203  return 0;
204 
205 }
ocstream cerr(std::cerr)
Wrapper around std::cerr.
Definition: ocstream.hh:290
virtual std::string const msg() const
Definition: EXCN_Base.hh:70
T const & value() const
Definition: MetricValue.hh:60
std::string String
Definition: remodel.cc:69
void init(int argc, char *argv[])
Command line init() version.
Definition: init.cc:23
core::pose::Pose Pose
Definition: supercharge.cc:101
tuple scorefxn
Definition: PyMOL_demo.py:63
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
#define OPT_KEY(type, key)
Output file stream wrapper for uncompressed and compressed files.
double Real
Definition: types.hh:39
Option lookup functions emulating Rosetta++ equivalents for transitional use.
#define NEW_OPT(akey, help, adef)
int main(int argc, char *argv[])
ocstream cout(std::cout)
Wrapper around std::cout.
Definition: ocstream.hh:287
vector1: std::vector with 1-based indexing
Program options global and initialization function.
rule< Scanner, option_closure::context_t > option
Definition: Tag.cc:378