pymol for superimpose by python script
1
1
Entering edit mode
22 months ago
iamsmor • 0

Hello everyone

I have two pdb id for two proteins and I would like to superimpose them. I tried to write a python script that it will work on server but I could not write the right script. It gives error

import __main__
 __main__.pymol_argv = [ 'pymol', '-qc'] 
import sys, time, os
import pymol
cmd.feedback("disable", "all", "everything")
pymol.finish_launching()
pymol.cmd.load(6UFO)
pymol.cmd.load(4XMB)
pymol.cmd.super((6UFO), (4XMB))
cmd.zoom()
cmd.png(image_name, 640, 640, dpi=300, ray=1)
print("<img src=/"", image_name, "/">")`

and it does not work. How can I handle it?

png python pymol superimposition • 1.2k views
ADD COMMENT
1
Entering edit mode
22 months ago
Wayne ★ 1.9k

The short explanation is you need to really be careful with syntax and build off examples in the documentation and found on the web.
For example, already your load command doesn't follow syntax. From the documentation on the load command:

User Comments/Examples

  • Load xyz.pdb using the PyMOL API:
cmd.load("xyz.pdb")

So you'll note that your current version, pymol.cmd.load(6UFO), doesn't match having quotes, case, extension, etc..
(pymol.cmd part is okay. You'll see the documentation and my examples use a variation that makes for less typing by assigning pymol.cmd to cmd. I'll try to use the way you are doing it in my example below so that you get a sense of the variations and how to adapt.)

Full explanation by way of example:

I put together an example using your code at the bottom of a notebook that demonstrates the use of PyMOL's super command first using the supplied demonstration in the documentation and combines it with making a figure. This is a later entry in a series of demonstrations. To best understand some of the basics used in the demonstration, you should work through the first available notebook listed in the series. While it doesn't involve a superposition, it does involve getting structures using PyMOL loading them into PyMOL, and generating images, all on a remote server. And so it gives a good place to build from to understand what is going on in the superposition demonstration.

To get started go here and press launch binder. When the session spins up in your browser, work through the first notebook listed under available notebooks. Then check out the one listed as 'Demo of Superimposing Two Structures via PyMOL Super Command'.
(Here is the direct link to the static version of that specific Jupyter notebook for when you simply need to review it for quick reference.)

ADD COMMENT
0
Entering edit mode

Thank you so much, you really wonderful person, spend your time for long detailed explaination.

ADD REPLY

Login before adding your answer.

Traffic: 2846 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6