Package mmLib :: Module Structure :: Class Fragment
[hide private]
[frames] | no frames]

Class Fragment

source code

object --+
         |
        Fragment
Known Subclasses:

Fragment objects are a basic unit for organizing small groups of Atoms. Amino acid residues are fragments, as well as nucleic acids and other small molecules. In terms of a PDB file, they are all the atoms from a unique residue in a chain.

Fragments have the following attributes:

Fragment.res_name - the fragment/residue name Fragment.res_seq - the sequence id of the fragment/residue Fragment.chain_id - the ID of the chain containing this fragment

Instance Methods [hide private]
 
__init__(self, model_id=1, chain_id='', fragment_id='', res_name='', **args)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__str__(self)
str(x)
source code
 
__deepcopy__(self, memo) source code
 
__lt__(self, other) source code
 
__le__(self, other) source code
 
__gt__(self, other) source code
 
__ge__(self, other) source code
 
__len__(self) source code
 
__getitem__(self, name_idx)
Lookup an atom contained in a fragment by its name, or by its index within the fragment's private atom_list.
source code
 
__iter__(self)
Iterates the atoms within the fragment.
source code
 
__contains__(self, atom_idx)
Return True if the Atom object is contained in the fragment.
source code
 
index(self, atom)
Returns the sequential index of the atom.
source code
 
set_default_alt_loc(self, alt_loc)
Sets the default alt_loc of the Fragment.
source code
 
add_atom(self, atom)
Adds an atom to the fragment, and sets the atom's atom.fragment attribute to the fragment.
source code
 
remove_atom(self, atom)
Removes the Atom instance from the Fragment.
source code
 
get_atom(self, name, alt_loc=None)
Returns the matching Atom instance contained in the Fragment.
source code
 
get_equivalent_atom(self, atom)
Returns the atom with the same fragment_id and name as the argument atom, or None if it is not found.
source code
 
iter_atoms(self)
Iterates over all Atom objects contained in the Fragment matching the current model and default alt_loc.
source code
 
count_atoms(self)
Counts Atom objects.
source code
 
iter_all_atoms(self)
Iterates of all Atoms in the Fragment including Altlocs.
source code
 
count_all_atoms(self)
Counts all Atom objects including Atoms in alternate conformations.
source code
 
iter_bonds(self)
Iterates over all Bond objects.
source code
 
get_offset_fragment(self, offset)
Returns the fragment in the same chain at integer offset from self.
source code
 
get_model(self)
Returns the parent Chain object.
source code
 
get_chain(self)
Returns the parent Chain object.
source code
 
get_structure(self)
Returns the parent Structure object.
source code
 
create_bonds(self)
Constructs bonds within a fragment.
source code
 
is_standard_residue(self)
Returns True if the Fragment/Residue object is one of the PDB defined standard residues.
source code
 
is_amino_acid(self)
Returns True if the Fragment is an Amino Acid residue.
source code
 
is_nucleic_acid(self)
Returns True if the Fragment is a Nucleic Acid residue.
source code
 
is_water(self)
Returns True if the Fragment is a water molecule, returns False otherwise.
source code
 
set_model_id(self, model_id)
Sets the model_id of the Fragment and all contained Atom objects.
source code
 
set_chain_id(self, chain_id)
Sets the chain_id of the Fragment and all contained Atom objects.
source code
 
set_fragment_id(self, fragment_id)
Sets the fragment_id of the Fragment and all contained Atom objects.
source code
 
set_res_name(self, res_name)
Sets the res_name of the Fragment and all contained Atom objects.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, model_id=1, chain_id='', fragment_id='', res_name='', **args)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__getitem__(self, name_idx)
(Indexing operator)

source code 

Lookup an atom contained in a fragment by its name, or by its index within the fragment's private atom_list. If the atom is not found, an exception is raised. The type of exception depends on the argument type. If the argument was an integer, then an IndexError is raised. If the argument was a string, then a KeyError is raised.

__iter__(self)

source code 

Iterates the atoms within the fragment. If the fragment contains atoms in alternate conformations, only the atoms with the structure's default_alt_loc are iterated.

get_atom(self, name, alt_loc=None)

source code 

Returns the matching Atom instance contained in the Fragment. Returns None if a match is not found. If alt_loc is not given, then the default alt_loc is used.

iter_bonds(self)

source code 

Iterates over all Bond objects. The iteration is preformed by iterating over all Atom objects in the same order as iter_atoms(), then iterating over each Atom's Bond objects.

get_offset_fragment(self, offset)

source code 

Returns the fragment in the same chain at integer offset from self. Returns None if no fragment is found.

create_bonds(self)

source code 

Constructs bonds within a fragment. Bond definitions are retrieved from the monomer library.

is_standard_residue(self)

source code 

Returns True if the Fragment/Residue object is one of the PDB defined standard residues. PDB standard residues are amino and nucleic acid residues.