[Chimera-users] Scripting to write / save multiple models into single pdf file

Eric Pettersen pett at cgl.ucsf.edu
Mon Mar 15 15:38:19 PDT 2010


My previous reply was kind of misleading.  Windows does know about  
standard input/output, but only for "console" apps, not GUI apps.   
Chimera tries to be both.  So instead of bring up a console window,  
you can simply redirect standard output (which will have your RMSD  
info) into a file, like so:

E:\Chimera\bin>chimera --nogui myscript.py > E:\rmsds.txt

Don't use the saveReplyFunction in nogui mode since it will always  
produce an empty file (since there is no reply log).

--Eric

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         http://www.cgl.ucsf.edu

On Mar 14, 2010, at 11:12 PM, Sumitro Harjanto wrote:

> Hi Eric,
>
> I managed to figure out something by pirating some python codes I  
> found from chimera mailing list through googling. I want to use the  
> code to save my reply log, which is going to be about 3.4 million  
> lines (by the way, is there a maximum buffer for the number of lines  
> reply log can take? I feared overrunning the buffer and losing my  
> some part of the replylog)
>
> Below is the code; I commented away the part I do not use from the  
> original code.
>
> I tried the code by opening it using the chimera gui, and it worked  
> just fine, producing the log file I want. But when I tried opening  
> the same code using command line the log file was produced, but empty.
> I tried :
>
> E:\Chimera\bin>chimera --nogui save_replylog.py   <- -  doesnot show  
> anything, no popup command window, nothing.
> E:\Chimera\bin>chimera --nogui --debug save_replylog.py <- - shows a  
> new pop up window
>
> Both commands created my log file, but were both empty files.
>
> I would want to run the script later in nogui mode, but I need to  
> retrieve the log for rmsd values, therefore I need to overcome this  
> problem. Any advise..?
>
> Thanks!
>
> Cheers,
> Sumitro
>
>
> ********************************************************************************************************************
> from chimera import runCommand
> from chimera.tkgui import saveReplyLog
>
> #def rms2ref(ref, pose, no):
> #    runCommand('open %s; open %s' % (ref, pose))
> #    i = 1
> #    while i <= no:
> #       # only hetatms are included --> ~@/element=h
> #       runCommand('sel #1.%i & ~@/element=h' % i)
> #       runCommand('rmsd #0 sel')
> #       i += 1
> #
> #rms2ref('lig_cryst.pdb', 'poses.sdf', 10)
>
> runCommand('open noprefs E:\\D.combine\\receptor_models\ 
> \A-0101_1W72_A.pdb')
> runCommand('open noprefs E:\\A.Model_receptor\\PDB_MODELS\\1DUZ.pdb')
> runCommand('open noprefs E:\\D.combine\\chain_models\ 
> \A-0101_ITLVYKVYY_2CIK.pdb')
> runCommand('rmsd #0:@ca #1:2-182.A at ca')
> runCommand('match #0:@ca,n,c,o #1:2-182.A at ca,n,c,o')
> runCommand('match #2:1-3.C,7-9.C at ca #1:1-3.C,7-9.C at ca ')
> runCommand('match #2:1-3.C,7-9.C at ca,n,c,o #1:1-3.C,7-9.C at ca,n,c,o ')
> runCommand('combine #0|#2:1-9.C name A-0101_ITLVYKVYY_2CIK.C. 
> (1DUZ.C).A-0101_1W72_A modelId 5')
> runCommand('write format pdb 5 E:\\D.combine\\complex\ 
> \A-0101_ITLVYKVYY_2CIK.C.(1DUZ.C).A-0101_1W72_A.pdb')
> runCommand('close all')
>
> # generate output from replyLog.txt
>
> saveReplyLog('e:\\D.combine\\mylog.txt')
>
> #rmsds = []
> #for i in open('mylog2.txt').readlines():
> #    if i.startswith('RMSD between'):
> #       rmsds.append(i.split()[-2])
> #
> #print rmsds
> *********************************************************************************
>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20100315/a9634fe2/attachment.html>


More information about the Chimera-users mailing list