Conventions - StochasticAnalytics/emClarity GitHub Wiki

General coordinates and transformations

Euler angle convention

The angles input to emClarity describe ZXZ active intrinsic rotations of the particles coordinate system. That is to say, the basis vectors describing the average particle in the microscope reference frame are rotated (positive anti-clockwise) around Z, the new X, and the new Z axis. The final transformation describes the coordinate system attached to any given particle in your data set.

Interpolation

Given the above description of the Euler angles, the gridvectors calculated in matlab (micrscope basis) are transformed by Z1,X,Z2 and used to ask what is the density there, rotate it back into the microscope reference frame. To rotate an average from the microscope frame to the particle, the gridvectors are multiplied by -Z2,-X,-Z1.

  • Most interpolation is linear and uses fast lookups in the texture memory on the GPU
  • The 2D stacks are rotated, stretched, and shifted entirely in Fourier space (padded 2x) in order to reduce loss of high-resolution signal.
  • Matlab 2018b supports spline interpolation on the GPU, and I will be testing this to see if it improves resolution in the final average.

Geometry in .csv .tlt and .mat files

tiltN_aliM_ctf.tlt
tiltN_tomoM_binX.csv

This file stores the output from template matching. The euler angles are not used directly, instead the rotation matrix is read in. This is exploited to import orientations from other software. (In testing). Some columns don't have a direct usage under currently distributed functions, but should be specified as follows to remain forward compatible.

1- Unnormalized CCC

2- Binning

3- 0 - n/a

4- particle IDX (unique value per tomogram)

5:9- 1 - n/a

10- 0 - n/a

11- x-coord, from 1 at lower left corner (as viewed in IMOD)

12- y-coord, ""

13- z-coord, "" ALL are specified at FULL sampling (bin 1)

14:16- Euler angles

17:25- Rotation matrix (column major) r11,r21,r31,r12,r22,r32,r13,r23,r33

* Set to all (-1) to import from Protomo (euler angles in 14:16 will be flipped and multiplied by -1)
* Set to all (-2) to import from PEET (euler angles in 14:16 will be ....)
* Set to all (-3) to import from RELION (euler angles in 14:16 will be ...)
* I am working on all three. If you need Dynamo or Pytom let me know.

26- Class idx (all just set to 1)

* particles set to -9999 are ignored as in PEET
Files needed to generate a project

a) recon/tiltN_recon.coords

This text file has the following lines (without the parentheticals) where the capitalized parameters are as defined for IMOD "tilt" that does the reconstruction. No blank lines.


TiltName (string, basename for the tilt series as you would enter for "ctf estimate"

nSubRegions (integer, total number of tomograms in the tilt-series)

tomo1-NX (integer, WIDTH of this tomogram)

tomo1-NY1 (integer, SLICE float 1 -- starting Y)

tomo1-NY2 (integer, SLICE float 2 -- ending Y)

tomo1-NZ (integer, THICKNESS)

tomo1-CX (float, SHIFT 1 -- (-1)*position of tomogram origin in X, i.e. shift needed to center the recon area in the output)

tomo1-CZ (float, SHIFT 2 -- Z offset. Note this is already implicitly multiplied by -1 due to the rotated reference frame that IMOD uses to speed up reconstruction)

tomo2-NX (integer)

tomoN-CZ


b) convmap/tiltN_tomoM_bin4.csv

c) convmap/tiltN_tomoM_bin4.mod

You will need one of there for each reconstructed area.

This is likely where your approach is breaking down. The coordinates in the CSV are stored relative to the full sampling rate, while the coordinates in the model file are stored at the binned sampling rate used in template matching. (recorded in the file name but also column 2 of the csv)

If you have your edited csv, you'll need to first make a text file with the x/y/z coords of the subtomos you want to keep, and then generate a model file from that. The easiest might be (assuming a binnning of 4)

$ awk '{print $11/4,$12/4,$13/4}' your_cleaned_file.csv > cleaned_tmp.txt

$ point2model -circle 3 -sphere 2 -scat -thick 2 -color 80,191,255, -image ../cache/tiltN_tomoM_ali1_bin4.rec cleaned_tmp.txt your_cleaned_file.mod

Note that you'll have to either replace or link to the "your_cleaned_file" to have the correct tiltN_tomoM_bin4" prefix.

This is the csv file as defined above.

Notes for working with filaments

There are a few special considerations when working with filamentous (helical/ish) particles.

  1. The filament axis should coincide with the Z-axis. This is important so that all of the search ranges are reasonable.

  2. When specifying your search angles, you need an additional fifth argument (1 is fine) to tell emClarity you have a helical particle. So [Out-of-plane range, Out-of-plane inc, In-plane range, In-plane inc]

For the purpose of alignment, it is assumed that your filament lies mostly in the X/Y plane, and so the reference is pre-rotated by 90 degrees. So your out of plane search should probably be limited to +/- 15 degrees.

In-plane in this case then means around the filament axis.

So for template matching, specifying [15,5,180,10,1] will rotate your reference by 90 about X, into the plane, and then search +/- 15* around X from there, searching around the filament axis in 10* steps. Prior to rotating in the plane, the reference is also stepped through a rotation about the Z-axis, such that the full range about the microscope Z-axis is also searched.

For sub-tomogram alignment, the idea is the same, but internally YZY euler angles are used rather than ZXZ.

⚠️ **GitHub.com Fallback** ⚠️