structure

Structure Objects

class Structure()

__init__

def __init__(name, file, id=None, source="PDB", destination=".")

Arguments:

  • name: name
  • file: pdb or cif file
  • id: id can be none if file is none and id is not we will download from source
  • source: where to get the pdb from
  • destination: where to download it, these are passed to structure.utils.download

align

def align(other, destination)

align 2 structures (they must have a file) using mustang

Arguments:

  • other: other structure
  • destination: where to save the output

Returns:

result of the file, html output for alignment and rotation

find_pockets

def find_pockets(**kwargs)

Run fpocket on this structure and return detected pocket info. Returns (pocket_files, pocket_coords)

to_3di

def to_3di(chain)

for a chain convert the structure to 3di

sequence

def sequence()

extract the aa sequence from the pdb, if there are gap there will be - if there are unknown aa there will be an X

tm_score

def tm_score(other)

run us-align to get the tm score between 2 structures

Arguments:

  • other: other structure

Returns:

retun the tm score

contacts

def contacts(chain_id1, chain_id2, cutoff=5.0, level="atom", measure="any")

Get contacts between two chains in the structure.

Arguments:

  • chain_id1: chain 1
  • chain_id2: chain 2
  • cutoff: distance cutoff to be called contacting default 5A
  • level: if “atom” return the contacting atom, if residue return the residues

Returns:

a list of atoms, residues etc.

__getitem__

def __getitem__(key: Union[str, int, slice, Tuple[str, Union[int, str]]])

Support indexing:

  • structure[‘A’] -> returns chain atoms (Biotite AtomArray slice)
  • structure[0] -> returns first chain atoms (by order in self.chains)
  • structure[‘A’, 100] -> returns list of atoms belonging to residue id 100 in chain A
  • structure[0:2] -> list of chain AtomArray slices for the first two chains

utils

download

def download(id, source="PDB", destination=None)

download a cif file (RSCB) or a pdb file (AFDB) for a given id

Arguments:

  • id: id
  • source: where to get it from PDB or AFDB
  • destination: where to download ti

Returns:

a path, you can use this to download things it’s also being used by Structure internally

get_pocket_dimensions

def get_pocket_dimensions(pocket_path)

get the bounding box of a pocket

Arguments:

  • pocket_path: pocket pdb from find_pockets

Returns:

x,y,z coords

bounding_box

def bounding_box(self, amino_acids=None, use_alpha_carbon=False)

generate a bounding box around a given list of amino acid ids. This can be used to generate more molecules or

calculate properties of a pocket

Arguments:

  • use: target or bound structure, this needs to be a Structure instance
  • amino_acids: which amino acids to use
  • use_alpha_carbon: whether to use the alpha carbon or the side chains to get the bounding box

Returns:

6 coordinates of the bounding box