21 #include <utility/PyAssert.hh>
22 #include <utility/exit.hh>
25 #include <basic/Tracer.hh>
32 #include <boost/assign/list_of.hpp>
36 static basic::Tracer
TR(
"core.chemical.carbohydrates.CarbohydrateInfo");
41 namespace carbohydrates {
49 boost::assign::map_list_of
74 (
"DHA",
"dihydroxyacet")
120 if (
this == &object_to_copy) {
140 string prefix, suffix, ring_form, modifications;
166 ring_form =
"furanose";
169 ring_form =
"pyranose";
172 ring_form =
"septanose";
176 modifications +=
string(
" uronic acid\n");
179 if (modifications ==
"") {
180 modifications =
" none\n";
184 output <<
"Carbohydrate Properties for this Residue:" << endl;
185 output <<
" Basic Name: " <<
base_name() << endl;
186 output <<
" IUPAC Name: " <<
full_name_ << endl;
187 output <<
" Classification: " << prefix << suffix << endl;
188 output <<
" Stereochemistry: " <<
stereochem_ << endl;
190 output <<
" Ring Form: " << ring_form << endl;
191 output <<
" Anomeric Form: " <<
anomer_ << endl;
193 output <<
" Modifications: " << endl << modifications << endl;
194 output <<
" Polymeric Information:" << endl;
198 output <<
" Main chain connection: N/A" << endl;
200 output <<
" Branch connections: " <<
"branches not yet implemented" << endl;
230 "CarbohydrateInfo::branch_point(core::uint i): "
231 "There is no ith branch point on this carbohydrate residue.");
247 std::pair<core::id::TorsionType, core::uint>
250 assert((subscript > 0) && (subscript <=
ring_size_ - 2));
251 PyAssert((subscript > 0) && (subscript <=
ring_size_ - 2),
252 "CarbohydrateInfo::nu_id(core::uint subscript): "
253 "nu(subscript) does not have a CHI identifier.");
282 std::pair<core::id::TorsionType, core::uint>
285 Size upper_bound = 2;
289 assert((torsion_index >= 1) && (torsion_index <= upper_bound));
290 PyAssert((torsion_index >= 1) && (torsion_index <= upper_bound),
291 "CarbohydrateInfo::glycosidic_linkage_id(core::uint torsion_index): "
292 "no defined torsion angle for this index.");
356 char carbon_num_char =
'0' + carbon_num;
357 if (
residue_type_->has(
string(1,
'C') +
string(1, carbon_num_char) )) {
361 utility_exit_with_message(
362 "This residue is not a sugar or else there is an error in C atom labeling in the .params file.");
372 using namespace utility;
376 bool aldose_or_ketose_set =
false;
377 bool stereochem_set =
false;
378 bool ring_size_set =
false;
379 bool anomer_set =
false;
381 for (
uint i = 1, n_properties = properties.size(); i <= n_properties; ++i) {
382 if (properties[i] ==
"ALDOSE") {
384 utility_exit_with_message(
"A sugar cannot be both an aldose and a ketose; check the .param file.");
387 aldose_or_ketose_set =
true;
389 }
else if (properties[i] ==
"KETOSE") {
391 utility_exit_with_message(
"A sugar cannot be both an aldose and a ketose; check the .param file.");
394 aldose_or_ketose_set =
true;
396 }
else if (properties[i] ==
"L_SUGAR") {
398 utility_exit_with_message(
"A sugar cannot have both L and D stereochem.; check the .param file.");
401 stereochem_set =
true;
403 }
else if (properties[i] ==
"D_SUGAR") {
405 utility_exit_with_message(
"A sugar cannot have both L and D stereochem.; check the .param file.");
408 stereochem_set =
true;
410 }
else if (properties[i] ==
"FURANOSE") {
412 utility_exit_with_message(
"A sugar cannot have multiple ring sizes; check the .param file.");
415 ring_size_set =
true;
417 }
else if (properties[i] ==
"PYRANOSE") {
419 utility_exit_with_message(
"A sugar cannot have multiple ring sizes; check the .param file.");
422 ring_size_set =
true;
424 }
else if (properties[i] ==
"SEPTANOSE") {
426 utility_exit_with_message(
"A sugar cannot have multiple ring sizes; check the .param file.");
429 ring_size_set =
true;
431 }
else if (properties[i] ==
"ALPHA_SUGAR") {
432 if (anomer_set && (
anomer_ ==
"beta")) {
433 utility_exit_with_message(
"A sugar cannot be both alpha and beta; check the .param file.");
438 }
else if (properties[i] ==
"BETA_SUGAR") {
439 if (anomer_set && (
anomer_ ==
"alpha")) {
440 utility_exit_with_message(
"A sugar cannot be both alpha and beta; check the .param file.");
445 }
else if (properties[i] ==
"URONIC_ACID") {
451 utility_exit_with_message(
"A cyclic sugar must have its anomeric property declared; check the .param file.");
454 utility_exit_with_message(
"An acyclic sugar cannot be alpha or beta; check the .param file.");
467 string atom_name =
residue_type_->atom_name(upper_atom_index);
530 stringstream prefixes(stringstream::out);
544 stringstream long_suffix(stringstream::out);
545 stringstream short_suffix(stringstream::out);
548 long_suffix <<
"ofuran";
552 long_suffix <<
"opyran";
556 long_suffix <<
"oseptan";
563 long_suffix <<
"uronoside";
566 long_suffix <<
"oside";
570 long_suffix <<
"uronate";
573 long_suffix <<
"ose";
578 long_suffix <<
"uronoyl";
581 long_suffix <<
"osyl";
586 full_name_ = prefixes.str() + root + long_suffix.str();
587 short_name_ = prefixes.str() + code + short_suffix.str();
605 uint first_CHI = n_CHIs - n_torsions_needed + 1;
607 for (
uint i = first_CHI; i <= n_CHIs; ++i) {
619 object_to_output.
show(output);