Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help
Special pages
SBGrid Resources
SBGrid Consortium
SBGrid Data Bank
Software Webinars
PyMOL Webinar
PyMOL Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
BiologicalUnit
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<div style="background-color: #9f9; padding: 10px; margin-bottom: 20px; text-align: center"> '''Note:''' PyMOL 1.8 can load biological units from mmCIF files with the '''[[assembly]]''' setting. </div> This script can be used to re-create biological units for proteins. (This was created as a workaround of PyMOL's semi-functioning [[Symexp]] command.) It's also a fun script to play with for learning about symmetry. <gallery widths=250px heights=250px> Image:before.png|single unit, before running this program Image:after.png|after the expansion of the 60 units Image:1rmv fiber.png|Example creating the biological unit for PDB 1RMV created from fiber diffraction. </gallery> = Usage = <source lang="python"> load /path/to/some/pdbFile.pdb symMat = readSymmetry("/path/to/some/pdbFile.pdb","pdbFile") biologicalUnit("mates", "pdbFile", symMat) </source> = The Code = <source lang="python"> # # Jason Vertrees <Jason-dot-Vertrees-at-schrodinger_dot_com>, 2010. # import pymol from pymol import cmd def readSymmetry(inFile, verbose=None): """ This function will read "inFile" and glean the symmetry operations, if any, from it. PARAMS inFile (string) path to PDB file verbose (boolean) if verbose is not None, print more RETURNS matrix Array of lists. One 16-element list per symmetry operation. Feed this matrix into manualSymExp in order to make the other symmetry mates in the biological unit """ # a remark-350 lines has: # REMARK 350 BIOMTn TAGn X Y Z Tx REM, TAG, BIOMT, OPNO, X, Y, Z, TX = range(8) thePDB = open(inFile, 'rb').readlines() matrices = [] curTrans = -1 # The transformation is, # output = U*input + Tx for l in thePDB: tokens = l.split() if len(tokens)!=8: continue if tokens[REM]=="REMARK" and tokens[TAG]=="350" and tokens[BIOMT].startswith("BIOMT"): if tokens[OPNO]!=curTrans: # new transformation matrix matrices.append([]) matrices[-1].append( map( lambda s: float(s), tokens[X:])) curTrans = tokens[OPNO] if verbose!=None: print "Found %s symmetry operators in %s." % (len(matrices), inFile) return matrices def biologicalUnit(prefix, objSel, matrices ): """ Manually expands the object in "objSel" by the symmetry operations provided in "matrices" and prefixes the new objects with "prefix". PARAMS prefix (string) prefix name for new objects objSel (string) name of object to expand matrices (list of 16-element lists) array of matrices from readSymmetry RETUNRS None SIDE EFFECTS Creates N new obects each rotated and translated according to the symmetry operators, where N equals len(matrices). """ for m in matrices: n = cmd.get_unused_name(prefix) cmd.create(n, objSel) s1 = "%s + (x*%s + y*%s + z*%s)" % (m[0][3], m[0][0], m[0][1], m[0][2]) s2 = "%s + (x*%s + y*%s + z*%s)" % (m[1][3], m[1][0], m[1][1], m[1][2]) s3 = "%s + (x*%s + y*%s + z*%s)" % (m[2][3], m[2][0], m[2][1], m[2][2]) cmd.alter_state(1, n, "(x,y,z) = (%s, %s, %s)" % (s1, s2, s3) ) </source> = Notes = This is slow compared to [[Symexp]]; use the above for learning, playing and when [[Symexp]] doesn't work as advertised. = See Also = *[[BiologicalUnit/Quat]] (alternative implementation) *[[Symexp]] *[[SuperSym]] *[http://www.rcsb.org/pdb/static.do?p=education_discussion/Looking-at-Structures/bioassembly_tutorial.html PDB Tutorial Biol. Units] *[http://en.wikipedia.org/wiki/Fiber_diffraction Wikipedia article] *[[assembly]] [[Category:Script_Library]] [[Category:Math_Scripts]] [[Category:Structural_Biology_Scripts]]
Summary:
Please note that all contributions to PyMOL Wiki are considered to be released under the GNU Free Documentation License 1.2 (see
PyMOL Wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
BiologicalUnit
Add topic