parmed.formats.pqr module¶
This module contains classes for reading and writing PQR files
-
class
parmed.formats.pqr.
PQRFile
[source]¶ Bases:
object
Standard PDB file format parser and writer
Methods
id_format
(filename)Identifies the file type as a PDB file
parse
(filename[, skip_bonds])Read a PQR file and return a populated Structure class
write
(struct, dest[, renumber, coordinates, …])Write a PDB file from a Structure instance
-
static
id_format
(filename)[source]¶ Identifies the file type as a PDB file
- Parameters
- filenamestr
Name of the file to check format for
- Returns
- is_fmtbool
True if it is a PQR file
-
static
parse
(filename, skip_bonds=True)[source]¶ Read a PQR file and return a populated Structure class
- Parameters
- filenamestr or file-like
Name of the PQR file to read, or a file-like object that can iterate over the lines of a PQR. Compressed file names can be specified and are determined by file-name extension (e.g., file.pqr.gz, file.pqr.bz2)
- skip_bondsbool, optional
If True, skip trying to assign bonds. This can save substantial time when parsing large files with non-standard residue names. However, no bonds are assigned. This is OK if, for instance, the PQR file is being parsed simply for its coordinates. Default is False.
- Returns
- structure
Structure
The Structure object initialized with all of the information from the PDB file. No bonds or other topological features are added by default.
- structure
-
static
write
(struct, dest, renumber=True, coordinates=None, standard_resnames=False)[source]¶ Write a PDB file from a Structure instance
- Parameters
- struct
Structure
The structure from which to write the PDB file
- deststr or file-like
Either a file name or a file-like object containing a write method to which to write the PDB file. If it is a filename that ends with .gz or .bz2, a compressed version will be written using either gzip or bzip2, respectively.
- renumberbool, optional
If True, renumber the atoms and residues sequentially as they are stored in the structure. If False, use the original numbering if it was assigned previously. Default is True
- coordinatesarray-like of float, optional
If provided, these coordinates will be written to the PDB file instead of the coordinates stored in the structure. These coordinates should line up with the atom order in the structure (not necessarily the order of the “original” PDB file if they differ)
- standard_resnamesbool, optional
If True, common aliases for various amino and nucleic acid residues will be converted into the PDB-standard values. Default is False
- struct
-
static