[chimerax-users] FitMap/FitList scripting
Tom Goddard
goddard at sonic.net
Wed Jul 27 11:58:28 PDT 2022
Hi Christian,
Thanks for the suggestion.
I added a logFits option to the fitmap command that takes a file path and writes a csv file (space delimited fields) giving rotation, translation and metrics for each fit found. Here's an example,
fit #2 in #1 search 10 resolution 8 log test.csv
and the test.csv output looks like this
Rxx Rxy Rxz Ryx Ryy Ryz Rzx Rzy Rzz Tx Ty Tz Rxx Rxy Rxz Ryx Ryy Ryz Rzx Rzy Rzz Tx Ty Tz correlation correlation_about_mean overlap average_map_value points atoms_outside_contour clash contour_level steps shift angle
0.9546 -0.1862 0.23254 -0.19873 0.18347 0.96273 -0.22192 -0.96523 0.13814 -33.631 -32.845 52.687 0.9546 -0.1862 0.23254 -0.19873 0.18347 0.96273 -0.22192 -0.96523 0.13814 -33.631 -32.845 52.687 0.89959 0.38142 428.41 1.3389 1269 1051 None 1.6751 160 23.04 83.938
0.033027 0.96293 -0.26772 0.49156 -0.24888 -0.83452 -0.87022 -0.10404 -0.48156 -20.635 -45.316 -16.64 0.033027 0.96293 -0.26772 0.49156 -0.24888 -0.83452 -0.87022 -0.10404 -0.48156 -20.635 -45.316 -16.64 0.89635 0.39595 414.3 1.2748 1269 1060 None 1.6751 180 32.29 35.003
-0.050129 -0.04473 0.99774 0.48574 -0.87398 -0.014776 0.87267 0.4839 0.065539 -24.392 -40.834 -51.365 -0.050129 -0.04473 0.99774 0.48574 -0.87398 -0.014776 0.87267 0.4839 0.065539 -24.392 -40.834 -51.365 0.89472 0.38325 427.47 1.3188 1269 1005 None 1.6751 96 20.231 48.959
0.22351 -0.2005 -0.95386 0.95362 -0.15743 0.25655 -0.20161 -0.96696 0.15601 12.383 -47.749 -47.089 0.22351 -0.2005 -0.95386 0.95362 -0.15743 0.25655 -0.20161 -0.96696 0.15601 12.383 -47.749 -47.089 0.89301 0.35516 413.28 1.2865 1269 1074 None 1.6751 172 19.123 47.05
0.20255 0.23788 -0.94994 0.97336 0.057526 0.22195 0.10744 -0.96959 -0.21989 -48.721 -11.242 -54.037 0.20255 0.23788 -0.94994 0.97336 0.057526 0.22195 0.10744 -0.96959 -0.21989 -48.721 -11.242 -54.037 0.89201 0.32128 423.1 1.3325 1269 1088 None 1.6751 128 14.159 58.657
-0.61123 -0.071308 -0.78824 -0.042678 0.99745 -0.057141 0.7903 -0.001286 -0.61271 48.37 -27.888 25.428 -0.61123 -0.071308 -0.78824 -0.042678 0.99745 -0.057141 0.7903 -0.001286 -0.61271 48.37 -27.888 25.428 0.88439 0.32423 417.39 1.298 1269 988 None 1.6751 136 23.05 87.868
0.09157 0.98735 0.12945 -0.60629 0.15841 -0.77931 -0.78996 -0.0071244 0.61312 -37.916 40.914 -25.31 0.09157 0.98735 0.12945 -0.60629 0.15841 -0.77931 -0.78996 -0.0071244 0.61312 -37.916 40.914 -25.31 0.88404 0.32154 417.07 1.2977 1269 992 None 1.6751 180 27.808 96.074
0.41033 -0.31507 0.85578 0.82772 -0.2652 -0.49452 0.38276 0.91126 0.15197 46.773 -10.995 48.939 0.41033 -0.31507 0.85578 0.82772 -0.2652 -0.49452 0.38276 0.91126 0.15197 46.773 -10.995 48.939 0.85148 0.18917 374.64 1.1861 1269 1121 None 1.6751 236 11.387 62.511
-0.026099 0.29763 -0.95432 -0.93812 0.32248 0.12623 0.34532 0.89857 0.2708 38.931 22.863 14.979 -0.026099 0.29763 -0.95432 -0.93812 0.32248 0.12623 0.34532 0.89857 0.2708 38.931 22.863 14.979 0.84828 0.17166 410.1 1.303 1269 941 None 1.6751 156 15.797 69.3
The first line names the fields. Some values for the metrics can be shown as None, for example if fitting an atomic model but not specifying a resolution, then correlation will be None. The field called "points" is the total number of atoms fit when fitting an atomic model. If fitting a map in a map "points" would be the number of grid points of the first map (within its contour surface) being fit into the target map. I think the other field meanings are pretty clear.
Tom
> On Jul 26, 2022, at 11:54 PM, Christian Tüting via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi Tom,
>
> yeah, Yiannis asked something slightly different, but we often uses
> chimerax and the fitting. So not only having the avg/inside, but also
> the actual translation might help in the future, as we can perform the
> fitting unsupervised (e.g. in nogui mode on one of our image analysis
> machines, as they are faster than the office machines), and later place
> the molecule at the correct position, based on the fitting.
>
> And having a saved list with not only avg/inside (what Ioannis asked
> for), but additional information, would be handy and could be easily
> post-process in any tool (R, python, even excel if it's a tab seperated
> csv).
>
> And thanks for your fast reply/support.
>
> Best
> Christian
>
>
>>>> Tom Goddard <goddard at sonic.net> 07/27/22 4:51 AM >>>
> Hi Christian,
>
> I'll see if I can add a command option to output the rotations and
> translations for all fits to the log, maybe tomorrow.
>
> Yiannis asked about copy and paste from the Fit list a few months ago
>
> https://www.rbvi.ucsf.edu/pipermail/chimerax-users/2022-May/003783.html
> <https://www.rbvi.ucsf.edu/pipermail/chimerax-users/2022-May/003783.html>
>
> I see copy and paste works now at least on the Mac where I just tested.
>
> Tom
>
>
>> On Jul 26, 2022, at 6:23 AM, Christian Tüting via ChimeraX-users
> <chimerax-users at cgl.ucsf.edu> wrote:
>>
>> Dear ChimeraX DevTeam,
>>
>> I am currently working on a project which requires fitting a single
> model multiple times in a map. This is easy doable with the global
> search parameter, and if n is big enough, all correct locations are
> found.
>>
>> My collegue Ioannis wrote you a couple of weeks ago to implement a
> copy function to the fitlist, but this includes only the statistics, but
> not the translation information of each model. This is only possible by
> clicking the button "Place Copy", which creates a copy of the model and
> applies the translation to this model.
>> In the log, there is only the best model with the translation matrix,
> but if my map does have multiple correct locations, I'm missing this
> information.
>>
>> I extended the fitmap function in fitcmd.py, so it writes this to a
> file to the current location called fitmap.txt. This file contains all
> the statistics and the rotation/translation information. This might be
> handy for some users.
>>
>> Here is the code:
>>
>> f = open("fitmap.txt", "w")
>> if len(flist) == 0:
>> f.write("No fit found")
>> else:
>> for i, f0 in enumerate(flist):
>> msg = f0.fit_message()
>> f.write(f"Fit #{i+1}\n" + msg + "\n")
>> f.close()
>>
>> Maybe you can include an option "to_text" (which is false by default),
> to actually add this functionality.
>>
>>
>> Best
>> Christian
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>>
>
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
More information about the ChimeraX-users
mailing list