00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPATOM_RESIDUE_H
00009 #define IMPATOM_RESIDUE_H
00010
00011 #include "atom_config.h"
00012 #include "atom_macros.h"
00013 #include "Hierarchy.h"
00014 #include "Chain.h"
00015
00016 #include <IMP/base_types.h>
00017 #include <IMP/Particle.h>
00018 #include <IMP/Model.h>
00019 #include <IMP/Decorator.h>
00020
00021 IMPATOM_BEGIN_NAMESPACE
00022
00023
00024
00025
00026
00027 IMP_DECLARE_KEY_TYPE(ResidueType, IMP_RESIDUE_TYPE_INDEX);
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 IMPATOMEXPORT extern const ResidueType UNK;
00044
00045
00046 IMPATOMEXPORT extern const ResidueType GLY;
00047 #ifndef IMP_DOXYGEN
00048
00049
00050
00051 IMPATOMEXPORT extern const ResidueType ALA;
00052
00053 IMPATOMEXPORT extern const ResidueType VAL;
00054
00055 IMPATOMEXPORT extern const ResidueType LEU;
00056
00057 IMPATOMEXPORT extern const ResidueType ILE;
00058
00059 IMPATOMEXPORT extern const ResidueType SER;
00060
00061 IMPATOMEXPORT extern const ResidueType THR;
00062
00063 IMPATOMEXPORT extern const ResidueType CYS;
00064
00065 IMPATOMEXPORT extern const ResidueType MET;
00066
00067 IMPATOMEXPORT extern const ResidueType PRO;
00068
00069 IMPATOMEXPORT extern const ResidueType ASP;
00070
00071 IMPATOMEXPORT extern const ResidueType ASN;
00072
00073 IMPATOMEXPORT extern const ResidueType GLU;
00074
00075 IMPATOMEXPORT extern const ResidueType GLN;
00076
00077 IMPATOMEXPORT extern const ResidueType LYS;
00078
00079 IMPATOMEXPORT extern const ResidueType ARG;
00080
00081 IMPATOMEXPORT extern const ResidueType HIS;
00082
00083 IMPATOMEXPORT extern const ResidueType PHE;
00084
00085 IMPATOMEXPORT extern const ResidueType TYR;
00086
00087 IMPATOMEXPORT extern const ResidueType TRP;
00088
00089 IMPATOMEXPORT extern const ResidueType ACE;
00090
00091 IMPATOMEXPORT extern const ResidueType NH2;
00092
00093
00094
00095 IMPATOMEXPORT extern const ResidueType ADE;
00096
00097 IMPATOMEXPORT extern const ResidueType URA;
00098
00099 IMPATOMEXPORT extern const ResidueType CYT;
00100
00101 IMPATOMEXPORT extern const ResidueType GUA;
00102
00103 IMPATOMEXPORT extern const ResidueType THY;
00104
00105 IMPATOMEXPORT extern const ResidueType DADE;
00106
00107 IMPATOMEXPORT extern const ResidueType DURA;
00108
00109 IMPATOMEXPORT extern const ResidueType DCYT;
00110
00111 IMPATOMEXPORT extern const ResidueType DGUA;
00112
00113 IMPATOMEXPORT extern const ResidueType DTHY;
00114 #endif
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 class IMPATOMEXPORT Residue: public Hierarchy
00127 {
00128 public:
00129 IMP_DECORATOR(Residue, Hierarchy);
00130
00131 static Residue setup_particle(Particle *p, ResidueType t= UNK,
00132 int index=-1, int insertion_code = 32) {
00133 p->add_attribute(get_residue_type_key(), t.get_index());
00134 p->add_attribute(get_index_key(), index);
00135 p->add_attribute(get_insertion_code_key(), insertion_code);
00136
00137 if (!Hierarchy::particle_is_instance(p)) {
00138 Hierarchy::setup_particle(p);
00139 }
00140 Residue ret(p);
00141 ret.set_residue_type(t);
00142 return ret;
00143 }
00144
00145
00146 static Residue setup_particle(Particle *p, Residue o) {
00147 return setup_particle(p, o.get_residue_type(),
00148 o.get_index(),
00149 o.get_insertion_code());
00150 }
00151
00152 static bool particle_is_instance(Particle *p) {
00153 return p->has_attribute(get_residue_type_key())
00154 && p->has_attribute(get_index_key())
00155 && p->has_attribute(get_insertion_code_key())
00156 && Hierarchy::particle_is_instance(p);
00157 }
00158
00159 ResidueType get_residue_type() const {
00160 return ResidueType(get_particle()->get_value(get_residue_type_key()));
00161 }
00162
00163
00164 void set_residue_type(ResidueType t);
00165
00166 bool get_is_protein() const {
00167 return get_residue_type().get_index() < ADE.get_index();
00168 }
00169
00170 bool get_is_dna() const {
00171 return get_residue_type().get_index() >= DADE.get_index()
00172 && get_residue_type().get_index() <= DTHY.get_index();
00173 }
00174
00175 bool get_is_rna() const {
00176 return get_residue_type().get_index() >= ADE.get_index()
00177 && get_residue_type().get_index() < DADE.get_index();
00178 }
00179
00180
00181 IMP_DECORATOR_GET_SET(index, get_index_key(),
00182 Int, Int);
00183
00184 char get_insertion_code() const {
00185 return char(get_particle()->get_value(get_insertion_code_key()));
00186 }
00187
00188 void set_insertion_code(char insertion_code) {
00189 return get_particle()->set_value(get_insertion_code_key(), insertion_code);
00190 }
00191
00192 static IntKey get_index_key();
00193
00194 static IntKey get_residue_type_key();
00195
00196 static IntKey get_insertion_code_key();
00197 };
00198
00199 IMP_OUTPUT_OPERATOR(Residue);
00200
00201 IMP_DECORATORS(Residue, Hierarchies);
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 IMPATOMEXPORT Chain get_chain(Residue rd, bool nothrow=false);
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 IMPATOMEXPORT Hierarchy get_next_residue(Residue rd);
00227
00228 IMPATOM_END_NAMESPACE
00229
00230 #endif