Skip to content

Names

cli_replace_resnames()

Command-line interface for renaming residues.

cli_unify_water_labels()

Command-line interface for unifying water residue and atom names.

modify_lines(pdb_lines, fn_process, fn_args, fn_filter=None, include=None, exclude=None)

replace_atom_names(pdb_lines, orig_atom_name, new_atom_name)

Replace all atom names with another.

PARAMETER DESCRIPTION
pdb_lines

List of lines in the PDB file.

TYPE: Iterable[str]

orig_atom_name

Original atom name to replace.

TYPE: str

new_atom_name

New atom name.

TYPE: str

RETURNS DESCRIPTION
list[str]

PDB lines with replace atom names.

replace_residue_names(pdb_lines, orig_resname, new_resname, fn_filter=None, include=None, exclude=None)

Replace all instances of residue names with another.

PARAMETER DESCRIPTION
pdb_lines

List of lines in the PDB file.

TYPE: Iterable[str]

orig_resname

Original residue name to replace.

TYPE: str

new_resname

New residue name.

TYPE: str

fn_filter

Filter function to parse part of a line to see if it is in include or exclude.

TYPE: Callable[[str], str] | None DEFAULT: None

include

Only process lines where the result of fn_filter is in this list.

TYPE: list[str] | None DEFAULT: None

exclude

Do not process lines where the result of fn_filter is in this list.

TYPE: list[str] | None DEFAULT: None

RETURNS DESCRIPTION
list[str]

PDB lines with replace residue names.

run_replace_resnames(pdb_path, resname_map, output_path=None, fn_filter=None, include=None, exclude=None)

Replace residue names.

PARAMETER DESCRIPTION
pdb_path

Path to PDB file.

TYPE: str

resname_map

Original (key) and new (value) mapping of residue names to change.

TYPE: dict[str, str]

output_path

Path to save new PDB file. If None, then no file is written.

TYPE: str | None DEFAULT: None

fn_filter

Filter function to parse part of a line to see if it is in include or exclude.

TYPE: Callable[[str], str] | None DEFAULT: None

include

Only process lines where the result of fn_filter is in this list.

TYPE: list[str] | None DEFAULT: None

exclude

Do not process lines where the result of fn_filter is in this list.

TYPE: list[str] | None DEFAULT: None

RETURNS DESCRIPTION
list[str]

PDB lines with changed residues.

run_unify_water_labels(pdb_path, atom_map=None, water_resname='WAT', water_atomnames=None, output_path=None)

Ensure that water molecule atom names are O, H1, and H2.

Warning

This has not been tested yet.

PARAMETER DESCRIPTION
pdb_path

Path to PDB file.

TYPE: str

atom_map

Water atom mappings for O, H1, and H2. H1 and H2 are the first and second hydrogen atoms after O in the PDB file, respectively. If None, then we default to O, H1, and H2.

TYPE: dict[str, str] | None DEFAULT: None

water_atomnames

Specifies what water atom names are eligible for replacement. If None, then we default to {"O": ["OW"], "H": ["HW"]}.

TYPE: dict[str, Iterable[str]] | None DEFAULT: None

water_resname

Residue name of the water molecules.

TYPE: str DEFAULT: 'WAT'

output_path

Path to save new PDB file. If None, then no file is written.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
Iterable[str]

PDB lines with changed residues.