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.
from modeller import * def cluster_pdbs(e, pdbs, cluster_cut): """Get a representative of a set of PDBs. Every PDB file must be a structure of the same sequence. The representative model is returned.""" a = Alignment(e) # Read all structures, and make a 1:1 alignment of their sequences for filename in pdbs: m = Model(e, file=filename) a.append_model(m, align_codes=filename, atom_files=filename) # Structurally superimpose all structures without changing the alignment a.malign3d(gap_penalties_3d=(0, 3), fit=False) # Add a new dummy model with the same sequence to hold the cluster m = Model(e, file=pdbs) a.append_model(m, align_codes='cluster', atom_files='cluster') # Make the clustered representative m.transfer_xyz(a, cluster_cut=cluster_cut) return m # Filenames to cluster pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb") e = Environ() m = cluster_pdbs(e, pdbs, 1.5) m.write(file='cluster.pdb')