m (4 revisions imported)
(Tidy up markup)
Line 1: Line 1:
__NOTOC__
__NOTOC__
<!-- ## page was renamed from Cluster_PDBs -->
<!-- ## page was renamed from Cluster_PDBs -->
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.
The script below demonstrates how to use the <code>cluster_cut</code> argument to <code>transfer_xyz</code> to make a clustered representative of a set of PDB files of the same sequence.




<pre><nowiki>#!python
<syntaxhighlight lang="python">
from modeller import *
from modeller import *


Line 36: Line 36:
m = cluster_pdbs(e, pdbs, 1.5)
m = cluster_pdbs(e, pdbs, 1.5)
m.write(file='cluster.pdb')
m.write(file='cluster.pdb')
</nowiki></pre>
</syntaxhighlight>
 
 

Revision as of 20:32, 16 August 2022

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[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')