Modeller logo

The script below demonstrates how to use the cluster_cut argument to transfer_xyz to make a clustered representative of a set of PDB files of the same sequence.

   1 from modeller import *
   2 
   3 def cluster_pdbs(e, pdbs, cluster_cut):
   4     """Get a representative of a set of PDBs.
   5        Every PDB file must be a structure of the same sequence.
   6        The representative model is returned."""
   7     a = alignment(e)
   8 
   9     # Read all structures, and make a 1:1 alignment of their sequences
  10     for filename in pdbs:
  11         m = model(e, file=filename)
  12         a.append_model(m, align_codes=filename, atom_files=filename)
  13 
  14     # Structurally superimpose all structures without changing the alignment
  15     a.malign3d(gap_penalties_3d=(0, 3), fit=False)
  16 
  17     # Add a new dummy model with the same sequence to hold the cluster
  18     m = model(e, file=pdbs[0])
  19     a.append_model(m, align_codes='cluster', atom_files='cluster')
  20 
  21     # Make the clustered representative
  22     m.transfer_xyz(a, cluster_cut=cluster_cut)
  23     return m
  24 
  25 
  26 # Filenames to cluster
  27 pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb")
  28 
  29 e = environ()
  30 m = cluster_pdbs(e, pdbs, 1.5)
  31 m.write(file='cluster.pdb')