| 1 | /* |
| 2 | * coot-utils/cis-peptide-info.hh |
| 3 | * |
| 4 | * Copyright 2020 by Medical Research Council |
| 5 | * Author: Paul Emsley |
| 6 | * |
| 7 | * This file is part of Coot |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU Lesser General Public License as published |
| 11 | * by the Free Software Foundation; either version 3 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * Lesser General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copies of the GNU General Public License and |
| 20 | * the GNU Lesser General Public License along with this program; if not, |
| 21 | * write to the Free Software Foundation, Inc., 51 Franklin Street, |
| 22 | * Fifth Floor, Boston, MA, 02110-1301, USA. |
| 23 | * See http://www.gnu.org/licenses/ |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef COOT_UTILS_CIS_PEPTIDE_INFO_HH |
| 28 | #define COOT_UTILS_CIS_PEPTIDE_INFO_HHcxx . . $ `coot-utils/cis-peptide-info.hh:28:9`! |
| 29 | |
| 30 | #include "mini-mol/atom-quads.hh"cxx . . $ `<file>/mini-mol/atom-quads.hh`/ |
| 31 | #include "geometry/residue-and-atom-specs.hh"cxx . . $ `<file>/geometry/residue-and-atom-specs.hh`/ |
| 32 | |
| 33 | namespace cootcxx . . $ coot/ { |
| 34 | namespace utilcxx . . $ coot/util/ { |
| 35 | |
| 36 | class cis_peptide_info_tcxx . . $ coot/util/cis_peptide_info_t# { |
| 37 | public: |
| 38 | |
| 39 | int serial_numbercxx . . $ coot/util/cis_peptide_info_t#serial_number.; |
| 40 | stdcxx . . $ std/::stringcxx . . $ std/string# chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1.; |
| 41 | stdcxx . . $ std/::stringcxx . . $ std/string# residue_name_1cxx . . $ coot/util/cis_peptide_info_t#residue_name_1.; |
| 42 | int resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1.; |
| 43 | stdcxx . . $ std/::stringcxx . . $ std/string# ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1.; |
| 44 | stdcxx . . $ std/::stringcxx . . $ std/string# chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2.; |
| 45 | stdcxx . . $ std/::stringcxx . . $ std/string# residue_name_2cxx . . $ coot/util/cis_peptide_info_t#residue_name_2.; |
| 46 | int resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2.; |
| 47 | stdcxx . . $ std/::stringcxx . . $ std/string# ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2.; |
| 48 | int model_numbercxx . . $ coot/util/cis_peptide_info_t#model_number.; |
| 49 | float omega_torsion_anglecxx . . $ coot/util/cis_peptide_info_t#omega_torsion_angle.; // in degrees. |
| 50 | |
| 51 | // normal constructor used by count_cis_peptides(): |
| 52 | cis_peptide_info_tcxx . . $ coot/util/cis_peptide_info_t#cis_peptide_info_t(6586bbd2a3559f35).(const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id, |
| 53 | residue_spec_tcxx . . $ coot/residue_spec_t# res1, |
| 54 | residue_spec_tcxx . . $ coot/residue_spec_t# res2, |
| 55 | int model_number_in, |
| 56 | float tors_in) : |
| 57 | chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1.(chain_id), |
| 58 | ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1.(res1.ins_codecxx . . $ coot/residue_spec_t#ins_code.), |
| 59 | chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2.(chain_id), |
| 60 | ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2.(res2.ins_codecxx . . $ coot/residue_spec_t#ins_code.) |
| 61 | { |
| 62 | model_numbercxx . . $ coot/util/cis_peptide_info_t#model_number. = model_number_in; |
| 63 | serial_numbercxx . . $ coot/util/cis_peptide_info_t#serial_number. = -1; // unset |
| 64 | resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1. = res1.res_nocxx . . $ coot/residue_spec_t#res_no.; |
| 65 | resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2. = res2.res_nocxx . . $ coot/residue_spec_t#res_no.; |
| 66 | omega_torsion_anglecxx . . $ coot/util/cis_peptide_info_t#omega_torsion_angle. = tors_in; |
| 67 | } |
| 68 | |
| 69 | // Full constructor |
| 70 | cis_peptide_info_tcxx . . $ coot/util/cis_peptide_info_t#cis_peptide_info_t(cfd51e24aa944e10).(int serial_number_in, |
| 71 | const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id_1_in, |
| 72 | const stdcxx . . $ std/::stringcxx . . $ std/string# &residue_name_1_in, |
| 73 | int resno_1_in, |
| 74 | const stdcxx . . $ std/::stringcxx . . $ std/string# &ins_code_1_in, |
| 75 | const stdcxx . . $ std/::stringcxx . . $ std/string# &chain_id_2_in, |
| 76 | const stdcxx . . $ std/::stringcxx . . $ std/string# &residue_name_2_in, |
| 77 | int resno_2_in, |
| 78 | const stdcxx . . $ std/::stringcxx . . $ std/string# &ins_code_2_in, |
| 79 | int model_number_in, |
| 80 | float omega_torsion_angle_in) : |
| 81 | serial_numbercxx . . $ coot/util/cis_peptide_info_t#serial_number.(serial_number_in), |
| 82 | chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1.(chain_id_1_in), |
| 83 | residue_name_1cxx . . $ coot/util/cis_peptide_info_t#residue_name_1.(residue_name_1_in), |
| 84 | ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1.(ins_code_1_in), |
| 85 | chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2.(chain_id_2_in), |
| 86 | residue_name_2cxx . . $ coot/util/cis_peptide_info_t#residue_name_2.(residue_name_2_in), |
| 87 | ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2.(ins_code_2_in) |
| 88 | { |
| 89 | |
| 90 | serial_numbercxx . . $ coot/util/cis_peptide_info_t#serial_number. = serial_number_in; |
| 91 | resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1. = resno_1_in; |
| 92 | resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2. = resno_2_in; |
| 93 | model_numbercxx . . $ coot/util/cis_peptide_info_t#model_number. = model_number_in; |
| 94 | omega_torsion_anglecxx . . $ coot/util/cis_peptide_info_t#omega_torsion_angle. = omega_torsion_angle_in; |
| 95 | } |
| 96 | |
| 97 | // Full from mmdb structure |
| 98 | explicit cis_peptide_info_tcxx . . $ coot/util/cis_peptide_info_t#cis_peptide_info_t(3b07be95215e0d4f).(mmdbcxx . . $ mmdb/::CisPepcxx . . $ mmdb/CisPep# *cis) : |
| 99 | serial_numbercxx . . $ coot/util/cis_peptide_info_t#serial_number.(cis->serNumcxx . . $ mmdb/CisPep#serNum.), |
| 100 | chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1.(cis->chainID1cxx . . $ mmdb/CisPep#chainID1.), |
| 101 | residue_name_1cxx . . $ coot/util/cis_peptide_info_t#residue_name_1.(cis->pep1cxx . . $ mmdb/CisPep#pep1.), |
| 102 | resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1.(cis->seqNum1cxx . . $ mmdb/CisPep#seqNum1.), |
| 103 | ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1.(cis->icode1cxx . . $ mmdb/CisPep#icode1.), |
| 104 | chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2.(cis->chainID2cxx . . $ mmdb/CisPep#chainID2.), |
| 105 | residue_name_2cxx . . $ coot/util/cis_peptide_info_t#residue_name_2.(cis->pep2cxx . . $ mmdb/CisPep#pep2.), |
| 106 | resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2.(cis->seqNum2cxx . . $ mmdb/CisPep#seqNum2.), |
| 107 | ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2.(cis->icode2cxx . . $ mmdb/CisPep#icode2.), |
| 108 | model_numbercxx . . $ coot/util/cis_peptide_info_t#model_number.(cis->modNumcxx . . $ mmdb/CisPep#modNum.), |
| 109 | omega_torsion_anglecxx . . $ coot/util/cis_peptide_info_t#omega_torsion_angle.(cis->measurecxx . . $ mmdb/CisPep#measure.) {} |
| 110 | |
| 111 | stdcxx . . $ std/::stringcxx . . $ std/string# stringcxx . . $ coot/util/cis_peptide_info_t#string(219584694fe2b248).() const; |
| 112 | |
| 113 | bool operatorcxx . . $ coot/util/cis_peptide_info_t#`operator==`(3b9f48cb8a4c49f8).==(const cis_peptide_info_tcxx . . $ coot/util/cis_peptide_info_t# &a) const { |
| 114 | bool r = false; |
| 115 | |
| 116 | // The model number in pdb files usually bogus because of badly formed CISPEP cards |
| 117 | |
| 118 | // std::cout << "comparing " // << model_number |
| 119 | // << " :" << chain_id_1 << ": " << resno_1 << " :" << ins_code_1 << ": :" |
| 120 | // << chain_id_2 << ": " << resno_2 << " :" << ins_code_2 << ": " |
| 121 | // << "\nto\n" |
| 122 | // << " " // << a.model_number |
| 123 | // << " :" << a.chain_id_1 << ": " << a.resno_1 << " :" << a.ins_code_1 << ": :" |
| 124 | // << a.chain_id_2 << ": " << a.resno_2 << " :" << a.ins_code_2 << ": " |
| 125 | // << std::endl; |
| 126 | // if (a.model_number == model_number) { |
| 127 | if (a.chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1. ==cxx . . $ std/`operator==`(5ea818b58063a774). chain_id_1cxx . . $ coot/util/cis_peptide_info_t#chain_id_1.) { |
| 128 | if (a.chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2. ==cxx . . $ std/`operator==`(5ea818b58063a774). chain_id_2cxx . . $ coot/util/cis_peptide_info_t#chain_id_2.) { |
| 129 | if (a.resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1. == resno_1cxx . . $ coot/util/cis_peptide_info_t#resno_1.) { |
| 130 | if (a.resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2. == resno_2cxx . . $ coot/util/cis_peptide_info_t#resno_2.) { |
| 131 | if (a.ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1. ==cxx . . $ std/`operator==`(5ea818b58063a774). ins_code_1cxx . . $ coot/util/cis_peptide_info_t#ins_code_1.) { |
| 132 | if (a.ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2. ==cxx . . $ std/`operator==`(5ea818b58063a774). ins_code_2cxx . . $ coot/util/cis_peptide_info_t#ins_code_2.) { |
| 133 | r = 1; |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | // } |
| 141 | return r; |
| 142 | } |
| 143 | |
| 144 | }; |
| 145 | |
| 146 | // what type of cis-peptide is this? |
| 147 | // twisted? pre-pro? non-pre-pro-cis |
| 148 | // Of course "twisted" is not strictly cis. |
| 149 | // perhaps this function should be called unorthodox_peptide_torsion_quad_info_t |
| 150 | // |
| 151 | class cis_peptide_quad_info_tcxx . . $ coot/util/cis_peptide_quad_info_t# { |
| 152 | public: |
| 153 | enum type_tcxx . . $ coot/util/cis_peptide_quad_info_t#type_t# { UNSET_TYPEcxx . . $ coot/util/cis_peptide_quad_info_t#UNSET_TYPE., CIScxx . . $ coot/util/cis_peptide_quad_info_t#CIS., PRE_PRO_CIScxx . . $ coot/util/cis_peptide_quad_info_t#PRE_PRO_CIS., TWISTED_TRANScxx . . $ coot/util/cis_peptide_quad_info_t#TWISTED_TRANS. }; |
| 154 | atom_quadcxx . . $ coot/atom_quad# quadcxx . . $ coot/util/cis_peptide_quad_info_t#quad.; |
| 155 | atom_index_quadcxx . . $ coot/atom_index_quad# index_quadcxx . . $ coot/util/cis_peptide_quad_info_t#index_quad.; |
| 156 | type_tcxx . . $ coot/util/cis_peptide_quad_info_t#type_t# typecxx . . $ coot/util/cis_peptide_quad_info_t#type.; |
| 157 | cis_peptide_quad_info_tcxx . . $ coot/util/cis_peptide_quad_info_t#cis_peptide_quad_info_t(5d484326d2ca43ec).(const atom_quadcxx . . $ coot/atom_quad# &q, const atom_index_quadcxx . . $ coot/atom_index_quad# &iq, type_tcxx . . $ coot/util/cis_peptide_quad_info_t#type_t# t_in) : |
| 158 | quadcxx . . $ coot/util/cis_peptide_quad_info_t#quad.(q), index_quadcxx . . $ coot/util/cis_peptide_quad_info_t#index_quad.(iq), typecxx . . $ coot/util/cis_peptide_quad_info_t#type.(t_in) {} |
| 159 | }; |
| 160 | |
| 161 | |
| 162 | |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | #endif // COOT_UTILS_CIS_PEPTIDE_INFO_HH |
| 167 |