Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResidueSelector.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 /// @author Phil Bradley
12 
13 
14 // // Unit headers
16 
17 // Package headers
18 // Commented by inclean daemon #include <core/chemical/AA.hh>
19 // Commented by inclean daemon #include <core/chemical/ResidueType.hh>
21 // Commented by inclean daemon #include <core/chemical/VariantType.fwd.hh>
22 
23 // Project headers
24 
25 // Utility headers
26 #include <basic/options/option.hh>
27 
28 // option key includes
29 
30 #include <basic/options/keys/residues.OptionKeys.gen.hh>
31 
32 #include <utility/vector1.hh>
33 
34 
35 
36 
37 // Commented by inclean daemon #include <utility/vector1.hh>
38 // Commented by inclean daemon #include <utility/pointer/owning_ptr.hh>
39 // Commented by inclean daemon #include <utility/pointer/ReferenceCount.hh>
40 
41 // C++ headers
42 // Commented by inclean daemon #include <sstream>
43 
44 namespace core {
45 namespace chemical {
46 
47 /// @details Auto-generated virtual destructor
49 
50 /// @details Auto-generated virtual destructor
52 
53 
54 ////////////////////////////////////////////////////////////////////////////////////////
55 
58 {
59  std::istringstream l( line );
60  std::string tag;
61  l >> tag;
62  if ( l.fail() ) return 0;
63  bool desired_result( true );
64  if ( tag == "NOT" ) {
65  desired_result = false;
66  l >> tag;
67  }
68  if ( tag == "AA" ) {
69  AA aa;
71  l >> aa;
72  while ( !l.fail() ) {
73  aas.push_back( aa );
74  l >> aa;
75  }
76  //std::cout << "AAline: " << aas.size() << ' ' << line << std::endl;
77  if ( !aas.empty() ) return new Selector_AA( aas, desired_result );
78 
79  } else if ( tag == "NAME3" ) {
80  std::string name3;
82  l >> name3;
83  while ( !l.fail() ) {
84  name3s.push_back( name3 );
85  l >> name3;
86  }
87  if( !name3s.empty() ) return new Selector_NAME3( name3s, desired_result );
88 
89  } else if ( tag == "PROPERTY" ) {
90  std::string property;
92  l >> property;
93  while ( !l.fail() && property[0] != '#' ) {
94  properties.push_back( property );
95  l >> property;
96  }
97  if ( !properties.empty() ) return new Selector_PROPERTY( properties, desired_result );
98 
99  } else if ( tag == "VARIANT_TYPE" ) {
100  VariantType variant_type;
101  utility::vector1< VariantType > variant_types;
102  l >> variant_type;
103  while ( !l.fail() && variant_type[0] != '#' ) {
104  variant_types.push_back( variant_type );
105  l >> variant_type;
106  }
107  if ( !variant_types.empty() ) return new Selector_VARIANT_TYPE( variant_types, desired_result );
108  } else if ( tag == "CMDLINE_SELECTOR" ) {
109  std::string selector_string;
110  l >> selector_string; // if one wants AND logical operation make this a vector of selector_strings...
111  if ( !selector_string.empty() ) return new Selector_CMDFLAG( selector_string, desired_result );
112  }
113  std::cout << "residue_selector_single: unrecognized line: " << line << std::endl;
114  return 0;
115 }
116 
117 ///
120 {
121  ResidueTypeCOPs rsd_list;
122  for ( ResidueTypeCOPs::const_iterator it= rsd_set.residue_types().begin(), ite= rsd_set.residue_types().end();
123  it != ite; ++it ) {
124  if ( operator[]( **it ) ) rsd_list.push_back( *it );
125  }
126  return rsd_list;
127 }
128 
130  std::string const & flag_in,
131  bool const result
132 ) : ResidueSelectorSingle( result )
133 {
134  using namespace basic::options;
135  using namespace basic::options::OptionKeys;
136  b_flag_is_present_ = false;
137  if ( !option[ OptionKeys::residues::patch_selectors ].user() ) return;
138  for ( StringVectorOption::const_iterator it = option[ OptionKeys::residues::patch_selectors ]().begin(),
139  eit = option[ OptionKeys::residues::patch_selectors ]().end(); it != eit ; ++ it ) {
140  if ( *it == flag_in ) {
141  b_flag_is_present_ = true;
142  break;
143  }
144  }
145 }
146 
147 
148 
149 } // chemical
150 } // core
151