<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Awesome, thanks Eric! I was looking for a chimera command to execute shell commands but somehow didn’t find it (even though it is certainly documented in the command index).<div class=""><br class=""></div><div class="">In that case the following alias works well to create a packaged session with all maps saved:</div><div class=""><br class=""></div><div class=""><div class="">#Save session with maps. saves in home dir with directory name same as session.</div><div class=""># Usage: save_session_dir session-name</div><div class=""># Don't use spaces or under_scores in session names.</div><div class="">alias ^save_session_dir cd ~; system mkdir chimera_session_dirs; cd chimera_session_dirs; system mkdir $1; volume # save ~/chimera_session_dirs/$1/$1%d.mrc; save ~/chimera_session_dirs/$1/$1</div><div class=""><br class=""></div><div class="">The only remaining issue is that Chimera treats underscores in alias arguments as special characters, and converts them to spaces. I don’t suppose there is some way to avoid that behaviour? E.g. like using a \ to escape a special character in a shell script?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Oli.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 16, 2015, at 3:51 PM, Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu" class="">pett@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Sorry this reply is kind of tardy. Anyway, your little script has done 98% of the work needed to add that command at startup. Look at the “Adding Command-line Commands” example in the Chimera Programmer’s Guide: <a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html" class="">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html</a><div class=""><br class=""></div><div class="">Basically, you need call the script file “ChimeraExtension.py”, put it inside a folder (maybe named “Mkdir”) and then tell Chimera to look for it by going to Tools section of Preferences and adding the <i class="">parent</i> folder of Mkdir (i.e. the folder that contains Mkdir) to the “Locations” list that Chimera will look for tools in (and click the Save button!)</div><div class=""><br class=""></div><div class="">The above is good to know for adding tools in general. However in the specific case of your mkdir command, you can do it directly in Chimera without making an extension. The “system” command will execute its arguments as a shell command, so “system mkdir xyz” will create an xyz directory.</div><div class=""><br class=""></div><div class="">—Eric</div><div class=""><br class=""><div apple-content-edited="true" class="">
<div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>UCSF Computer Graphics Lab</div></div><br class="Apple-interchange-newline">
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 11, 2015, at 2:11 PM, Oliver Clarke <<a href="mailto:olibclarke@gmail.com" class="">olibclarke@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ok, so if I run the following python script at chimera startup (to add a mkdir command):<div class=""><br class=""></div><div class=""><div class="">def mkdir(mkdir,dir1):</div><div class=""> import os</div><div class=""> import time</div><div class=""> if not os.path.exists(dir1):</div><div class=""> os.mkdir(dir1)</div><div class="">from Midas.midas_text import addCommand</div><div class="">addCommand("mkdir", mkdir, help=False)</div></div><div class=""><br class=""></div><div class="">And then add the following alias:</div><div class=""><br class=""></div><div class=""><div class="">#Save session with maps. saves in home dir with directory name same as session.</div><div class=""># Usage: save_session_dir session-name</div><div class=""># Don't use spaces or under_scores in session names.</div><div class="">alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1</div></div><div class=""><br class=""></div><div class="">This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.</div><div class=""><br class=""></div><div class="">Incidentally, is there any easy way to add python code snippets to a Chimera command file (with aliases etc)? I guess the only ways are to either have it in a separate file and use open or runscript, or to make it one big python file and wrap all of the aliases in runcommand() calls. But then how does one tell Chimera to run a given python file at start up? When I add python files to the “Files to read at startup” section of preferences, Chimera seems to interpret them as Chimera command files, and hence gives an error.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Oliver.</div><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 11, 2015, at 9:04 PM, Oliver Clarke <<a href="mailto:olibclarke@gmail.com" class="">olibclarke@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!<div class=""><br class=""></div><div class="">One temporary work around I have thought about is the following alias:</div><div class=""><br class=""></div><div class=""><div class="">#Save session with maps. saves in home dir with directory name same as session.</div><div class=""># Usage: save_session_dir session-name</div><div class=""># Don't use spaces or under_scores in session names.</div><div class="">alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1</div><div class=""><br class=""></div><div class="">This will save all maps in a subdir of the home directory with the desired session name, and then save the session in the same dir - this folder is then portable and has all the info needed to restore the session. The only caveat to this is that this only works if the directory already exists - otherwise it gives an error. Maybe it would be possible to add an option to save/write to make the dir if it does not already exist? Otherwise I can do it in python I guess. Also, map names are not preserved, but I don’t see any easy way to get around that. Only other problem with this is that because of the way aliases work in chimera, any underscores in the alias arguments will be converted to spaces, but that is not an issue so long as one is aware of it.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Oliver.</div><div class=""><blockquote type="cite" class=""><div class="">On Sep 11, 2015, at 6:54 PM, Tom Goddard <<a href="mailto:goddard@sonic.net" class="">goddard@sonic.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Oliver,<div class=""><br class=""></div><div class=""> This has long been a requested feature.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426" class="">http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426</a></div><div class=""><br class=""></div><div class="">And I agree it would be useful. If Chimera packages up all the needed maps and the session file in a zip archive this would be convenient. You can of course do this right now by hand, only it isn’t so convenient. Unfortunately this has never reached a high enough priority relative to other enhancements we are working on, so it has not been implemented. It is more likely to get into Chimera 2 than Chimera 1.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Tom</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:</div><br class="Apple-interchange-newline"><div class="">Hi all,<br class=""><br class="">Is there any possibility of altering the chimera session format (or adding a separate option) such that all maps (including those created during the session) are also saved? <br class=""><br class="">This would greatly facilitate sharing data with collaborators, and would also allow one to provide chimera sessions with saved scenes as supplementary data when publishing.<br class=""><br class="">It would also make saving sessions more practical when many different volumes are created during the session - for example, when using a molmap low resolution representation for each domain.<br class=""><br class="">This would not necessarily require creating a new format - just creating a tarball or folder with all the maps and relative paths specified in the python file would work fine I think?<br class=""><br class="">Cheers,<br class="">Oli.<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">Chimera-users mailing list<br class=""><a href="mailto:Chimera-users@cgl.ucsf.edu" class="">Chimera-users@cgl.ucsf.edu</a><br class=""><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">Chimera-users mailing list<br class=""><a href="mailto:Chimera-users@cgl.ucsf.edu" class="">Chimera-users@cgl.ucsf.edu</a><br class=""><a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></body></html>