Saving sessions including maps?

Hi all, 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? 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. 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. 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? Cheers, Oli.

Hi Oliver, This has long been a requested feature. http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426> 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. Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thanks for the quick reply Tom, got it. Looking forward to Chimera 2! One temporary work around I have thought about is the following alias: #Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1 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. Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Ok, so if I run the following python script at chimera startup (to add a mkdir command): def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False) And then add the following alias: #Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1 This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file. 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. Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

Hi Oliver, Yeah, as you observed, only Chimera command files can be specified for reading at startup in the Command Line section of Preferences. Here’s one idea using the Presets section of the Preferences instead. I haven’t actually tried it but I think it should work. Custom preset definitions are read at startup and they can be defined in either Chimera command or Python files, see: <http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/preferences.html#Presets> You could just think of your Python-defined preset as an alias (or macro or function definition). The name of the preset comes from the name of the file. You can execute it with the preset command, which could occur in a Chimera command file. I don’t know if it could be in a startup command file… I guess it depends on whether the custom presets are read before the startup command file or not. I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
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.
Cheers, Oliver.

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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html> 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 parent 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!) 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. —Eric Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

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). In that case the following alias works well to create a packaged session with all maps saved: #Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. 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 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? Cheers, Oli.
On Sep 16, 2015, at 3:51 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html>
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 parent 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!)
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.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Okay, the next daily build will allow the underscore-to-space conversion to be escaped by preceding the underscore with a backslash. —Eric
On Sep 16, 2015, at 12:59 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
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).
In that case the following alias works well to create a packaged session with all maps saved:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. 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
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?
Cheers, Oli.
On Sep 16, 2015, at 3:51 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html>
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 parent 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!)
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.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

Great, thanks Eric! Oliver. On Wed, Sep 16, 2015 at 4:14 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Okay, the next daily build will allow the underscore-to-space conversion to be escaped by preceding the underscore with a backslash.
—Eric
On Sep 16, 2015, at 12:59 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
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).
In that case the following alias works well to create a packaged session with all maps saved:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. 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
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?
Cheers, Oli.
On Sep 16, 2015, at 3:51 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html
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 *parent* 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!)
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.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426
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.
Tom
On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote:
Hi all,
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?
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.
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.
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?
Cheers, Oli.
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Thanks Eric, this works great! Also I tweaked the alias I was using to create packaged sessions so that it automatically creates a tar archive of the packaged session, for easy sharing with collaborators. This alias and a bunch of others I find handy can be downloaded here: https://www.dropbox.com/s/75e5c7f1vamtiiy/chimera_aliases_general.com?dl=0 <https://www.dropbox.com/s/75e5c7f1vamtiiy/chimera_aliases_general.com?dl=0> Cheers, Oliver.
On Sep 16, 2015, at 4:14 PM, Eric Pettersen <pett@cgl.ucsf.edu> wrote:
Okay, the next daily build will allow the underscore-to-space conversion to be escaped by preceding the underscore with a backslash.
—Eric
On Sep 16, 2015, at 12:59 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
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).
In that case the following alias works well to create a packaged session with all maps saved:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. 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
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?
Cheers, Oli.
On Sep 16, 2015, at 3:51 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html>
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 parent 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!)
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.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver.
On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote:
Hi Oliver,
This has long been a requested feature.
http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426>
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.
Tom
> On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote: > > Hi all, > > 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? > > 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. > > 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. > > 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? > > Cheers, > Oli. > > > > _______________________________________________ > Chimera-users mailing list > Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> > http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users> >
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

Hi Oliver, thanks for making those available. I bet some people will find them very useful. —Eric
On Sep 17, 2015, at 8:17 AM, Oliver Clarke <olibclarke@gmail.com> wrote:
Thanks Eric, this works great!
Also I tweaked the alias I was using to create packaged sessions so that it automatically creates a tar archive of the packaged session, for easy sharing with collaborators.
This alias and a bunch of others I find handy can be downloaded here:
https://www.dropbox.com/s/75e5c7f1vamtiiy/chimera_aliases_general.com?dl=0 <https://www.dropbox.com/s/75e5c7f1vamtiiy/chimera_aliases_general.com?dl=0>
Cheers,
Oliver.
On Sep 16, 2015, at 4:14 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
Okay, the next daily build will allow the underscore-to-space conversion to be escaped by preceding the underscore with a backslash.
—Eric
On Sep 16, 2015, at 12:59 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
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).
In that case the following alias works well to create a packaged session with all maps saved:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. 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
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?
Cheers, Oli.
On Sep 16, 2015, at 3:51 PM, Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> wrote:
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: http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html>
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 parent 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!)
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.
—Eric
Eric Pettersen UCSF Computer Graphics Lab
On Sep 11, 2015, at 2:11 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Ok, so if I run the following python script at chimera startup (to add a mkdir command):
def mkdir(mkdir,dir1): import os import time if not os.path.exists(dir1): os.mkdir(dir1) from Midas.midas_text import addCommand addCommand("mkdir", mkdir, help=False)
And then add the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir cd ~; mkdir $1; volume # save ~/$1/$1%d.mrc; save ~/$1/$1
This seems to work okay. It will create a sub dir in the user’s home directory with maps and a chimera session file.
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.
Cheers, Oliver.
On Sep 11, 2015, at 9:04 PM, Oliver Clarke <olibclarke@gmail.com <mailto:olibclarke@gmail.com>> wrote:
Thanks for the quick reply Tom, got it. Looking forward to Chimera 2!
One temporary work around I have thought about is the following alias:
#Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1
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.
Cheers, Oliver. > On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net <mailto:goddard@sonic.net>> wrote: > > Hi Oliver, > > This has long been a requested feature. > > http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 <http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426> > > 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. > > Tom > > >> On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote: >> >> Hi all, >> >> 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? >> >> 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. >> >> 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. >> >> 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? >> >> Cheers, >> Oli. >> >> >> >> _______________________________________________ >> Chimera-users mailing list >> Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> >> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users> >> >
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>

The viz package Amira has something similar called 'pack and go'. And the video editing software Final Cut Pro has 'media manager', which provides more control. It would be a useful option to bundle the whole working directory, including pdfs, spreadsheets, manuscript drafts. I also recommend in the design something that can include archival concepts, as opposed to only a comprehensive & reliable session transfer from person A to person B. When managing multiple session files over a period of years, it would be useful to get summaries of the blob of data; list of sizes, types, dates, etc., that can be examined without loading everything (which can take a long time if the files are big) just to get a status. Having an archival snapshot button that generates jpegs that could be included would help sorting through large numbers of sessions, particularly if the person sorting them is not the person who created them. For example, Tom you helped me out on some python code that would do a backbone trace 6-15 years ago; if someone asked me to create another animation like that, it would be a fishing expedition in a terabyte sea. Matthew Dougherty National Center for Macromolecular Imaging Baylor College of Medicine ================================================= ================================================= ________________________________ From: chimera-users-bounces@cgl.ucsf.edu <chimera-users-bounces@cgl.ucsf.edu> on behalf of Oliver Clarke <olibclarke@gmail.com> Sent: Friday, September 11, 2015 3:04 PM To: Tom Goddard Cc: chimera-users@cgl.ucsf.edu BB Subject: Re: [Chimera-users] Saving sessions including maps? Thanks for the quick reply Tom, got it. Looking forward to Chimera 2! One temporary work around I have thought about is the following alias: #Save session with maps. saves in home dir with directory name same as session. # Usage: save_session_dir session-name # Don't use spaces or under_scores in session names. alias ^save_session_dir volume # save ~/$1/map%d.mrc; save ~/$1/$1 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. Cheers, Oliver. On Sep 11, 2015, at 6:54 PM, Tom Goddard <goddard@sonic.net<mailto:goddard@sonic.net>> wrote: Hi Oliver, This has long been a requested feature. http://plato.cgl.ucsf.edu/trac/chimera/ticket/12426 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. Tom On Sep 11, 2015, at 2:05 AM, Oliver Clarke wrote: Hi all, 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? 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. 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. 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? Cheers, Oli. _______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu<mailto:Chimera-users@cgl.ucsf.edu> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (5)
-
Dougherty, Matthew T
-
Elaine Meng
-
Eric Pettersen
-
Oliver Clarke
-
Tom Goddard