<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Mateusz,<br>
<br>
Ok, your Python can be changed in a simple way, for example<br>
<br>
from chimera import openModels<br>
for m in openModels.list():<br>
id = m.oslIdent()<br>
command="write "+id+" "+o_path+"/"+id[1:]+".pdb"<br>
runCommand(command)<br>
<br>
The m.oslIdent() gives the string "#0.1" or for models with no
sub-id "#0". The id[1:] gives "0.1" so you don't get the "#" in the
file name. The cryptic "oslIdent" stands for object selection
language identifier.<br>
<br>
Tom<br>
<br>
<br>
Mateusz Dobrychłop wrote:
<blockquote
cite="mid:CAMJBqix5oWZ-Hwm_h-naKHeeFEHrH_niSCp0yd=EjDJoLA-0ng@mail.gmail.com"
type="cite">Hi Tom,
<div><br>
</div>
<div>Thank you very much for your response.
<div><br>
</div>
<div>My exact problem is that I'm trying to find a way to
automatically save all the models (and submodels) that are
opened in Chimera at a time. It's easy when models are
numbered #0, #1, #2 etc - then, I use:</div>
<div><br>
</div>
<div><font face="'courier new', monospace">opened=openModels.list()</font></div>
<div><font face="'courier new', monospace">howmany=len(opened)</font></div>
<div><font face="'courier new', monospace">while howmany>=0:</font></div>
<div><font face="'courier new', monospace"> command="write
"+str(howmany)+" "+o_path+"/"+str(howmany)+".pdb"</font></div>
<div><font face="'courier new', monospace">
runCommand(command)</font></div>
<div><font face="'courier new', monospace"> howmany-=1</font></div>
<div><br>
</div>
<div>Unfortunately, when I split, let's say, #0 that contains 3
chains, and then use the above code, I get an error:</div>
<div>
<br>
</div>
<div><font face="'courier new', monospace">MidasError: 3 model
ids match "0"</font></div>
<div><font face="'courier new', monospace"><br>
</font></div>
<div><font face="arial, helvetica, sans-serif">So maybe there's
a different way to do it? I'd like to save #0.1, #0.2 and
#0.3 to seperate files. I know it's possible from Chimera's
interface, but I have no idea how to do it when my script
doesn't have any info about the number of submodels etc.</font></div>
<div><font face="arial, helvetica, sans-serif"><br>
</font></div>
<div><font face="arial, helvetica, sans-serif">Thank you for
your time once again,</font></div>
<div><font face="arial, helvetica, sans-serif">Mateusz</font></div>
<div><br>
<div class="gmail_quote">2012/5/9 Tom Goddard <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:goddard@sonic.net"
target="_blank">goddard@sonic.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Mateusz,<br>
<br>
The "split #0" command produces separate models for each
chain. They are numbered #0.1, #0.2, #0.3, ... with the
same primary id number (0) and different secondary id
numbers. You can use these two-part id numbers in any
Chimera command (e.g. color blue #0.2), or you can refer
to all the models using #0. There is currently not a way
to change the id numbers of models.<span class="HOEnZb"><font
color="#888888"><br>
<br>
Tom</font></span>
<div class="HOEnZb">
<div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
Is there a command / a way to split a model into
seperate models (one for each chain)? I know there
is the "split" command, but it divides the model
into submodels.<br>
<br>
Mateusz<br>
<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>