Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VallData.hh
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 #ifndef INCLUDED_protocols_frags_VallData_hh
11 #define INCLUDED_protocols_frags_VallData_hh
12 
13 
14 // Rosetta Headers
15 
16 #include <core/types.hh>
19 
20 // ObjexxFCL Headers
21 // AUTO-REMOVED #include <utility/vector1.hh>
22 
23 // C++ Headers
24 // #include <cmath>
25 // #include <cstdlib>
26 // #include <iostream>
27 // #include <fstream>
28 // #include <sstream>
29 #include <string>
30 
31 #include <utility/vector1_bool.hh>
32 
33 
34 namespace protocols {
35 namespace frags {
36 
37 using core::Real;
38 using core::Size;
39 
40 class VallData {
41 public:
42  /// default constructor
44  {
45  Size const big_size( 100000 ); // rough guess
46  sequence_.reserve( big_size );
47  secstruct_.reserve( big_size );
48  phi_.reserve( big_size );
49  psi_.reserve( big_size );
50  omega_.reserve( big_size );
51  }
52 
53  /// constructor from input vall database file
55  {
56  Size const big_size( 100000 ); // rough guess
57  // prevent lots of redimensioning as we read file? does this even matter?
58  sequence_.reserve( big_size );
59  secstruct_.reserve( big_size );
60  phi_.reserve( big_size );
61  psi_.reserve( big_size );
62  omega_.reserve( big_size );
63  read_file( filename );
64  }
65 
66  /// removes excess storage capacity to minimize memory usage
67  void
69  {
70  sequence_.shrink();
71  secstruct_.shrink();
72  phi_.shrink();
73  psi_.shrink();
74  omega_.shrink();
75  }
76 
77  // read from vall database file "filename"
78  void
79  read_file( std::string const & filename );
80 
81  /// read in one more line from Vall input file
82  void
84  const char sq,
85  const char ss,
86  const Real ph,
87  const Real ps,
88  const Real om
89  )
90  {
91  sequence_.push_back( sq );
92  secstruct_.push_back( ss );
93 
94  phi_.push_back( ph );
95  psi_.push_back( ps );
96  omega_.push_back( om );
97  }
98 
99  utility::vector1< char > const & sequence () const {return sequence_; }
101 
102  utility::vector1< Real > const & phi () const {return phi_;}
103  utility::vector1< Real > const & psi () const {return psi_;}
104  utility::vector1< Real > const & omega() const {return omega_;}
105 
106  /// number of lines in Vall database
107  int size() const { return sequence_.size(); }
108 
109  // pick fragments for a single residue position from vall database
110  void
111  get_frags(
112  Size const nfrags,
113  std::string const & target_seq,
114  std::string const & target_ss,
115  Real const seq_weight,
116  Real const ss_weight,
117  bool const exclude_gly,
118  bool const exclude_pro,
119  bool const exclude_cys_peptides,
121  ) const;
122 
123 private:
126 
130 
131 };
132 
133 } // ns frags
134 } // ns protocols
135 
136 #endif