Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.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 core/fragment/picking_old/vall/util.cc
11 /// @brief utility functions for interacting with VallLibrary
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 // unit headers
16 
17 // package headers
24 
25 #include <utility/vector1.hh>
26 
27 
28 
29 namespace core {
30 namespace fragment {
31 namespace picking_old {
32 namespace vall {
33 
34 
35 /// @brief pick fragments by default sec.struct IdentityScore
36 /// @param[in] ss secondary structure string of desired frag length
37 /// @param[in] top_n return the top 'n' fragments, default 200
38 /// @param[in] randomize add random noise within [0, 0.001) to
39 /// score to break up equivalent scores
40 /// @param[in] srfd_type The BBTorsionSRFD type to use.
43  std::string const & ss,
44  core::Size const top_n,
45  bool const randomize,
46  BBTorsionSRFD const & srfd_type
47 )
48 {
49  using eval::IdentityEval;
50  using gen::LengthGen;
51 
53 
54  VallLibrarian librarian;
55  librarian.add_fragment_gen( new LengthGen( ss.length() ) );
56  librarian.add_fragment_eval( new IdentityEval( ss, 1.0, randomize ) );
57 
58  // catalog fragments
59  librarian.catalog( library );
60 
61  // grab top fragments
62  return librarian.top_fragments( top_n, srfd_type );
63 }
64 
65 
66 /// @brief pick fragments by default sec.struct IdentityScore
67 /// @param[in] ss secondary structure string of desired frag length
68 /// @param[in] aa amino acid string of same length as ss string
69 /// @param[in] top_n return the top 'n' fragments, default 200
70 /// @param[in] randomize add random noise within [0, 0.001) to
71 /// score to break up equivalent scores
72 /// @param[in] srfd_type The BBTorsionSRFD type to use.
75  std::string const & ss,
76  std::string const & aa,
77  core::Size const top_n,
78  bool const randomize,
79  BBTorsionSRFD const & srfd_type
80 )
81 {
82  using eval::IdentityEval;
83  using gen::LengthGen;
84 
86 
87  VallLibrarian librarian;
88  librarian.add_fragment_gen( new LengthGen( ss.length() ) );
89  librarian.add_fragment_eval( new IdentityEval( ss, aa, 1.0, 1.0, randomize ) );
90 
91  // catalog fragments
92  librarian.catalog( library );
93 
94  // grab top fragments
95  return librarian.top_fragments( top_n, srfd_type );
96 }
97 
98 
99 /// @brief pick fragments by default sec.struct IdentityScore
100 /// @param[in] ss secondary structure string of desired frag length
101 /// @param[in] aa amino acid string of same length as ss string
102 /// @param[in] abego vector of string of desired frag length
103 /// @param[in] top_n return the top 'n' fragments, default 200
104 /// @param[in] randomize add random noise within [0, 0.001) to
105 /// score to break up equivalent scores
106 /// @param[in] srfd_type The BBTorsionSRFD type to use.
109  std::string const & ss,
110  std::string const & aa,
112  core::Size const top_n,
113  bool const randomize,
114  BBTorsionSRFD const & srfd_type
115 )
116 {
117  using eval::IdentityEval;
118  using eval::ABEGOEval;
119  using gen::LengthGen;
120 
122 
123  VallLibrarian librarian;
124  librarian.add_fragment_gen( new LengthGen( ss.length() ) );
125 
126  if( !aa.empty() ) {
127  librarian.add_fragment_eval( new IdentityEval( ss, aa, 1.0, 1.0, randomize ) );
128  } else {
129  librarian.add_fragment_eval( new IdentityEval( ss, 1.0, randomize ) );
130  }
131 
132  if( abego.size() > 0 ) {
133  librarian.add_fragment_eval( new ABEGOEval( abego, 1.0, randomize ) );
134  }
135 
136  // catalog fragments
137  librarian.catalog( library );
138 
139  // grab top fragments
140  return librarian.top_fragments( top_n, srfd_type );
141 }
142 
143 
144 
145 
146 } // vall
147 } // picking_old
148 } // fragment
149 } // core