Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SecStructGen.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/gen/SecStructGen.cc
11 /// @brief default constant length fragment VallExtentGenerator
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 // unit headers
16 
17 #include <utility/vector1.hh>
18 
19 
20 
21 namespace core {
22 namespace fragment {
23 namespace picking_old {
24 namespace vall {
25 namespace gen {
26 
27 
28 /// @brief default constructor
30  Super()
31 {}
32 
33 
34 /// @brief fragment size constructor
35 /// @param[in] ss the required secondary structure string of the fragment
37  Super(),
38  ss_( ss )
39 {}
40 
41 
42 /// @brief copy constructor
44  Super( rval ),
45  ss_( rval.ss_ )
46 {}
47 
48 
49 /// @brief default destructor
51 {}
52 
53 
54 /// @brief copy assignment
56  if ( this != &rval ) {
57  Super::operator =( rval );
58  ss_ = rval.ss_;
59  }
60  return *this;
61 }
62 
63 
64 /// @brief clone this object
66  return new SecStructGen( *this );
67 }
68 
69 
70 /// @brief return the desired fragment extent w/ length equal to the
71 /// secondary structure string
72 /// @return Valid (true) extent if the extent has exactly the required
73 /// secondary structure string and the end of the extent does not go past
74 /// section_end. Invalid (false) extent otherwise.
75 /// @remarks we assume VallResidueIterator is a type of RandomAccessIterator, such as
76 /// those used in std::vector
78  Extent extent;
79  extent.begin = extent_begin;
80  extent.end = extent_begin + ss_.length();
81  extent.valid = ( extent.end <= section_end );
82 
83  if ( extent.valid ) {
84 
85  // check if secondary structure string matches
86  Size str_idx = 0;
87  for ( VallResidueIterator i = extent.begin; i != extent.end; ++i, ++str_idx ) {
88  assert( str_idx != ss_.length() );
89 
90  // if secondary structure string doesn't match, set invalid
91  // Extent and break out of loop
92  if ( i->ss() != ss_.at( str_idx ) ) {
93  extent.valid = false;
94  break;
95  }
96  }
97 
98  } // if extent.valid
99 
100  return extent;
101 }
102 
103 
104 } // namespace gen
105 } // namespace vall
106 } // namespace picking_old
107 } // namespace fragment
108 } // namespace core