pdb_manipulation

Auxiliary functions to read, manipulate and write .pdb files.

Functions

cif_to_pdb(cif_path, pdb_path)

Convert a PDBx/mmCIF file to PDB format.

df_from_pdb(pdb)

Convert the information in a .pdb file into a pandas DataFrame using BioPDB.

df_to_pdb(df, output_pdb_filename)

Write content of a DataFrame containing PDB file info as a .pdb file using BioPDB.

extract_pdb_info(pdb)

Extract from a .pdb file info about number of chains, chain letters, starting residue

cleanup_pdbs(pdbs)

Delete all .pdb files in the given list.

Module Contents

ensemblify.utils.pdb_manipulation.cif_to_pdb(cif_path, pdb_path)

Convert a PDBx/mmCIF file to PDB format.

Parameters:
  • cif_path (str) – Path to the input .cif file.

  • pdb_path (str) – Path to the output .pdb file.

Return type:

None

ensemblify.utils.pdb_manipulation.df_from_pdb(pdb)

Convert the information in a .pdb file into a pandas DataFrame using BioPDB.

Parameters:

pdb (str) – Path to the .pdb file.

Returns:

The given pdb’s information in DataFrame format.

Return type:

pd.DataFrame

ensemblify.utils.pdb_manipulation.df_to_pdb(df, output_pdb_filename)

Write content of a DataFrame containing PDB file info as a .pdb file using BioPDB.

Parameters:
  • df (pd.DataFrame) – DataFrame containing PDB information.

  • output_pdb_filename (str) – Path to the output .pdb.

ensemblify.utils.pdb_manipulation.extract_pdb_info(pdb)

Extract from a .pdb file info about number of chains, chain letters, starting residue numbers and chain size.

Parameters:
  • topology (str) – Path to .pdb topology file.

  • pdb (str)

Returns:

Mapping of chain numbers to their letter, starting residue number and chain size.

Return type:

dict[int,tuple[str,int,int]]

ensemblify.utils.pdb_manipulation.cleanup_pdbs(pdbs)

Delete all .pdb files in the given list.

Parameters:

pdbs (list[str]) – Paths to .pdb files to delete.