Hi Hrutvik,

The print function doesn’t actually execute the PyMOL commands the “cmd” module 
does

Change the prints to:
cmd.load(“1u8q.pdb”)
cmd.color(“red”,”chain y”)

For specific instruction on how to use the cmd based functions, visit the PyMOL 
wiki

Two other things:

  1.  the color function does not need to need to be extended as it is already 
built into PyMOL
  2.  PyMOL already has a load function which may be overwritten using your new 
load function, call it something else just to be safe

Cheers,

Ali

Ali Kusay | BPharm (Hons) | PhD Candidate & Pharmacist
The University of Sydney School of Pharmacy | Faculty of Medicine and Health
424, Brain and Mind Centre | The University of Sydney | NSW 2050
Email: akus8...@uni.sydney.edu.au

From: Ali Kusay <akus8...@uni.sydney.edu.au>
Date: Thursday, 2 July 2020 at 8:55 pm
To: Ali Kusay <ali.ku...@sydney.edu.au>
Subject: FW: [PyMOL] Question about python commands in PyMOL


________________________________
From: Hrutvik Bhavsar
Sent: Thursday, 2 July 2020 9:26:23 AM (UTC+10:00) Canberra, Melbourne, Sydney
To: pymol-users@lists.sourceforge.net
Subject: [PyMOL] Question about python commands in PyMOL
Hello,

I'm writing a python script that loads in PDBs then selects certain chains 
colors them according to a standardized chart. However, I've run into the issue 
where my when I try running my script in Pymol via the run command it just 
displays the text on the python script but doesn't actually execute the 
command. I've pasted a sample script below. Please let me if there's a way to 
fix this. Thank you for your help.
Sincerely, Hrutvik.


from pymol import cmd, stored

def load( arg1):

    print ("load 1u8q.pdb")
    print ("color red, (chain y)" + "\n")

    return (arg1)

cmd.extend( "load", load );
cmd.extend( "color", color );


_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to