Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReportPSSMDifference.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 
10 /// @file devel/protein_interface_design/ReportPSSMDifference.cc
11 /// @brief calculation of the difference in PSSM score between mutated and native pose
12 /// @author Hermann Zellner (hermann1.zellner@biologie.uni-regensburg.de)
13 
14 
15 #include <core/pose/Pose.hh>
16 #include <core/chemical/AA.hh>
17 #include <core/types.hh>
18 // AUTO-REMOVED #include <core/conformation/Conformation.hh>
19 
20 #include <basic/Tracer.hh>
21 
22 
23 // Utility Headers
24 #include <utility/vector1.hh>
25 
26 // Unit Headers
27 // C++ headers
28 #include <map>
29 #include <fstream>
31 
33 
34 //Auto Headers
36 
37 static basic::Tracer TR( "protocols.protein_interface_design.movers.InterfaceRecapitulationMover" );
38 
39 bool
41  std::string const & native_filename
42 )
43 {
44  std::string native_substr = native_filename.substr( 0, native_filename.size() - 4 );
45  std::string pssm_file_name = native_substr + ".fasta";
46  std::cerr << "Openning PSSM File " << pssm_file_name << " " << std::endl;
47  std::ifstream pssm_file( pssm_file_name.c_str() );
48 
50  Size linenum( 0 );
51  pssm_data_.clear();
52  while ( pssm_file ) {
53  ++linenum;
54  char line_aa;
55  pssm_file >> line_aa;
57  Real sum( 0.0 );
58  for ( Size ii = 1; ii <= core::chemical::num_canonical_aas; ++ii ) {
59  pssm_file >> pssm_prob_dist[ ii ];
60  sum += pssm_prob_dist[ ii ];
61  }
62  if ( std::abs( sum - 1 ) > 0.001 ) {
63  TR << "Warning: pssm probability distribution does not sum to 1.0: " << sum << std::endl;
64  TR << "Problem on line " << linenum << " of " << pssm_file_name << std::endl;
65  }
66  pssm_data_.push_back( std::make_pair( aa, pssm_prob_dist ));
67  }
68 
69  if ( pssm_data_.size() == 0 ) { std::cerr << "Did not read file -- possibly not found" << std::endl; return false; }
70 
71  return true;
72 }
73 
74 
77  core::pose::Pose const & pose1_in, core::pose::Pose const & pose2_in, core::pack::task::PackerTaskCOP const & task
78 )
79 {
80  using namespace core::scoring;
81 
82  core::pose::Pose pose1( pose1_in );
83  core::pose::Pose pose2( pose2_in );
84  core::Real pssm = 0.;
85 
86  for( core::Size i = 1; i <= pose1.total_residue(); ++i ) {
87  if( !pose1.residue(i).is_protein() ) continue;
88  core::chemical::AA const restype( pose2.residue(i).aa() );
89 
90  if (task->being_designed( i ))
91  {
92  if ( pssm_data_[i].first == restype )
93  {
94  pssm += pssm_data_[i].second[ restype ];
95  }
96  else
97  {
98  TR << "Warning: No pssm data found. Falling back on Sequence comparison." << std::endl;
99  if ( pose1.residue(i).aa() == pose2.residue(i).aa() )
100  {
101  pssm += 1.;
102  }
103  }
104  }
105  }
106 
107  return pssm;
108 }