propka.run
Script functionality
The run
module provides a high-level interface to PROPKA 3.
The propka3 script consists of the main()
function. If similar functionality is desired from a Python script
(without having to call the propka script itself) then the
single()
function can be used instead.
Functions
|
Read in structure files, calculate pKa values, and print pKa files. |
|
Run a single PROPKA calculation using |
- propka.run.main(optargs=None)[source]
Read in structure files, calculate pKa values, and print pKa files.
Changed in version 3.4.0: Removed ability to write out PROPKA input files.
- propka.run.single(filename: PathLike | str, optargs: Iterable[str] = (), stream: IO[str] | None = None, write_pka: bool = True)[source]
Run a single PROPKA calculation using
filename
as input.- Parameters:
filename (str) – name of input file. If filestream is not passed via
stream
, should be a path to the file to be read.optargs (tuple) – Optional, commandline options for propka. Extra files passed via
optargs
will be ignored, see Notes.stream – optional filestream handle. If
None
, thenfilename
will be used as path to input file for reading.write_pka (bool) – Controls if the pKa file should be writen to disk.
- Returns:
MolecularContainer
object.
Examples
Given an input file “protein.pdb”, run the equivalent of
propka3 --mutation=N25R/N181D -v --pH=7.2 protein.pdb
as:propka.run.single("protein.pdb", optargs=["--mutation=N25R/N181D", "-v", "--pH=7.2"])
By default, a pKa file will be written. However in some cases one may wish to not output this file and just have access to the
MolecularContainer
object. If so, then passFalse
towrite_pka
:mol = propka.run.single("protein.pdb", write_pka=False)
In some cases, one may also want to pass a file-like (e.g.
io.StringIO
) object instead of a file path as a string. In these cases the file-like object should be passed to thestream
argument and a string indicating the file type in thefilename
argument; this string only has to look like a valid file name, it does not need to exist because the data are actually read fromstream
. This approach is necessary because file-like objects do not usually have names, and propka uses thefilename
argument to determine the input file type, and assigns the file name for theMolecularContainer
object:mol = propka.run.single('input.pdb', stream=string_io_file)
In this case, a PDB file-like object was passed as string_io_file. The resultant pKa file will be written out as input.pka.
Notes
Only a single input structure file will be processed, defined by
filename
(andstream
if passing a file-like object). Any additional files passed via the -f or –file flag to optargs will be ignored.
See also
Changed in version 3.4.0: Removed ability to write out PROPKA input files.