Interface for reading and writing Protein Data Bank (PDB) files
| Parameters: | filename : str
mode : {‘r’, ‘w’}
force_overwrite : bool
|
|---|
See also
Notes
When writing pdb files, mdtraj follows the PDB3.0 standard as closely as possible. During reading however, we try to be more lenient. For instance, we will parse common nonstandard atom names during reading, and convert them into the standard names. The replacement table used by mdtraj is at {mdtraj_source}/formats/pdb/data/pdbNames.xml.
Attributes
| positions | The cartesian coordinates of all of the atoms in each frame. |
| topology | The topology from this PDB file. |
| closed | Whether the file is closed |
Methods
| __init__(filename[, mode, force_overwrite]) | |
| close() | Close the PDB file |
| set_chain_names(values) | Set the cycle of chain names used when writing PDB files |
| write(positions, topology[, modelIndex, ...]) | Write a PDB file to disk |
Attributes
| closed | Whether the file is closed |
| distance_unit | |
| i | |
| positions | The cartesian coordinates of all of the atoms in each frame. |
| topology | The topology from this PDB file. |
| unitcell_angles | The unitcell angles (3-tuple) in this PDB file. |
| unitcell_lengths | The unitcell lengths (3-tuple) in this PDB file. |
Close the PDB file
Whether the file is closed
The cartesian coordinates of all of the atoms in each frame. Available when a file is opened in mode=’r’
Set the cycle of chain names used when writing PDB files
When writing PDB files, PDBTrajectoryFile translates each chain’s index into a name – the name is what’s written in the file. By default, chains are named with the letters A-Z.
| Parameters: | values : list
|
|---|
The topology from this PDB file. Available when a file is opened in mode=’r’
The unitcell angles (3-tuple) in this PDB file. May be None
The unitcell lengths (3-tuple) in this PDB file. May be None
Write a PDB file to disk
| Parameters: | positions : array_like
topology : mdtraj.Topology
modelIndex : {int, None}
unitcell_lengths : {tuple, None}
unitcell_angles : {tuple, None}
bfactors : array_like, default=None, shape=(n_atoms,)
|
|---|