Supporting Functions

This module defines a functions for handling conformational ensembles.

saveEnsemble(ensemble, filename=None, **kwargs)[source]

Save ensemble model data as filename.ens.npz. If filename is None, title of the ensemble will be used as the filename, after white spaces in the title are replaced with underscores. Extension is .ens.npz. Upon successful completion of saving, filename is returned. This function makes use of numpy.savez() function.

loadEnsemble(filename)[source]

Returns ensemble instance loaded from filename. This function makes use of numpy.load() function. See also saveEnsemble()

trimPDBEnsemble(pdb_ensemble, **kwargs)[source]

Returns a new PDB ensemble obtained by trimming given pdb_ensemble. This function helps selecting atoms in a pdb ensemble based on one of the following criteria, and returns them in a new PDBEnsemble instance.

Occupancy

Resulting PDB ensemble will contain atoms whose occupancies are greater or equal to occupancy keyword argument. Occupancies for atoms will be calculated using calcOccupancies(pdb_ensemble, normed=True).

Parameters:occupancy (float) – occupancy for selecting atoms, must satisfy 0 < occupancy <= 1
calcOccupancies(pdb_ensemble, normed=False)[source]

Returns occupancy calculated from weights of a PDBEnsemble. Any non-zero weight will be considered equal to one. Occupancies are calculated by binary weights for each atom over the conformations in the ensemble. When normed is True, total weights will be divided by the number of atoms. This function can be used to see how many times a residue is resolved when analyzing an ensemble of X-ray structures.

showOccupancies(pdbensemble, *args, **kwargs)[source]

Show occupancies for the PDB ensemble using plot(). Occupancies are calculated using calcOccupancies().

alignPDBEnsemble(ensemble, suffix='_aligned', outdir='.', gzip=False)[source]

Align PDB files using transformations from ensemble, which may be a PDBEnsemble or a PDBConformation instance. Label of the conformation (see getLabel()) will be used to determine the PDB structure and model number. First four characters of the label is expected to be the PDB identifier and ending numbers to be the model number. For example, the Transformation from conformation with label 2k39_ca_selection_’resnum_<_71’_m116 will be applied to 116th model of structure 2k39. After applicable transformations are made, structure will be written into outputdir as 2k39_aligned.pdb. If gzip is True, output files will be compressed. Return value is the output filename or list of filenames, in the order files are processed. Note that if multiple models from a file are aligned, that filename will appear in the list multiple times.