command line to save multiple models
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here: https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
Hi Elaine, After flipping, if I could save say "file1, file2, file3" as "file1_flip, file2_flip, file3_flip" there should not be any issue of overwriting the original files. I could save mrc files individually after flipping but for saving many maps a command line would be helpful.
Best Rayees ________________________________ From: Elaine Meng meng@cgl.ucsf.edu Sent: Tuesday, December 12, 2023 4:23 PM To: Rayees Mattoo rmattoo@stanford.edu Cc: ChimeraX Users Help chimerax-users@cgl.ucsf.edu Subject: Re: [chimerax-users] command line to save multiple models
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here: https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
Hi Rayees,
With the "foreach" approach, you would not be using the commands multiple times individually. The cxc file would just have a single "volume flip" command and single "save" command, and then the "foreach" mechanism would take care of executing it on each input file and using an output file name based on the input file name, as explained in the description of that option.
Elaine
On Dec 12, 2023, at 4:36 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi Elaine, After flipping, if I could save say "file1, file2, file3" as "file1_flip, file2_flip, file3_flip" there should not be any issue of overwriting the original files. I could save mrc files individually after flipping but for saving many maps a command line would be helpful.
Best Rayees From: Elaine Meng meng@cgl.ucsf.edu Sent: Tuesday, December 12, 2023 4:23 PM To: Rayees Mattoo rmattoo@stanford.edu Cc: ChimeraX Users Help chimerax-users@cgl.ucsf.edu Subject: Re: [chimerax-users] command line to save multiple models
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here: https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine
Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
Hi Rayees,
Elaine suggested the way to process many files and write a new file for each by using the "foreach" option of the open command. The only other way to write out several map files in one command is
save myflippedmap_%d.mrc models #1-20
which will save myflippedmap_1.mrc, myflippedmap_2.mrc, myflippedmap_3.mrc, ....
In general if you want to do processing of many files you either use Python code with ChimeraX or these few limited capabilities like "foreach" or this "%d" filename. The ChimeraX command language is not a general purpose language with looping statements and variables.
Tom
On Dec 12, 2023, at 4:44 PM, Elaine Meng via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi Rayees,
With the "foreach" approach, you would not be using the commands multiple times individually. The cxc file would just have a single "volume flip" command and single "save" command, and then the "foreach" mechanism would take care of executing it on each input file and using an output file name based on the input file name, as explained in the description of that option.
Elaine
On Dec 12, 2023, at 4:36 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi Elaine, After flipping, if I could save say "file1, file2, file3" as "file1_flip, file2_flip, file3_flip" there should not be any issue of overwriting the original files. I could save mrc files individually after flipping but for saving many maps a command line would be helpful.
Best Rayees From: Elaine Meng meng@cgl.ucsf.edu Sent: Tuesday, December 12, 2023 4:23 PM To: Rayees Mattoo rmattoo@stanford.edu Cc: ChimeraX Users Help chimerax-users@cgl.ucsf.edu Subject: Re: [chimerax-users] command line to save multiple models
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here: https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine
Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
Hi Elaine,
this would very very useful. To make sure I get it right, would a script like this work:
#flip-maps.cxc open foreach /My-Path/*.mrc volume flip save /My-Path/*-flipped.mrc
thanks. Vincent
Le 13/12/2023 à 01:23, Elaine Meng via ChimeraX-users a écrit :
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here: https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine
Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-userschimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
ChimeraX-users mailing list --chimerax-users@cgl.ucsf.edu To unsubscribe send an email tochimerax-users-leave@cgl.ucsf.edu Archives:https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
Hi Vincent, The "foreach" option is not inside the cxc file. First you make the cxc file. Then you use the "open" command (with the "foreach" option to specify the input data files) to open the cxc file. See the help, which actually has an example:
https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
Here is another example. The cxc file (let's call it blah.cxc) could contain
volume flip save $file-flipped.mrc
Then you would use command
open blah.cxc foreach /My-Path/*.mrc
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 13, 2023, at 1:21 AM, vincent Chaptal vincent.chaptal@ibcp.fr wrote:
Hi Elaine,
this would very very useful. To make sure I get it right, would a script like this work:
#flip-maps.cxc open foreach /My-Path/*.mrc volume flip save /My-Path/*-flipped.mrc
thanks. Vincent
Le 13/12/2023 à 01:23, Elaine Meng via ChimeraX-users a écrit :
Hi Rayaees, You could have used a ChimeraX command script (.cxc) and opened that .cxc file with the "foreach" option of "open" to open each input map file individually, then flip with "volume flip", then save the result with "save", then do the next one, etc.
See the option explained here:
https://rbvi.ucsf.edu/chimerax/docs/user/commands/open.html#forEachFile
However, since you already have all of them open and flipped, I can't think of any simple way to do it.
Maybe you could start over and try the foreach way instead? But it's up to you...
Also to be safe I would strongly recommend against saving them all to the same name as the input file, in case something goes wrong. You don't want to lose all your original data by overwriting it with a mistake (e.g. blank files).
Best, Elaine
Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Dec 12, 2023, at 3:39 PM, Rayees Mattoo via ChimeraX-users chimerax-users@cgl.ucsf.edu wrote:
Hi, I volume flipped 20 different models (#1 to #20) and now I want to save all the 20 flipped maps as .mrc with the same name as before and add flip in their names. How could I modify the save command line to do that?
Best
participants (4)
-
Elaine Meng
-
Rayees Mattoo
-
Tom Goddard
-
vincent Chaptal