<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Ryan,<div class=""><br class=""></div><div class=""> The "foreach" option you tried is exactly intended for this use. The error message "Missing filename suffix foreach" suggests you are using an old version of ChimeraX (older than ChimeraX 1.3) that does not have the "foreach" option so it thinks that "foreach" is the name of a file. Your script only saves one file so I don't understand what you mean by saving two files $file1 and $file2. You would just use "save $file-sf-aligned.pdb ..." to save the aligned file.</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><br class=""><blockquote type="cite" class=""><div class="">On May 4, 2022, at 10:41 PM, Ryan Woltz via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear community,<div class=""><br class=""></div><div class=""> I'm sorry if this is a repeated question, I've seen a few posts about taking in a file for the command line and doing some things then exiting. I got most of this down and I'm sure at this point it is just a matter or correcting a few lines of code. </div><div class=""><br class=""></div><div class=""> I'm trying to automate a protein modeling protocol and I have 1000 decoys at this point. Now I need to insert the 5 metals into 5 different pockets into all my decoys for a final relax before selecting my top model. I have a template pdb with all the metals in place. For 4 of these metals I have used rosetta align mover to align a decoy onto the template around a single metal binding site, save the pdb, then add on the metal coordinates then repeat for the next binding site. So this method works because the chain is continuous around these metal binding sites. However the final metal binding site is in the center and coordinated by 4 chains coming together and the positioning needs to be very precise. </div><div class=""><br class=""></div><div class=""> Chimera or chimerax solves this very well but I don't know how to put this into a script. I have a few solutions if someone can help me edit this to work. My script (chimera-data-processing.cxc) looks like this right now.</div><div class=""><br class=""></div><div class="">cd results/</div><div class="">open S_0001_X-4-all-chain-A.pdb ###X = 1-1000<br class="">open hsk2-cam-homology-from-map-refined-6cno-alignment-template-1-all-chain-A.pdb<br class="">info<br class="">align #1:240-244,765-769,1290-1294,1815-1819@o to_atoms #2:240-244,765-769,1290-1294,1815-1819@o matchAtomNames true; wait 300<br class="">save S_0001_X-4-all-chain-A-sf-aligned.pdb #1 format pdb relModel #2; wait 30<br class="">cd ../<br class="">close<br class="">quit<br class=""></div><div class=""><br class=""></div><div class=""> This script is perfect if run for have a single model with the exact name written into the script after typing:</div><div class=""><br class=""></div><div class="">chimerax-daily --nogui chimera-data-processing.cxc</div><div class=""><br class=""></div><div class=""> I have two main solutions </div><div class="">A) run a while loop that counts down and passes a filename to chimerax:</div><div class=""><br class=""></div><div class="">while ( X < 1000 )</div><div class=""><br class=""></div><div class=""> chimerax-daily --nogui chimera-data-processing.cxc S_0001_X-4-all-chain-A.pdb hsk2-cam-homology-from-map-refined-6cno-alignment-template-1-all-chain-A.pdb</div><div class=""><br class=""></div><div class="">Where in the chimerax script I take the arg1 (S_0001*.pdb) and arg2 (hsk2*.pdb)(assuming chimera-data-processing.cxc is arg0) and modify to look like this:</div><div class=""><br class=""></div><div class="">open $arg1</div><div class="">open $arg2</div><div class="">...</div><div class="">save $arg1-sf-aligned.pdb #1 format pdb relModel #2; wait 30</div><div class=""><br class=""></div><div class=""> Option B is to use the foreach command described in the open command documentation (<a href="https://www.cgl.ucsf.edu/chimerax/docs/user/commands/open.html" class="">https://www.cgl.ucsf.edu/chimerax/docs/user/commands/open.html</a>). However, a copy and past of that command:</div><div class=""><br class=""></div><div class=""><b style="font-family: "Times New Roman"; font-size: inherit;" class="">open myscript.cxc foreach ~/data/*.cif </b><br class=""></div><div class=""><b style="font-family: "Times New Roman"; font-size: inherit;" class="">or</b></div><div class=""><b style="font-family: "Times New Roman"; font-size: inherit;" class="">open chimera-data-processing.cxc foreach results/S_0001_*-4-</b>all-chain-A.pdb</div><div class=""><br class=""></div><div class=""> results in this error:</div><div class=""><br class=""></div><div class="">Missing filename suffix foreach<br class=""></div><div class=""><br class=""></div><div class=""> I also tried this:</div><div class=""><br class=""></div><div class="">chimerax-daily --nogui chimera-data-processing.cxc foreach results/S_0001_*-4-all-chain-A.pdb<br class=""></div><div class=""><br class=""></div><div class=""> But it just runs the command. this seems to ignore everything after the first filename. I also read that if I used foreach inside the script I could use $file to replace the filename it is currently working on, would there be a way to fave $file1 and $file2? to automate this I'd also like the change the name of the template file I'm aligning to. I also attempted the python method using sys.arg = arg[1] then running things but I couldn't get it to work because I have no experience in python. What is the suggested way to complete this task? Again this is in a much larger script with user inputs so ideally it would look like this in a script (very shorthanded just for the concepts). I can also run a python command script in my bash sctipt</div><div class=""><br class=""></div><div class="">pdb transformations</div><div class=""><br class=""></div><div class="">if (y = 5) ###alignment metal number)</div><div class=""> while ( x < 1000)</div><div class="">###arg0 = command script arg1 = pdb to align arg2 = template pdb with metals</div><div class="">chimerax-daily --nogui chimera-command-script.cxc $filenamebase$x-$alignmentnumber-*.pdb $template.pdb ###strings for variables are provided when script is initialized.<br class=""></div><div class=""><br class=""></div><div class="">###code to extract metal coords for S_0001_$x-4-*.pdb</div><div class=""><br class=""></div><div class="">done</div><div class="">fi</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">chimera-command-script.cxc:</div><div class="">open arg1</div><div class="">open arg2</div><div class="">align model #1 to model #2 on specific atoms</div><div class="">save arg1-new-filename.pdb</div><div class="">close</div><div class="">exit</div><div class=""><br class=""></div><div class="">if someone would like a follow-up email with my attempt at chimera python sctipt using runcommand I'm very happy to supply that as a foundation to help fix, I just thought this one is easier to fix since it is really close, the script works but only for 1 pdb at a time. </div><div class=""><br class=""></div><div class="">Apologies for bad scripting terminology and confusion with python, I've had to teach coding to myself so I might have misused terms.</div><div class=""><br class=""></div><div class="">Thanks for any help that can be given,</div><div class=""><br class=""></div><div class="">Ryan</div></div>
_______________________________________________<br class="">ChimeraX-users mailing list<br class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="">ChimeraX-users@cgl.ucsf.edu</a><br class="">Manage subscription:<br class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users<br class=""></div></blockquote></div><br class=""></div></body></html>