Basic Usage

To usepdb_numpy in a project:

import pdb_numpy

Create a Coor() object

Loading a structure

You can either get the coordinates from the Protein Data Bank:

coor_1hsg = pdb_numpy.Coor(pdb_id='1hsg')

Or load a local stored .pdb file:

coor_1hsg = pdb_numpy.Coor('./1hsg.pdb')

or .cif file:

coor_1hsg = pdb_numpy.Coor('./1hsg.cif')

Selection of coordinates subset

You can extract a selection of coordinates, here we will use the 1hsg.pdb PDB file and extract the coordinates of L-735,524 an inhibitor of the HIV proteases (resname MK1):

# Select res_name MK1
lig_coor = coor_1hsg.select_atoms("resname MK1")

The obtain selection can be saved using the write_pdb() function:

# Save the ligand coordinates
lig_coor.write_pdb('1hsg_lig.pdb')

For selection you can use the following keywords :

  • name for atom name

  • altloc for alternative location

  • resname for residue name

  • chain for chain ID

  • resid residue number

  • residue a unique residue number starting from 0

  • x, y, z, coordinates

  • occ for occupation

  • beta for beta factor

Selector can be combined, eg. to select residue names Proline and Alanine from chain A you can use:

PRO_ALA_A_coor = coor_1hsg.select_atoms("resname PRO ALA and chain A")

The following combinator and, or, not and within of can be used. Here we are selecting atoms of chain A and within 5.0 Å of chain B.

interface_coor = coor_1hsg.select_atoms("chain A and within 5.0 of chain B")

Moreover different operators can be used as “==”, “!=”, “>”, “>=”, “<”, “<=”:

Nter_coor = coor_1hsg.select_atoms("chain A and resid <= 10")

note: To select protein atoms you can use the noh, protein and backbone keywords.

prot_coor = coor_1hsg("protein and chain A")