8#ifndef IMPATOM_RESIDUE_H
9#define IMPATOM_RESIDUE_H
11#include <IMP/atom/atom_config.h>
21IMPATOM_BEGIN_NAMESPACE
137class IMPATOMEXPORT Residue :
public Hierarchy {
139 ResidueType t =
UNK,
int index = -1,
140 int insertion_code = 32) {
141 m->add_attribute(get_residue_type_key(), pi, t.get_index());
142 m->add_attribute(get_index_key(), pi, index);
143 m->add_attribute(get_insertion_code_key(), pi, insertion_code);
153 do_setup_particle(m, pi, o.get_residue_type(), o.get_index(),
154 o.get_insertion_code());
167 return m->get_has_attribute(get_residue_type_key(), pi) &&
168 m->get_has_attribute(get_index_key(), pi) &&
169 m->get_has_attribute(get_insertion_code_key(), pi) &&
173 ResidueType get_residue_type()
const {
174 return ResidueType(get_model()->get_attribute(get_residue_type_key(),
175 get_particle_index()));
181 bool get_is_protein()
const {
182 return get_residue_type().get_index() < ADE.get_index();
185 bool get_is_dna()
const {
186 return get_residue_type().get_index() >= DADE.get_index() &&
187 get_residue_type().get_index() <= DTHY.get_index();
190 bool get_is_rna()
const {
191 return get_residue_type().get_index() >= ADE.get_index() &&
192 get_residue_type().get_index() < DADE.get_index();
198 char get_insertion_code()
const {
199 return char(
get_model()->get_attribute(get_insertion_code_key(),
203 void set_insertion_code(
char insertion_code) {
204 return get_model()->set_attribute(get_insertion_code_key(),
205 get_particle_index(), insertion_code);
208 static IntKey get_index_key();
210 static IntKey get_residue_type_key();
212 static IntKey get_insertion_code_key();
240IMPATOMEXPORT ResidueType get_residue_type(
char c);
The base class for decorators.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Decorator for helping deal with a hierarchy of molecules.
Macros for maintaining molecular hierarchies.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
Model * get_model() const
Returns the Model containing the particle.
Class for storing model, its restraints, constraints, and particles.
The standard decorator for manipulating molecular structures.
static bool get_is_setup(Model *m, ParticleIndex p)
Check if the particle has the needed attributes for a cast to succeed.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
A decorator for a residue.
static TriggerKey get_type_changed_key()
The key used to signal to the Model that residue/atom type has changed.
void set_residue_type(ResidueType t)
Update the stored ResidueType and the atom::Hierarchy::Name.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
#define IMP_DECORATOR_SETUP_2(Name, FirstArgumentType, first_argument_name, SecondArgumentType, second_argument_name)
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name, SecondArgumentType, second_argument_name, ThirdArgumentType, third_argument_name)
Hierarchy get_next_residue(Residue rd)
Return the residue from the same chain with one higher index.
IMP::Vector< ResidueType > ResidueTypes
char get_one_letter_code(ResidueType c)
Get the 1-letter amino acid code from the residue type.
double get_mass(ResidueType c)
Get the mass from the residue type.
const ResidueType UNK
Unknown residue.
Hierarchy get_previous_residue(Residue rd)
Return the residue from the same chain with one lower index.
Index< ParticleIndexTag > ParticleIndex
int Int
Basic integer value.
Key< 1 > IntKey
The type used to identify int attributes in the Particles.
Key< 11 > TriggerKey
The type used to identify changed model properties.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.