propka.input
Input handling
Input routines.
Changed in version 3.4.0: Methods to read PROPKA input files (read_propka() and
get_atom_lines_from_input()) have been removed.
Functions
|
TODO - figure out what this function does. |
|
Get atom lines from PDB file. |
|
Open file or file-like stream for reading. |
|
Read input file or stream (PDB or PROPKA) for a molecular container |
|
Read a parameter file. |
|
Parse a PDB file. |
- propka.input.get_atom_lines_from_pdb(pdb_file: IO[str] | PathLike | str, ignore_residues: Iterable[str] = (), keep_protons: bool = False, tags: Iterable[str] = ('ATOM ', 'HETATM'), chains: Iterable[str] | None = None) Iterator[Tuple[str, Atom]][source]
Get atom lines from PDB file.
- Parameters:
pdb_file – PDB file to parse
ignore_residues – list of residues to ignore
keep_protons – bool to keep/ignore protons
tags – tags of lines that include atoms
chains – list of chains
- propka.input.open_file_for_reading(input_file: IO[str] | PathLike | str) ContextManager[IO[str]][source]
Open file or file-like stream for reading.
- Parameters:
input_file – path to file or file-like object. If file-like object,
seek (then will attempt)
- propka.input.read_molecule_file(filename: PathLike | str, mol_container: MolecularContainer, stream: IO[str] | None = None) MolecularContainer[source]
Read input file or stream (PDB or PROPKA) for a molecular container
- Parameters:
filename (str) – name of input file. If not using a filestream via the
streamargument, should be a path to the file to be read.mol_container –
MolecularContainerobject.stream – optional filestream handle. If
None, then openfilenameas a local file for reading.
- Returns:
updated
MolecularContainerobject.- Raises:
ValuError – if invalid input given
Examples
There are two main cases for using
read_molecule_file. The first (and most common) is to pass the input file (filename) as a string which gives the path of the molecule file to be read (here we also pass aMolecularContainerobject namedmol_container).>>> read_molecule_file('test.pdb', mol_container) <propka.molecular_container.MolecularContainer at 0x7f6e0c8f2310>
The other use case is when passing a file-like object, e.g. a
io.StringIOclass, instance. This is done by passing the object via thestreamargument. Since file-like objects do not usually have an associated file name, an appropirate file name should be passed to thefilenameargument. In this case,filenameis not opened for reading, but instead is used to help recognise the file type (based on the extension being .pdb) and also uses that givenfilenameto assign a name to the inputMolecularContainerobject.>>> read_molecule_file('test.pdb', mol_container, stream=string_io_object) <propka.molecular_container.MolecularContainer at 0x7f6e0c8f2310>
Changed in version 3.4.0: PROPKA input files (extension: .propka_input) are no longer read.
- propka.input.read_parameter_file(input_file: PathLike | str, parameters: Parameters) Parameters[source]
Read a parameter file.
- Parameters:
input_file – input file to read
parameters – Parameters object
- Returns:
updated Parameters object
- propka.input.read_pdb(pdb_file: IO[str] | PathLike | str, parameters: Parameters, molecule: MolecularContainer)[source]
Parse a PDB file.
- Parameters:
pdb_file – file to read
parameters – parameters to guide parsing
molecule – molecular container
- Returns:
list of conformations
list of names
- Return type:
list with elements