9 #ifndef __RNAMake__basepair__
10 #define __RNAMake__basepair__
15 #include "base/types.h"
16 #include "util/uuid.h"
17 #include "math/xyz_matrix.h"
18 #include "structure/atom.h"
19 #include "structure/residue.h"
20 #include "structure/basepair_state.h"
31 String
const & bp_type):
40 for(
auto const & a : res1->atoms() ) {
41 if(a !=
nullptr) { atoms_.push_back(a); }
43 for(
auto const & a : res2->atoms() ) {
44 if(a !=
nullptr) { atoms_.push_back(a); }
47 Point d = center(atoms_);
49 sugars[0] = res1_->get_atom(
"C1'")->coords();
50 sugars[1] = res2_->get_atom(
"C1'")->coords();
51 bp_state_ = std::make_shared<BasepairState>(d, r, sugars);
65 operator == (
Basepair const & bp )
const {
return uuid_ == bp.uuid_; }
70 BasepairStateOP
const &
72 bp_state_->d(center(atoms_));
73 bp_state_->sugars(Points{ res1_->get_atom(
"C1'")->coords(), res2_->get_atom(
"C1'")->coords() });
88 partner(ResidueOP
const & res) {
89 if ( res->uuid() == res1_->uuid()) {
return res2_; }
90 else if( res->uuid() == res2_->uuid()) {
return res1_; }
91 else {
throw "called partner with resiude not in this basepair"; }
98 ss << res1_->chain_id() << res1_->num() << res1_->i_code();
99 String str1 = ss.str();
101 ss << res2_->chain_id() << res2_->num() << res2_->i_code();
102 String str2 = ss.str();
103 if(str1 < str2) {
return str1+
"-"+str2; }
104 else {
return str2+
"-"+str1; }
109 flip() { bp_state_->flip(); }
113 r()
const {
return bp_state_->r(); }
117 d()
const {
return center(atoms_); }
121 uuid()
const {
return uuid_; }
125 res1()
const {
return res1_; }
129 res2()
const {
return res2_; }
133 bp_type()
const {
return bp_type_; }
137 flipped()
const {
return flipped_; }
141 atoms()
const {
return atoms_; }
147 r(Matrix
const & nr) { bp_state_->r(nr); }
151 uuid(Uuid
const & nuuid) { uuid_ = nuuid; }
155 flipped(
int const & nflipped) { flipped_ = nflipped; }
159 res1(ResidueOP
const & nres1) { res1_ = nres1;}
163 res2(ResidueOP
const & nres2) { res2_ = nres2;}
174 to_pdb(String
const)
const;
178 ResidueOP res1_, res2_;
180 BasepairStateOP bp_state_;
187 typedef std::shared_ptr<Basepair> BasepairOP;
188 typedef std::vector<BasepairOP> BasepairOPs;
191 wc_bp(BasepairOP
const &);
194 gu_bp(BasepairOP
const &);
Definition: basepair.h:22