Opened 3 years ago
Closed 3 years ago
#7334 closed enhancement (fixed)
Add command option to fitmap to write fit positions and metrics to a csv file
| Reported by: | Owned by: | Tom Goddard | |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Volume Data | Version: | |
| Keywords: | Cc: | Elaine Meng | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description (last modified by )
Begin forwarded message:
From: Christian Tüting via ChimeraX-users <chimerax-users@…>
Subject: [chimerax-users] FitMap/FitList scripting
Date: July 26, 2022 at 6:23:15 AM PDT
To: <chimerax-users@…>
Reply-To: Christian Tüting <>
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
Change History (1)
comment:1 by , 3 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Done.
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
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.