Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StrandFragment.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 /rosetta/rosetta_source/src/protocols/features/strand_assembly/StrandFragment.cc
11 ///
12 /// @brief
13 
14 /// @author Tim jacobs
15 
16 //Unit Headers
18 
19 //Core
21 
22 //Utility
23 #include <utility/string_util.hh>
24 
25 //Numeric
26 #include <numeric/xyzVector.hh>
27 #include <numeric/HomogeneousTransform.hh>
28 
29 namespace protocols {
30 namespace features {
31 namespace strand_assembly {
32 
34 
36 start_(start),
37 end_(end),
38 pdb_source_(""),
39 direction_(true)
40 //residue_list_(end+1)
41 //residue_map_()
42 {}
43 
45 start_(start),
46 end_(end),
47 pdb_source_(""),
48 direction_(direction)
49 //residue_list_(end+1)
50 //residue_map_()
51 {}
52 
54 
56 {
57  return start_;
58 }
59 
61 {
62  return end_;
63 }
64 
66 {
67  if(end_ == start_){return 0;}
68  return end_-start_+1;
69 }
70 
72 {
73  return pdb_source_;
74 }
75 
77 {
78  return direction_;
79 }
80 
82 {
83  this->pdb_source_ = pdb_source_;
84 }
85 
86 void StrandFragment::set_direction(bool direction_)
87 {
88  this->direction_ = direction_;
89 }
90 
91 //@Brief
92 //void StrandFragment::insertResiduesFromPose(const core::pose::Pose & pose, core::Size start, core::Size end){
93 //
94 // //ensure that we are adding as many residues from the pose as we have elements in this StrandFragment
95 // assert(get_size()==(end-start+1));
96 //
97 // core::Size foo = start_;
98 // for(core::Size i=start; i <= end; ++i){
99 // core::conformation::Residue ros_res = pose.residue(i);
100 //
101 // std::vector<NativeAtom> atoms;
102 // for(core::Size j=1; j<=ros_res.atoms().size(); ++j){
103 // numeric::xyzVector<double> ros_atom_xyz = ros_res.atom(j).xyz();
104 // NativeAtom atom(ros_atom_xyz.x(),ros_atom_xyz.y(),ros_atom_xyz.z());
105 // atoms.push_back(atom);
106 // }
107 // NativeResidue native_res(ros_res.name(), atoms);
108 // residue_map_[foo].push_back(native_res);
109 // ++foo;
110 // }
111 //}
112 
113 //std::string StrandFragment::print() const{
114 //
115 // std::string output = "Fragment(" + utility::to_string(start_) + "," + utility::to_string(end_) + ")\n";
116 //
117 // std::map<core::Size, std::vector<NativeResidue> >::const_iterator it;
118 // for(it=residue_map_.begin(); it != residue_map_.end(); ++it){
119 // output += "Residue " + utility::to_string((*it).first) + "\n";
120 //
121 // for(core::Size i=0; i<(*it).second.size(); ++i){
122 // output += (*it).second[i].print();
123 // }
124 // }
125 // return output;
126 //}
127 
128 //void StrandFragment::insertResiduesFromPose(const core::pose::Pose & matching_pose,
129 // core::Size start, core::Size end, const core::pose::Pose & bundle_pose){
130 //
131 // //ensure that we are adding as many residues from the pose as we have elements in this StrandFragment
132 // assert(get_size()==(end-start+1));
133 //
134 // core::Size counter = start_;
135 // for(core::Size i=start; i <= end; ++i){
136 // core::conformation::Residue matching_res = matching_pose.residue(i);
137 // core::conformation::Residue bundle_res = bundle_pose.residue(counter);
138 //
139 // numeric::xyzVector< core::Real > halfpoint_input = 0.5 * (matching_res.atom("N").xyz() + matching_res.atom("C").xyz() );
140 // numeric::HomogeneousTransform< core::Real > input_frame( matching_res.atom("N").xyz(), halfpoint_input, matching_res.atom("CA").xyz() );
141 //
142 // numeric::xyzVector< core::Real > halfpoint_output = 0.5 * (bundle_res.atom("N").xyz() + bundle_res.atom("C").xyz() );
143 // numeric::HomogeneousTransform< core::Real > output_frame( bundle_res.atom("N").xyz(), halfpoint_output, bundle_res.atom("CA").xyz() );
144 //
145 // std::cout << "Working on residue: " << i << "(" << matching_res.type().name() << ")/" << counter << "(" << bundle_res.type().name() << ")" << std::endl;
146 //
147 // std::vector<NativeAtom> atoms;
148 //// std::vector<NativeAtom> atoms2;
149 // for(core::Size j=1; j<=matching_res.atoms().size(); ++j){
150 // //If this atom is a backbone atom we don't want to transform the coordinates at all
151 // if(matching_res.atom_is_backbone(j)){
152 // if(j <= bundle_res.atoms().size()){//This should only happen with res type derivatives (like c-term etc) I think....
153 // numeric::xyzVector< core::Real > bundle_atom_xyz(bundle_res.atom(j).xyz());
154 // NativeAtom atom(j, bundle_atom_xyz.x(),bundle_atom_xyz.y(),bundle_atom_xyz.z());
155 // atoms.push_back(atom);
156 // }
157 // }
158 // //If this atom is a sidechain atom we need to change the atom xyz to match be in the coordinate frame of the
159 // //new residue
160 // else{
161 // //create a Homogeneous transform object in the global coordinate frame with the point set to the current atom
162 // numeric::xyzVector< core::Real > matching_atom_xyz_transformed((output_frame * input_frame.inverse()) *
163 // matching_res.atom(j).xyz());
164 // NativeAtom atom(j, matching_atom_xyz_transformed.x(),
165 // matching_atom_xyz_transformed.y(),matching_atom_xyz_transformed.z());
166 // atoms.push_back(atom);
167 // }
168 //// numeric::xyzVector< core::Real > ros_atom_old_xyz(ros_res_old.atom(j).xyz());
169 //// NativeAtom atom2(j, ros_atom_old_xyz.x(),ros_atom_old_xyz.y(),ros_atom_old_xyz.z());
170 //// atoms2.push_back(atom2);
171 // }
172 // NativeResidue native_res(matching_res.type().name(), atoms);
173 //// NativeResidue native_res2(ros_res_old.type().name(), atoms2);
174 // residue_list_[counter].push_back(native_res);
175 //// residue_list_[counter].push_back(native_res2);
176 // ++counter;
177 // }
178 // std::cout << "Done with round" << std::endl;
179 //}
180 //
181 //std::string StrandFragment::print() const{
182 //
183 // std::string output = "Fragment(" + utility::to_string(start_) + "," + utility::to_string(end_) + ")\n";
184 //
185 // for(core::Size j=start_; j<residue_list_.size(); ++j){
186 // output += "RESNUM " + utility::to_string(j) + "\n";
187 //
188 // for(core::Size i=0; i<residue_list_[j].size(); ++i){
189 // output += residue_list_[j][i].print();
190 // }
191 // }
192 // return output;
193 //}
194 
195 } //namespace strand_assembly
196 } //namespace features
197 } //namespace protocols
198