Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopsFileDefiner.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/loops/loops_definers/LoopsFileDefiner.cc
11 /// @brief A loops definer is creates a serialized loops list
12 /// @author Matthew O'Meara (mattjomear@gmail.com)
13 
14 // Unit Headers
17 #include <protocols/loops/Loop.hh>
18 
19 // Project Headers
21 
22 // Utility Headers
23 #include <utility/tag/Tag.hh>
24 
25 // C++ Headers
26 #include <string>
27 #include <utility/excn/Exceptions.hh>
28 #include <sstream>
29 
30 
31 using std::string;
32 using std::endl;
33 using std::stringstream;
36 using core::pose::Pose;
37 
38 
39 namespace protocols {
40 namespace loops {
41 namespace loops_definers {
42 
44  loop_list_()
45 {}
46 
48 
50  LoopsFileDefiner const & src
51 ) :
52  loop_list_(src.loop_list_)
53 {}
54 
55 /// @brief Create another loops definer of the type matching the most-derived
56 /// version of the class.
59 ) const {
60  return new LoopsFileDefiner(*this);
61 }
62 
63 /// @brief Used to parse an xml-like tag to load parameters and properties.
64 void
66  TagPtr const tag,
67  DataMap const &,
68  Pose const & p
69 ) {
70 
71  if(!tag->hasOption("name")){
72  throw utility::excn::EXCN_RosettaScriptsOption(
73  "Unable to create unnamed LoopsDefiner (type: LoopsFile)" );
74  }
75  string const loops_name(tag->getOption<string>("name"));
76 
77 
78  string filename;
79  if(tag->hasOption("filename")){
80  filename = tag->getOption<string>("filename");
81  } else {
82  stringstream err_msg;
83  err_msg << "Tag with name '" << loops_name << "' does not have the expected 'filename' field." << endl;
84  throw utility::excn::EXCN_RosettaScriptsOption(err_msg.str());
85  }
86 
87  LoopsFileIO loops_file_io;
88  LoopsFileDataOP lfd = loops_file_io.read_loop_file( filename );
89  loop_list_ = lfd->resolve_as_serialized_loops( p );
90 }
91 
94  Pose const &
95 ) {
96  return loop_list_;
97 }
98 
99 } //namespace
100 } //namespace
101 } //namespace