<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="State"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="place" downloadurl="http://www.5iantlavalamp.com/"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;}
p
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman";}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>
<div class=Section1>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi Eric,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Thanks for the detailed answer. I think the .cmd script will be
sufficient for my purpose, however I was unable to write it correctly. What
I want to do is slightly more complex than I outlined – I need to: open a
mol2 structure, select certain residues (say select: 69-70), save the selected
residues as a mol2 file, and select different residues and save them several
more times. The .cmd looks something like that: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>alias ^process open $1.mol2; sel : 69-70; write selected 0 $1.his_CEGI.mol2;
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>process p2<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>However, I was unable to create a proper mol2 file (I tried different
options but my guess is that I have a syntax error). In some cases I was
able to write out a file, but it was never a proper mol2 file. Alternatively,
I tried: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>alias ^process open $1.mol2; sel : 69-70; select invert; <st1:State
w:st="on"><st1:place w:st="on">del</st1:place></st1:State> sel; write 0 $1.his_CEGI.mol2;
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>process p2<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>which generated
p2.his_CEGI.mol2, but the file could not be viewed with Chimera, and when inspected
it looked different (no charge column and extra 3 columns: 1.00, 0.00, <i><span
style='font-style:italic'>atom name</span></i>). The whole script should
be able to save mol2 files of several subsequences of several different structures.
I would appreciate if you could help me identify what missing in the
script. <o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>On a related note, the
name of my structures have an underline in them (_), I noticed that Chimera
puts a space instead. How do I make Chimera read, for example, p2_3.mol2
as it is (and not as p2 3.mol2)?<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Thanks a lot for you
help,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>ben<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='text-autospace:none'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Eric Pettersen
[mailto:pett@cgl.ucsf.edu] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, February 06, 2008
5:34 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Ben Keshet<br>
<b><span style='font-weight:bold'>Cc:</span></b> Chimera-users@cgl.ucsf.edu<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Chimera-users] using
IDLE</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi Ben,<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span>IDLE
is basically for interactive debugging or discovery of information in the
Python layer (the latter via the help() function). For what you want to do you
either want to write a Chimera-command script (.cmd suffix) or a Python script
(.py suffix). Either kind can be run by opening the script with File...Open or
the "open" command or by supplying the filename as an argument on the
Chimera startup command line (the latter typically used more in Linux or IRIX
environments).<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span>If
what you want to do is no more complicated than what you outlined, you can get
away with using a Chimera-command script. In particular you can use the
"alias" command to construct a compound command that takes arguments.
For example:<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span>alias
^process open $1.pdb; sel :HIS; <st1:State w:st="on"><st1:place w:st="on">del</st1:place></st1:State>
sel; write 0 $1.mod.pdb; close 0<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>creates an alias named "process" that if you execute it as
"process 1gcn" will open the file 1gcn.pdb, select the histidines,
delete the selected atoms, write the result to a file named 1gcn.mod.pdb, and
then close the opened model. Aliases are saved in sessions and can be made
available at startup. See the documention for the alias command for details on
that.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span>So
you might make a command file like this:<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>alias ^process open $1.pdb; sel :HIS; <st1:State w:st="on"><st1:place
w:st="on">del</st1:place></st1:State> sel; write 0 $1.mod.pdb; close 0<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>process 1gcn<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>process 3fx2<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>process 1www<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>...<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span>You
would have to use Python if you needed to loop through a range of values in your
script, or only execute certain commands if some condition was true, or do
something for which there is no equivalent Chimera command. We having some
basic information for getting started in the Chimera Programmer's Guide: <a
href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html</a><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>The programmer documentation isn't nearly as extensive as the user
documentation, so feel to ask questions -- either here or on the chimera-dev
mailing list.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>--Eric<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><span class=apple-tab-span><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div><span style='border-spacing: 0px 0px;text-align:auto;-khtml-text-decorations-in-effect: none;
-apple-text-size-adjust: auto;orphans: 2;widows: 2;word-spacing:0px'>
<p style='margin:0in;margin-bottom:.0001pt'><font size=3 color=black
face=Helvetica><span style='font-size:12.0pt;font-family:Helvetica;color:black'>Eric
Pettersen<o:p></o:p></span></font></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=3 color=black
face=Helvetica><span style='font-size:12.0pt;font-family:Helvetica;color:black'>UCSF
Computer Graphics Lab<o:p></o:p></span></font></p>
<p style='margin:0in;margin-bottom:.0001pt'><font size=3 color=black
face=Helvetica><span style='font-size:12.0pt;font-family:Helvetica;color:black'><a
href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 color=black face=Helvetica><span
style='font-size:12.0pt;font-family:Helvetica;color:black'><br>
<br>
</span></font><o:p></o:p></p>
</div>
</span>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Feb 6, 2008, at 12:41 PM, Ben Keshet wrote:<o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Hi,<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><u1:p></u1:p>I
am interested in performing the same actions several times on several different
structures. For example: open a file, select the histidines, delete them, save
and close. Is IDLE the right tool for that? I opened the python shell
(Tools-> General Controls-> IDLE) but could not open files or manipulate
them using the shell. I have no knowledge in python. What is the best way to
write scripts to execute commands repeatedly? If IDLE is the tool, how can use
it to do that? Is there a written source for that? Do I need to master python
first?<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><u1:p></u1:p>Many
thanks,<u1:p></u1:p></span></font><o:p></o:p></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Ben<u1:p></u1:p></span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>_______________________________________________<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Chimera-users mailing list<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a><o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><a href="http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users">http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><o:p></o:p></span></font></p>
</div>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</div>
</body>
</html>