pdbTool |
index |
An object to read and write PDB files to or from the current Simulation.
If there is a possibility that atom naming is inconsistent with
Xplor-NIH standards, the protocol.initCoords() helper should be
used, as it can handling naming translations.
Constructor:
PDBTool(filename, atomSel, useChainID=True, strictResNames=False)
both arguments are optional. If the selection is omitted, it defaults
to all atoms of the current simulation.Simulation. If the filename is
blank, the contents string buffer is used for reading/writing. If useChainID
is True, if chainID is not a space, it will be used as the segment name, with
the segid field ignored. If useChainID=False, the chainID field is ignored.
If strictResNames is True, atoms will not be loaded if the residue name in
the PDB record differs from that in the PSF.
The primary methods of the class are:
read(model) - read the pdb file. If the model argument is present, the
specified PDB MODEL entry is read. If it is not present
or the value is negative, the first MODEL is read.
The return value is a list of unmatched ATOM
entries, if any. If the specified model number is not
found, an exception is thrown. ATOM entries with non-
allowed AltLoc entries or entries with the insertion code
column set are ignored.
write(coords) - write the file. Make a backup if makeBackup()==1.
If the coords argument is present it should specify a
sequence of CDSVectors of atom positions, one for each
atom in the Simulation. These are written as separate
MODEL entries. If this argument is absent, the current
Simulation's coordinates are written with no MODEL entry.
writeAtoms() - write ATOM records only for all atoms in selection. No
write initialization or closing is performed.
writeOneAtom(atom,atomPos,occupancy,bfactor,altLoc) -
Write out a single PDB ATOM record for the specified
atom. All but the first argument are optional and may
be specified by keyword argument names.
writeInitialize(atomIndex=1) -
initialize file or contents buffer for a new
structure, clearing the chainID and setting the
atom index to the optional argument.
writeClose() - Close file written to using writeOneAtom(). The file
is also closed if the PDBTool object goes out of scope
or otherwise deleted.
numModels() - return the number of MODEL records in the PDB entry.
models() - return a list of integer models present in the PDB entry.
altLocs() - return a list of all (unique) characters which appear in
the altLoc field.
format() - Return the file format type: "PDB", "CIF" or "unknown".
If the format type is "unknown", determinFormat is called.
determineFormat()- Set format by examining the current contents of the
file or string input. The format() method should usually
be called instead.
REMARK fields are manipulated using the following methods:
readRemarks() - read in the REMARK records from the input file.
addRemark(string) - add a remark field (one line).
addRemarks(arg) - in this case, arg is a multiline string.
Each line is successively added as a remark.
clearRemarks() - remove all remark fields.
remarks() - return the current remark fields in a list.
CONECT records are manipulated using the following methods:
readConect() - read in the CONECT records from the input file.
addConect(list) - add a CONECT record, where list contains 2 or more
integer atom ids (offset 1).
clearConect() - remove all CONECT records.
conect() - return the current CONECT records as a list of lists of
integer ids.
numRead() - return the number of ATOM records succesfully read
during the previous call to read().
The following accessors are available:
selection - an atomSel.AtomSel which specifies atoms to be read or
written.
filename - the file name to be read or written.
contents - string buffer used if the filename is blank. To read from a
string, first use setContents(string), then call read(). To
get the PDB record as a string, first call write(), then
getContents().
makeBackup - boolean. If true, make a backup of the current pdb file
before writing. Default value: true.
verbose - whether to print a warning when unknown atoms are read in.
Default: true if simulationWorld.logLevel is not NONE.
aux1(atom) - the aux1 (occupancy) field for the specified atom.
This member can be set using setAux1(atom,value).
occupancy() - synonym for aux1.
aux2(atom) - the aux2 (bfactor) field for the specified atom.
This member can be set using setAux2(atom,value).
bfactor() - synonym for aux2(atom).
occupancies() - return a list of occupancies of all atoms.
bfactors() - return a list of bfactors of all atoms.
hetatmSel - atomSel.AtomSel which atoms to write HETATM entries
for. Atoms not in this selection instead are written with
ATOM entries, and this selection is empty by default.
includeHETATM - boolean. If True, read HETATM records as ATOM records [False].
allowedAltLoc - ATOM entries with one of these values will be read-
otherwise the entry will be ignored.
default value: [' ', 'A']
useChainID - overwrite the segment name with the chainID PDB field, if
the chainID field is not blank. This is only used when
reading a PDB record.
writeChainID - write the segment name to the chainID pdb field and leave
the segment name field blank. Additionally, a TER record
will be written between ATOM records when the segment name
changes, and at the end of a structure. An exception will
be thrown if the segment name is longer than one character.
remarksCatName- For reading mmCIF files, this string specifies the name of
the category for the Xplor-NIH remarks ["XplorNIH_remarks"].
For a given member, values can be read using the method member() and set via
setMember(val).
The atom name field is controlled by the following methods:
useXplorNames() - use the XPLOR naming convention. This includes
changing the "*" character to a "'".
useIupacNames() - use the IUPAC naming conventions.
The following is a low-level helper routine:
readAtoms() - array for each atom (by index) specifying whether it
was read in the last call to read().
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
Classes | ||||||||||||||||||||||||||||||||||
|
Functions | ||
|