Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fragment_functions.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 protocols/forge/methods/fragment_functions.cc
11 /// @brief methods for manipulating fragments
12 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
13 
14 // unit headers
16 
17 // project headers
20 
22 #include <utility/vector1.hh>
23 
24 //Auto Headers
25 #ifdef WIN32
26 #include <core/fragment/FragID.hh>
27 #endif
28 
29 
30 namespace protocols {
31 namespace forge {
32 namespace methods {
33 
34 
35 /// @brief create small-mers from large-mers
36 /// @param[in] all_possible_smallmers Default false. If true, grab all
37 /// possible smallmers using every possible starting position in a largemer
38 /// (you could end up with a *lot* of fragments per position). If false,
39 /// grab smallmers using only the first position of a largemer as the starting
40 /// position.
45  core::Size const smallmer_size,
46  bool const all_possible_smallmers
47 )
48 {
49  using core::Size;
53 
54  assert( smallmer_size > 0 );
55 
56  ConstantLengthFragSetOP small = new ConstantLengthFragSet( smallmer_size );
57 
58  for ( FrameIterator f = begin; f != end; ++f ) {
59  Size const ie = all_possible_smallmers ? f->length() - smallmer_size + 1 : 1;
60  for ( Size i = 1; i <= ie; ++i ) {
61  small->add( f->generate_sub_frame( smallmer_size, i ) );
62  }
63  }
64 
65  return small;
66 }
67 
68 
69 } // methods
70 } // forge
71 } // protocols