Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ddGData.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
11 /// @brief
12 /// @author Liz Kellogg ekellogg@u.washington.edu
13 
14 // libRosetta headers
15 
16 #include <core/types.hh>
17 
18 #include <core/chemical/AA.hh>
19 // AUTO-REMOVED #include <core/conformation/Residue.hh>
20 // AUTO-REMOVED #include <core/conformation/ResidueMatcher.hh>
21 // AUTO-REMOVED #include <core/chemical/ResidueTypeSet.hh>
23 
24 // AUTO-REMOVED #include <core/scoring/ScoreFunction.hh>
25 // AUTO-REMOVED #include <core/scoring/ScoreFunctionFactory.hh>
26 // AUTO-REMOVED #include <protocols/jd2/ScoreMap.hh>
27 
28 #include <core/pose/Pose.hh>
29 // AUTO-REMOVED #include <core/io/pdb/pose_io.hh>
32 
33 // AUTO-REMOVED #include <basic/options/util.hh>
34 // AUTO-REMOVED #include <basic/options/after_opts.hh>
35 // AUTO-REMOVED #include <basic/options/keys/OptionKeys.hh>
36 
37 
38 #include <numeric/random/random.hh>
39 
40 #include <protocols/ddg/ddGData.hh>
41 
42 #include <utility/exit.hh>
43 #include <utility/file/FileName.hh>
44 #include <utility/io/izstream.hh>
45 #include <utility/string_util.hh>
46 
47 // C++ headers
48 #include <cstdlib>
49 #include <fstream>
50 #include <iostream>
51 #include <string>
52 
54 #include <utility/vector1.hh>
55 
56 
57 
58 
59 numeric::random::RandomGenerator RG(1907465); // <- Magic number, do not change it!!!
60 
61 
62 namespace protocols {
63 namespace ddG{
64 
66  file_to_read_ = "";
67  curr_mut_filename = "";
68  curr_wt_filename = "";
69  experimental = 0.0;
70  curr_mut_read = true;
71  curr_wt_read = true;
72 }
73 
76  curr_mut_filename = "";
77  curr_wt_filename = "";
78  experimental = 0.0;
79  curr_mut_read = true;
80  curr_wt_read = true;
81 }
82 
83 //returns false if file hasn't been opened
84 bool ddGData::end(){
85  if(!inputstream.is_open() && (file_to_read_.compare("") != 0)){
86  inputstream.open(file_to_read_.c_str());
87  }
88  return (inputstream.eof());
89 }
90 
92  if(!inputstream.is_open()){
93  inputstream.open(file_to_read_.c_str());
94  }
95  if(inputstream.is_open() && !inputstream.eof() && curr_mut_read && curr_wt_read){
97  }
98  curr_mut_read = false;
99  curr_wt_read = false;
100 }
101 
103 {
106  if(!inputstream.eof() && !curr_mut_read){
107  curr_mut_read = true;
108  }
110  if(mut.ext().compare("list") == 0){
111  std::ifstream istream;
112  istream.open(curr_mut_filename.c_str());
113  if(istream.is_open()){
114  while(!istream.eof()){
115  pose::Pose newpose;
116  std::string curr_filename;
117  istream >> curr_filename;
118  if(curr_filename.compare("") != 0){
119  std::cout << "opening file: " << curr_filename << std::endl;
120  core::import_pose::pose_from_pdb(newpose,(*rsd_set),curr_filename,false);
121  curr_mut.push_back(newpose);
122  }
123  }
124  }
125  }else if(mut.ext().compare("out") == 0){
128  utility::vector1<std::string> tags = sfd.tags();
129  for(unsigned int i=1;i <= tags.size(); i++){
130  core::io::silent::SilentStructOP ss = sfd[tags[i]];
131  pose::Pose newpose;
132  ss->fill_pose(newpose,(*rsd_set));
133  curr_mut.push_back(newpose);
134  }
135  }else{
136  //extension not recognized
137  }
138  return curr_mut;
139 }
140 
144  if(!inputstream.eof() && !curr_wt_read){
145  curr_wt_read = true;
146  }
148  if(wt.ext().compare("list") == 0){
149  std::ifstream istream;
150  istream.open(curr_wt_filename.c_str());
151  if(istream.is_open()){
152  while(!istream.eof()){
153  pose::Pose newpose;
154  std::string curr_filename;
155  istream >> curr_filename;
156  if(curr_filename.compare("") != 0){
157  core::import_pose::pose_from_pdb(newpose,(*rsd_set),curr_filename,false);
158  curr_wt.push_back(newpose);
159  }
160  }
161  }
162  }else if(wt.ext().compare("out") == 0){
165  utility::vector1<std::string> tags = sfd.tags();
166  for(unsigned int i=1;i <= tags.size(); i++){
167  core::io::silent::SilentStructOP ss = sfd[tags[i]];
168  pose::Pose newpose;
169  ss->fill_pose(newpose,(*rsd_set));
170  curr_wt.push_back(newpose);
171  }
172  }else{
173  //extension not recognized
174  }
175  return curr_wt;
176 }
177 
179  return experimental;
180 }
181 
182 
183 } //namespace ddG
184 } //namespace protocols