[Chimera-users] [chimerax-users] Reproduce exact view
goddard at sonic.net
Mon Feb 10 15:14:52 PST 2020
Hi Elaine, Alexis,
You can change a model number by command. So if you replace model #3 with model #8 that you align to #3, then delete #3, then "rename #8 id #3" will change the model id of #8 to be #3. For the step of aligning #8 to #3, if they are aligned already then #8 would open aligned to #3 unless you had moved #3 in which case you could use "view position #8 sameAs #3". Of course if the new model has not been aligned to the old you may need to use the matchmaker command to align them.
> On Feb 10, 2020, at 1:44 PM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
> Hi Alexis,
> We removed the forward-compatibility warning during session saving a while ago, so as long as the version you’re using is not too old, we expect the session files to be forward compatible. Still, I understand a reluctance to rely on them completely when it can take many hours or even days to set up everything the way you want.
> Sometimes I just save the session now. However, sometimes I use a “belt and suspenders” approach by saving not just the session but also a command file that has just about everything I’d used for the setup except for interactive manual positioning. I often include such a script when I add a “feature highlight” to the ChimeraX website.
> I too have often wished for an easy way to replace one model in an existing session with another. Getting the matrices (view matrix), swapping out the model, and then reapplying the matrix may be the most exact way if the models are in the same coordinate system as each other. Otherwise you could open the new model, match or fit it to the one you wish to replace, then close the one you want to get rid of. That leaves you with different model numbers, however, so if it is important to get them the same you’d have to open the new model again, match it to itself, and remove the extra intermediate copy you’d opened first. (Ugh.)
> Elaine C. Meng, Ph.D.
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>> On Feb 10, 2020, at 1:22 PM, Alexis Rohou <a.rohou at gmail.com> wrote:
>> Thanks Elaine,
>> I should have added some explanation for my workflow:
>> 1. I read a while back that ChimeraX sessions may or may not be forward compatible, and I wanted to ensure long-term reproducibility of my figures
>> 2. a requirement I have is that I should be able to quickly remake the exact same figure after I change the input files. For example, perhaps I prototype an elaborate figure using a PDB that's a work in progress and later re-make it with an updated PDB. The advantage of a .cxc script is that I just have to change the filename near the beginning of the script and everything else stays the same. I can regenerate all my figures pretty quickly that way. That's the big payoff for investing the time to write a script upfront.
>> The view functionality does sound very nice though, especially since I don't currently have a way to achieve transitions with my scripts (other than perhaps creating views within the scripts themselves?). Elaine, is there a way to use sessions so that I could replace a model or map with a new version of a file after I've already created a session?
>> On Mon, Feb 10, 2020 at 9:26 AM Elaine Meng <meng at cgl.ucsf.edu> wrote:
>> Maybe I’m missing something, but the “view” command allows saving and restoring named views. These are included in saved session files. I agree window size is also a factor, so you would make sure to set the same window size too.
>> E.g. once you have the view you like then use a command like:
>> view name myview
>> Then you can save the session file and/or move things around. Later in the same session or after restoring the previously saved session from file,
>> view myview
>> …will restore that view. Restoring the session restores window size if you have that Window Preference set:
>> or you could have noted the window size when you saved the view:
>> …and then use the reported values later to restore that size, e.g.
>> windowsize 600 400
>> I hope this helps,
>> Elaine C. Meng, Ph.D.
>> UCSF Chimera(X) team
>> Department of Pharmaceutical Chemistry
>> University of California, San Francisco
>>> On Feb 10, 2020, at 8:53 AM, Alexis Rohou <a.rohou at gmail.com> wrote:
>>> Hi Christophe,
>>> I prepare my figures using ChimeraX command (.cxc) scripts and I believe I have a workflow that lets me reproduce exact views. I know it's not 100% robust, but it's reliable enough for me. It basically relies on a sequence of close; windowsize; view matrix; zoom; clip; save.
>>> Here is a pseudo script. To work out the values you need for the matrices, just move your point of view and your models until you are happy, then do "view matrix". I have not worked out a good way to get the distances for the clip planes. So I just play with them on the command line until I get the look I want, then save the values in my cxc file.
>>> Hope this helps & that more experienced users can chime in with improvements.
>>> # close anything currently open
>>> # go to relevant directory
>>> cd /my/absolute/path
>>> windowsize 1200 1200
>>> camera ortho
>>> clip near off far off front off back off
>>> # Open files
>>> open my_model.pdb name "my model"
>>> open my_map.mrc name "my map"
>>> # etc.
>>> #insert here coloring, styles, for the model/map/background etc
>>> # Go to your favorite view point, save a shot
>>> view matrix camera 1,0,0,182.59,0,1,0,229.79,0,0,1,352.89
>>> zoom 0.33
>>> clip near off far off front off back off; clip near -100.0 far +100.0 front off back off
>>> save my_figure.png supersample 3 transparentBackground false
>>> # If you need to move your models
>>> view matrix models #1,0.91269,-0.0093359,-0.40855,59.153,-0.40865,-0.018906,-0.91249,368.7,0.00079806,0.99977,-0.02107,-44.893,#2,-0.83654,-0.058918,-0.54474,344.52,-0.54355,-0.035951,0.83861,293.33,-0.068993,0.99762,-0.0019503,-42.032
>>> # then take another shot
>>> view matrix camera 0.98289,-0.005269,-0.18408,131.07,-0.17421,-0.3506,-0.92018,70.662,-0.059691,0.93651,-0.34553,163.8
>>> clip near off far off front off back off; clip near -20.0 far +12.0 front off back off
>>> save Figures/TRPA1_3551_binding_site_details1.png supersample 3 transparentBackground false
>>> On Sun, Feb 9, 2020 at 10:01 AM Christophe Leterrier <christophe.leterrier at gmail.com> wrote:
>>> I haven't been able to find how to
>>> - log
>>> - set
>>> - store
>>> - recall
>>> a precise view (ie get the same exact image if I do a snapshot).
>>> First use case would within the same session (fixed computer, window size, no restart of the application in between). Second use case (more tricky?) would be independently of computer / window size / current session.
>>> Thanks for your help!
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
More information about the Chimera-users