No edit summary
 
(Add to Examples category)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
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.
<!-- ## page was renamed from Cluster_PDBs -->
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 10: 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 = alignment(e)
     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 = model(e, file=filename)
         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 21: 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 = model(e, file=pdbs[0])
     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 32: Line 33:
pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb")
pdbs = ("1fdx.B99990001.pdb", "1fdx.B99990002.pdb", "1fdx.B99990003.pdb")


e = environ()
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')
</nowiki></pre>
</syntaxhighlight>
 


[[Category:Examples]]

Latest revision as of 21:17, 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')