-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add position and scaling matrix for nup84 2D EM #30
Comments
The scale is already provided in pixel_size_width and pixel_size_height of the ihm_2dem_class_average_restraint table. So only rotation and translation need to be provided using the current ihm_2dem_class_average_fitting table. |
@tomgoddard, any preferred convention for this transformation? Since we don't currently have it in IMP, I may as well be consistent with whatever convention Chimera uses when I add it. (By "convention" I mean where do you place 2D images relative to 3D objects? On the xz or yz plane? Centered at the origin or origin at bottom left of the image?) @brindakv, we should state this convention in the dictionary too so there's no confusion. |
A 2D image opened in Chimera is placed in the xy plane with the lower left image corner (image pixel index 0,0) at x,y,z = (0,0,0).
|
Extract 2DEM fitting information (transformation that places the model onto the image, and the cross correlation coefficient) from the PMI stat file, and write it out into mmCIF files. Relates ihmwg/IHMCIF#30.
The nup84 example 2DEM fitting matrix is not aligning the map with the cluster 1 sphere model. If I transpose (or equivalently invert) the rotation then the orientation looks correct (see attached image). But nothing I tried made the translation alignment correct, typically off by about 50-300 Angstroms along each axis.
The conventions are not clear in the ihm-extension.dic file but here is what I think the should be. The 2D image is scale by the pixel_size_width and pixel_size_height from the ihm_2dem_class_average_restraint table with corner pixel 0,0 being at position x,y,z = 0. Then the rotation is applied to the image grid points, and finally the translation vector is applied to the image grid points. (This implies the translation is in units obtained after pixel_size_width scaling, e.g. Angstroms.) The resulting image location should match the sphere model when projected orthogonal to that final image position. The rotation is applied by multiplying an xyz grid point column vector by rotation matrix having elements r11,r12,r13 in the first row, r21,r22,r23 in second row, r31,r32,r33 in third row (R * xyz).
In the nup84 example the rotation matrix elements have only 3 digits to the right of the decimal place. This is not enough to get decent orthogonality of the matrix and it would be better to have maybe 6 digits minimum so the rotation is really a rotation to within 32-bit float precision.
|
Is the code for this in ChimeraX already? Seems to me like it would be easier for me to fiddle with it at my end rather than going back and forth. And I'll double-check the transformation here. There is a test in the IMP test suite with a toy system, but possibly something weird is happening for Nup84.
If I understand you correctly, your thoughts on what they should be match what I implemented in IMP, except that the rotation and translation are applied to the 3D model, not the image. That's presumably why you had to invert the rotation matrix. @brindakv needs to clearly state the convention in the dictionary, but of course it's easy for whoever ends up being "wrong" to invert the transformation. (My feeling is that the transformation should apply to the model rather than the image because the image is pristine input data while the model is noisy output data. Of course for viewing you can choose to transform either.)
No problem - I can output them with more precision. My CIF writer outputs all floats with 3 places, but I can hack it to add more precision just for these fields. |
I tried using the inverse transform on the 2d image and it came closer but still off in translation in x and y by maybe 50-100 Angstroms, image attached. The code to read the matrix (using the inverse) will be in tonight’s ChimeraX build.
|
FYI, looks like GitHub strips attachments if you reply to an issue by email, so nobody can see the image. |
Thanks. Thought I’d try the attachments but they are not important — the text describes the situation.
|
In order for viewers to be able to reconstruct a rotation matrix that's reasonably close to orthogonal, we need to output the elements with more than 3 digits or precision. Increase to 6 digits. Relates ihmwg/IHMCIF#30.
Ah, I see the problem. The transformation is correct but it's for the model as stored in the RMF file. For some reason we center the models on the origin before writing out the mmCIF file. So we could either adjust the transformation to account for that, or deposit the IMP model coordinates without centering them first. I'm inclined to do the latter since the fewer differences between what we have in our 'raw' files (e.g. trajectories) and the mmCIF, the better. |
Sounds good.
|
For the sake of reproducing what was done in the modeling as well as possible, it's better to use the same model coordinates in the RMF and the mmCIF output (previously mmCIF output was centered). This also ensures that trajectories or ensembles are in the same reference frame as mmCIF and so work correctly. Provide a Transformation3D for each model so that this behavior can be overridden. (We do this for Nup84 since the trajectories there are multimodel PDB files, which have already been centered, so in this case it makes sense to center the mmCIF output to match. Relates ihmwg/IHMCIF#30.)
Turns out that the Nup84 trajectories are also centered, so it makes sense to leave the mmCIF output as it is. Pretty easy to invert this centering before applying the image transformation though. |
The trajectories here are multimodel PDB files, which have already been centered, so it makes sense to center the mmCIF output to match. This used to happen automatically, but this behavior changed in PMI as of salilab/pmi@f87844. Relates ihmwg/IHMCIF#30.
nup84.cif has a reference to a 2D EM map (*.pgm) file which does not contain pixel size information or alignment to the sphere models.
The text was updated successfully, but these errors were encountered: