Bio.Crystal package

Module contents

Represent the NDB Atlas structure (a minimal subset of PDB format) (OBSOLETE).

Hetero, Crystal and Chain exist to represent the NDB Atlas structure. Atlas is a minimal subset of the PDB format. Hetero supports a 3 alphanumeric code. The NDB web interface is located at

Bio.Crystal.Hetero substitute is Bio.PDB.Atom Bio.Crystal.Chain substitute is Bio.PDB.Chain Bio.Crystal.Crystal substitute is Bio.PDB.Structure

Using Bio.PDB you can navigate the data as below:

from Bio.PDB.PDBParser import PDBParser
parser = PDBParser(PERMISSIVE=1)
# PDB NDB Only file
structure = parser.get_structure("001", "001_msd.pbd")
for model in structure:
    print('Model ',model)
    for chain in model:
        print('Chain ', chain)
        for residue in chain:
            print('Res ', residue)
            for atom in residue:
                print('Atom ', atom)

Bio.Crystal is self-contained, with the main functionality covered by Bio.PDB.

exception Bio.Crystal.CrystalError

Bases: Exception

Class to manage errors.


Add end of line at character eighty, to match PDB record standard.


Check if key is a string and has at least one character.

class Bio.Crystal.Hetero(data)

Bases: object

Class to support the PDB hetero codes.

Supports only the 3 alphanumeric code. The annotation is available from

__init__(self, data)

Initialize the class.

__eq__(self, other)

Return self==value.

__ne__(self, other)

Return true iff self is not equal to other.


Return repr(self).


Return str(self).

__hash__ = None
class Bio.Crystal.Chain(residues='')

Bases: object

Class representing a sequence of Hetero elements.

__init__(self, residues='')

Initialize the class.


Check all data elements are of type Hetero.

validate_element(self, element)

Check the element is of type Hetero.


Return str(self).

__eq__(self, other)

Return self==value.

__ne__(self, other)

Return true iff self is not equal to other.

__getitem__(self, index)
__setitem__(self, index, value)
__delitem__(self, index)
__contains__(self, item)
append(self, item)

Add Hetero element.

insert(self, i, item)

Insert Hetero element in position i of the Chain.

remove(self, item)

Delete Hetero element.

count(self, item)

Return number of elements in the Chain.

index(self, item)

Find the index of the item.

__add__(self, other)
__radd__(self, other)
__iadd__(self, other)
__hash__ = None
class Bio.Crystal.Crystal(data=None)

Bases: object

Represents a dictionary of labeled chains from the same structure.

__init__(self, data=None)

Initialize the class.


Change element of type string to type Chain.

All elements of Crystal shall be Chain.


Return repr(self).


Return str(self).


Return Chains and correspondent Heteros.

__getitem__(self, key)
__setitem__(self, key, item)
__delitem__(self, key)

Empty the data.


Copy the Crystal object.


Return all Chain labels.


Return all tuples (Chain label, Hetero).


Return all Hetero in the Chains.

__contains__(self, value)
has_key(self, key)

Return true if the Chain Label is in the dictionary.

get(self, key, failobj=None)

Return Hetero for the given Chain Label.

setdefault(self, key, failobj=None)

Return Hetero for the given Chain Label, if Chain Label is not there add it.


Return and delete a Chain.