Cluster PDBs: Difference between revisions
(page was renamed from Cluster_PDBs) |
(Update for 10.0 class names) |
||
Line 11: | Line 11: | ||
Every PDB file must be a structure of the same sequence. | Every PDB file must be a structure of the same sequence. | ||
The representative model is returned.""" | The representative model is returned.""" | ||
a = | a = Alignment(e) | ||
# Read all structures, and make a 1:1 alignment of their sequences | # Read all structures, and make a 1:1 alignment of their sequences | ||
for filename in pdbs: | for filename in pdbs: | ||
m = | m = Model(e, file=filename) | ||
a.append_model(m, align_codes=filename, atom_files=filename) | a.append_model(m, align_codes=filename, atom_files=filename) | ||
Line 22: | Line 22: | ||
# Add a new dummy model with the same sequence to hold the cluster | # Add a new dummy model with the same sequence to hold the cluster | ||
m = | m = Model(e, file=pdbs[0]) | ||
a.append_model(m, align_codes='cluster', atom_files='cluster') | a.append_model(m, align_codes='cluster', atom_files='cluster') | ||
Line 33: | Line 33: | ||
pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb") | pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb") | ||
e = | e = Environ() | ||
m = cluster_pdbs(e, pdbs, 1.5) | m = cluster_pdbs(e, pdbs, 1.5) | ||
m.write(file='cluster.pdb') | m.write(file='cluster.pdb') |
Revision as of 20:45, 10 February 2021
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.
#!python 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[0]) 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')