<html>
  <head>
    <meta content="text/html; charset=UTF-8" 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>
    <blockquote
cite="mid:CAMJBqiy7bPSUD6=dkt_3=TDwQof-E_aEfRyB9Pxv2cP50z9Dow@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">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>
            <div class="h5">
              <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><font color="#888888"><br>
                        <br>
                           Tom</font></span>
                    <div>
                      <div><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>
          </div>
        </div>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Chimera-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Chimera-dev@cgl.ucsf.edu">Chimera-dev@cgl.ucsf.edu</a>
<a class="moz-txt-link-freetext" href="http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev">http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev</a>
</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>