AnnotatedStructure

Module

viennaptm.dataclasses.annotatedstructure
class AnnotatedStructure(id)

Bases: Structure

Extension of Bio.PDB.Structure.Structure with annotation support.

This class adds logging functionality for residue-level modifications to a Biopython PDB structure. Structures can be loaded either from the RCSB PDB database or from a local PDB file, annotated with modifications, and written back to disk.

The application log is internally stored as a pandas.DataFrame.

add_to_modification_log(residue_number: int, chain_identifier: str, original_abbreviation: str, target_abbreviation: str)

Add a residue application entry to the application log.

Parameters:
  • residue_number (int) – Position of the residue in the polypeptide chain, starting at 1 from the N-terminus. A residue number indicates the position of an amino acid in a protein’s polypeptide chain, starting from (1) at the N-terminus and ending at the C-terminus. For example, "His 18" means the 18th amino acid in the chain is histidine.

  • chain_identifier (str) – Chain identifier of the residue (commonly a single uppercase letter ).

  • original_abbreviation (str) – The original abbreviation for a canonical amino acid refers to a standardized three-letter abbreviation for a standard, representative amino acid in a database like UniProt eg: ASP for aspartic acid or GLU for glutamic acid.

  • target_abbreviation (str) – Three-letter abbreviation of the modified or target amino acid.

delete_log_entry(residue_number: int, chain_identifier: str)

Delete an application log entry.

Entries are removed based on matching residue number and chain identifier.

Parameters:
  • residue_number (int) – Position of the residue in the polypeptide chain. A residue number indicates the position of an amino acid in a protein’s polypeptide chain, starting from (1) at the N-terminus and ending at the C-terminus. For example, "His 18" means the 18th amino acid in the chain is histidine.

  • chain_identifier (str) – Chain identifier of the residue.

classmethod from_cif(path: str | Path)

Instantiate an AnnotatedStructure (base: Biopython PDB structure) with data from a local file.

Parameters:

path (str or pathlib.Path) – Path to the local MMCIF file (ends on .cif).

Raises:

TypeError – If the path is not a string or Path object.

Returns:

Loaded and annotated structure.

Return type:

AnnotatedStructure

classmethod from_pdb(path: str | Path)

Instantiate an AnnotatedStructure (base: Biopython PDB structure) with data from a local file.

Parameters:

path (str or pathlib.Path) – Path to the local PDB file.

Raises:

TypeError – If the path is not a string or Path object.

Returns:

Loaded and annotated structure.

Return type:

AnnotatedStructure

classmethod from_rcsb(identifier: str)

Load a AnnotatedStructure (base: Biopython PDB structure) from the RCSB PDB database via an identifier. Default format has changed to mmcif.

The file is downloaded to a temporary directory, parsed, and then removed after loading.

Parameters:

identifier (str) – Four-character PDB identifier.

Raises:
  • AttributeError – If the identifier is not a string of length four.

  • FileExistsError – If the PDB file could not be retrieved.

Returns:

Loaded and annotated structure.

Return type:

AnnotatedStructure

get_log() DataFrame

Return the application log.

Returns:

DataFrame containing all logged residue modifications.

Return type:

pandas.DataFrame

print_log()

Print the application log to stdout.

The index is removed prior to printing, and pandas display options are adjusted to allow printing of wide and long tables (max. columns 1000 and max. width 1000).

to_cif(path: str | Path) None

Write the AnnotatedStructure object (CAUTION: Only Biopython PDB structure elements) to an mmCIF file.

Parameters:

path (str) – Destination path for the mmCIF file.

to_pdb(path: str | Path) None

Write the AnnotatedStructure object (CAUTION: Only Biopython PDB structure elements) to a PDB file.

Parameters:

path (str) – Destination path for the PDB file.

Methods

__init__(id)

Initialize an AnnotatedStructure instance.

add(entity)

Add a child to the Entity.

add_to_modification_log(residue_number, ...)

Add a residue application entry to the application log.

atom_to_internal_coordinates([verbose])

Create/update internal coordinates from Atom X,Y,Z coordinates.

center_of_mass([geometric])

Return the center of mass of the Entity as a numpy array.

copy()

Copy entity recursively.

delete_log_entry(residue_number, ...)

Delete an application log entry.

detach_child(id)

Remove a child.

detach_parent()

Detach the parent.

from_cif(path)

Instantiate an AnnotatedStructure (base: Biopython PDB structure) with data from a local file.

from_pdb(path)

Instantiate an AnnotatedStructure (base: Biopython PDB structure) with data from a local file.

from_rcsb(identifier)

Load a AnnotatedStructure (base: Biopython PDB structure) from the RCSB PDB database via an identifier.

get_atoms()

Return atoms from residue.

get_chains()

Return chains from models.

get_full_id()

Return the full id.

get_id()

Return the id.

get_iterator()

Return iterator over children.

get_level()

Return level in hierarchy.

get_list()

Return a copy of the list of children.

get_log()

Return the application log.

get_models()

Return models.

get_parent()

Return the parent Entity object.

get_residues()

Return residues from chains.

has_id(id)

Check if a child with given id exists.

insert(pos, entity)

Add a child to the Entity at a specified position.

internal_to_atom_coordinates([verbose])

Create/update atom coordinates from internal coordinates.

print_log()

Print the application log to stdout.

set_parent(entity)

Set the parent Entity object.

strictly_equals(other[, compare_coordinates])

Compare this entity to the other entity for equality.

to_cif(path)

Write the AnnotatedStructure object (CAUTION: Only Biopython PDB structure elements) to an mmCIF file.

to_pdb(path)

Write the AnnotatedStructure object (CAUTION: Only Biopython PDB structure elements) to a PDB file.

transform(rot, tran)

Apply rotation and translation to the atomic coordinates.