17 #include <core/scoring/packstat/types.hh>
18 #include <core/scoring/packstat/SimplePDB_Atom.hh>
19 #include <core/scoring/packstat/SimplePDB.hh>
20 #include <core/scoring/packstat/AtomRadiusMap.hh>
21 #include <core/scoring/packstat/compute_sasa.hh>
23 #include <protocols/analysis/PackStatMover.hh>
26 #include <core/types.hh>
46 #include <basic/options/keys/out.OptionKeys.gen.hh>
47 #include <basic/options/keys/packstat.OptionKeys.gen.hh>
48 #include <basic/options/keys/in.OptionKeys.gen.hh>
52 #include <protocols/jd2/JobDistributor.hh>
60 using namespace core::scoring::packstat;
62 inline std::string
base_name(
const std::string& str) {
64 size_t end = str.length();
66 for (
size_t i=0; i<str.length(); ++i ) {
67 if ( str[i] ==
'/' ) begin = i+1;
70 return str.substr(begin,end);
75 std::transform( base.begin(), base.end(), base.begin(), tolower );
76 if ( system( (
"mkdir -p out/" + base.substr(1,2)).c_str() ) == -1 ) {
77 TRps.
Error <<
"Unable to make directory!" << std::endl;
79 std::string OUT_TAG =
"out/" + base.substr(1,2) +
"/" + base;
85 using namespace core::scoring::packstat;
90 using namespace numeric;
91 using namespace utility;
93 bool surface_accessibility =
option[ OptionKeys::packstat::surface_accessibility ]();
94 core::Real burial_radius =
option[ OptionKeys::packstat::cavity_burial_probe_radius ]();
104 spheres =
pdb.get_spheres(arm);
105 std::cerr <<
"spheres len: " << spheres.size() << std::endl;
107 std::cerr <<
"centers len: " << centers.size() << std::endl;
110 opts.prune_max_iters = 999;
111 opts.prune_max_delta = 0;
112 opts.num_cav_ball_layers = 10;
113 opts.frac_cav_ball_required_exposed = 0.00;
114 opts.area_cav_ball_required_exposed = 0.00;
115 opts.surrounding_sasa_smoothing_window = 3;
116 opts.min_cav_ball_radius =
option[ OptionKeys::packstat::min_cav_ball_radius ]();
117 opts.min_cluster_overlap =
option[ OptionKeys::packstat::min_cluster_overlap ]();
118 opts.cluster_min_volume =
option[ OptionKeys::packstat::cluster_min_volume ]();
119 for ( PackstatReal
pr = 3.0;
pr >= 0.4;
pr -= 0.1 )
opts.probe_radii.push_back(
pr);
120 opts.prune_cavity_burial_probe_radii.push_back( burial_radius );
121 if ( surface_accessibility ) {
122 for ( PackstatReal
pr = burial_radius-0.1;
pr >= 0.1;
pr -= 0.1 ) {
123 opts.prune_cavity_burial_probe_radii.push_back(
pr);
128 SasaResultOP sr = compute_sasa( spheres,
opts );
131 CavBalls cavballs = sr->cavballs;
133 cavballs = prune_hidden_cavity_balls( cavballs,
opts );
136 cavballs = prune_cavity_balls( spheres, cavballs,
opts );
139 compute_cav_ball_volumes( cavballs,
opts );
142 compute_cav_ball_clusters( cavballs,
opts );
151 int prev_resnum = -12345;
153 int res_atom_count = 999;
154 for (
int i = 1; i <= (
int)
pdb.atoms().size(); ++i ) {
155 SimplePDB_Atom & atom(
pdb.atoms()[i] );
157 if ( prev_resnum != atom.resnum ) {
158 if ( res_atom_count > 3 ) {
161 prev_resnum = atom.resnum;
166 if (
resnum > (
int)res_scores.size() ) {
167 TRps <<
"ERROR: more residues than res scores " <<
resnum <<
" " << res_scores.size() << std::endl;
169 bfac = res_scores[
resnum];
172 out << atom.whole_line.substr(0,61) <<
F(4,2,bfac) << atom.whole_line.substr(65) << std::endl;
187 std::cout <<
"Add Cavities to PDB:" << std::endl;
189 for (
Size i = 1; i <= clusters.size(); i++ ) {
191 if ( clusters[i].surface_accessibility <
option[ OptionKeys::packstat::min_surface_accessibility ]() )
continue;
193 <<
" volume " << clusters[i].volume
194 <<
" surf " << clusters[i].surface_area
195 <<
" surf. acc. " << clusters[i].surface_accessibility
197 for (
Size j = 1; j <= clusters[i].cavballs.size(); j++ ) {
199 out << clusters[i].cavballs[j].hetero_atom_line( centers.size()+
count,
count, 0.0 ) << std::endl;
222 using namespace core::scoring::packstat;
224 using namespace core;
226 using namespace basic::options::OptionKeys;
228 using namespace numeric;
229 using namespace utility;
232 bool include_water =
option[ OptionKeys::packstat::include_water ]();
233 bool residue_scores =
option[ OptionKeys::packstat::residue_scores ]();
234 bool packstat_pdb =
option[ OptionKeys::packstat::packstat_pdb ]();
235 bool raw_stats =
option[ OptionKeys::packstat::raw_stats ]();
244 spheres =
pdb.get_spheres(arm);
252 pd.spheres = spheres;
253 pd.centers = centers;
254 core::Real packing_score = compute_packing_score( pd, oversample );
256 TRps <<
"packing score: " << fname <<
" " << centers.size() <<
" " << spheres.size() <<
" " << packing_score;
257 if ( include_water ) {
258 TRps <<
" ( with " <<
pdb.num_water() <<
" waters )";
263 if ( packstat_pdb || residue_scores ) {
264 res_scores = compute_residue_packing_scores( pd, oversample );
267 if ( packstat_pdb ) {
271 if ( residue_scores ) {
272 for (
int i = 1; i <= (
int)res_scores.size(); ++i ) {
273 TRps <<
"packing score: residue " << i <<
" " << res_scores[i] << std::endl;
279 assert( pd.spheres.size() > 0 );
280 assert( pd.centers.size() > 0 );
283 opts.surrounding_sasa_smoothing_window = 1+2*oversample;
284 opts.num_surrounding_sasa_bins = 7;
285 for (
core::Size ipr = 1; ipr <= 31; ++ipr ) {
286 PackstatReal
pr = 3.0 - ((double)(ipr-1))/10.0;
287 PackstatReal ostep = 0.1 / (oversample*2.0+1.0);
288 for (
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr + i*ostep );
289 opts.probe_radii.push_back( pr );
290 for (
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr - i*ostep );
293 SasaResultOP result = compute_sasa( pd.spheres, opts );
294 for (
core::Size i = 1; i <= pd.centers.size(); ++i ) {
296 PackingScoreResDataCOP dat( compute_surrounding_sasa( pd.centers[i], pd.spheres, result, opts ) );
297 TRps <<
"RAW_STATS " << i <<
" ";
298 for (
Size i =1; i <= dat->nrad(); ++i ) {
299 for (
Size j =1; j <= dat->npr(); ++j ) {
300 TRps << dat->msa(i,j) <<
" ";
311 int main (
int argc,
char *argv[]) {
316 using namespace core::scoring::packstat;
318 using namespace basic::options::OptionKeys;
319 using namespace utility;
325 option[ out::nooutput ].value(
true );
330 protocols::analysis::PackStatMoverOP
pack_mover;
332 protocols::jd2::JobDistributor::get_instance()->go(pack_mover);
338 for (
size_t i = 1; i <= files.size(); ++i ) {
343 for (
size_t i = 1; i <= files.size(); ++i ) {
346 while ( list >> fname ) {
356 std::cout <<
"caught exception " << e.
msg() << std::endl;
ocstream cerr(std::cerr)
Wrapper around std::cerr.
virtual std::string const msg() const
void init(int argc, char *argv[])
Command line init() version.
BooleanOptionKey const user("options:user")
utility::keys::lookup::end< KeyType > const end
void output_packstat_pdb(std::string fname, utility::vector1< core::Real > const &res_scores)
int main(int argc, char *argv[])
common derived classes for thrown exceptions
static THREAD_LOCAL basic::Tracer TRps("packstat")
izstream: Input file stream wrapper for uncompressed and compressed files
Input file stream wrapper for uncompressed and compressed files.
File name class supporting Windows and UN*X/Linux format names.
rule< Scanner, options_closure::context_t > options
list resnum
if line_edit[13:14]=='P': #Nucleic acid? Skip.
Output file stream wrapper for uncompressed and compressed files.
void close()
Close the ofstream and reset the state.
ocstream cout(std::cout)
Wrapper around std::cout.
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
utility::keys::lookup::begin< KeyType > const begin
std::string get_out_tag(std::string fname)
std::string base_name(const std::string &str)
ozstream: Output file stream wrapper for uncompressed and compressed files
Program options global and initialization function.
void output_packstat(std::string fname)
int const silent
Named verbosity levels.
rule< Scanner, option_closure::context_t > option