9 #ifndef __RNAMake__chain__
10 #define __RNAMake__chain__
16 #include "base/types.h"
17 #include "structure/chain.fwd.h"
18 #include "structure/residue.h"
19 #include "structure/residue_type_set.h"
25 ResidueOPs
const & residues):
26 residues_ ( residues )
32 residues_ = ResidueOPs(c.residues_.size());
34 for (
auto const & r : c.residues_) {
35 residues_[i] = std::make_shared<Residue>(*r);
44 residues_ = ResidueOPs();
45 Strings spl = split_str_by_delimiter(s,
";");
46 for(
auto const & r_str : spl) {
47 auto r = std::make_shared<Residue>(r_str, rts);
48 residues_.push_back(r);
60 return (
int)residues_.size();
65 first() {
return residues_[0]; }
69 last() {
return residues_.back(); }
73 subchain(
int start,
int end) {
74 if(start < 0) {
throw "start cannot be less then 0"; }
75 if(start == end) {
throw "start and end cannot be the same value"; }
76 if(end > residues().size()) {
throw "end is greater then chain length"; }
77 if(start > end) {
throw "start is greater then end"; }
78 return ChainOP(
new Chain(ResidueOPs(residues_.begin() + start, residues_.begin() + end)));
85 ResidueOP
const & r2) {
87 if(std::find(residues_.begin(), residues_.end(), r1) == residues_.end()) {
return nullptr; }
88 if(std::find(residues_.begin(), residues_.end(), r2) == residues_.end()) {
return nullptr; }
90 int start = (int)(std::find(residues_.begin(), residues_.end(), r1) - residues_.begin());
91 int end = (int)(std::find(residues_.begin(), residues_.end(), r2) - residues_.begin());
98 return subchain(start, end);
109 String
const &)
const;
113 to_pdb_str(
int & acount)
const {
114 return to_pdb_str(acount, -1,
"");
121 String
const &)
const;
125 to_pdb(String
const & fname) {
126 return to_pdb(fname, -1,
"");
133 residues() {
return residues_; }
136 ResidueOPs residues_;
140 connect_residues_into_chains(
141 ResidueOPs & residues,
Definition: residue_type_set.h:15