Skip to content

basantab/emtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

emtools

Tools for electron microscopy data analysis

transform_particles.py applies a transformation matrix to all particles in a provided RELION star file. transform_particles.py is able to read and write RELION star files contaning the relevant columns (_rlnAngleRot, _rlnAngleTilt, _rlnAnglePsi, _rlnOriginXAngst and _rlnOriginYAngst, or _rlnOriginX and _rlnOriginY, in older RELION versions) from versions earlier and later than 3.1.

The easiest way to manage the libraries needed to run the transform_particles.py script is to install Anaconda, and use it to generate the py37 environment, with a version scipy that has the Rotation object.

  1. Install Anaconda following the instructions in their website.

  2. Clone this repository:

git clone https://github.com/basantab/emtools.git

cd emtools

  1. Create py37 using the provided .yml file:

conda env create -f ./py37.yml

  1. Before running transform_particles.py, activate the py37 environment using conda activate py37.

  2. Run transform_particles.py, like in this example:

python transform_particles.py --starfile your_star_file.star --transformation_mtx [[0.98364538,-0.15451987,0.09254928,4.25534352],[0.15692689,0.48301307,-0.86143620,-5.85090884],[0.08840650,0.86187121,0.49936190,12.25449899]] --angpix 1.15

In this example, all particles in your_star_file.star are transformed using the following transformation matrix:

[[0.98364538,-0.15451987,0.09254928,4.25534352],

[0.15692689,0.48301307,-0.86143620,-5.85090884],

[0.08840650,0.86187121,0.49936190,12.25449899]]

In this matrix, the fourth column is the translation in X, Y and Z, and it's in Angstroms. A matrix like this can be obtained from aligning two densities in UCSF Chimera (keep in mind manual manipulations will not be reflected in the output matrix) using the fitmap command. If using UCSF Chimera, make sure you set the Origin index (Volume viewer > Features > Coordinates) of your densities to "center", that way the transformation matrix will reflect the desired transformation. Also, note that the transformation is not done on the raw micrographs, the input star file must be pre-populated with assigned particle Euler angles and rotation origin shifts.

Running python transform_particles.py --help will produce the following message:

usage: transform_particles.py [-h] --starfile STARFILE [--angpix ANGPIX]
                          --transformation_mtx TRANSFORMATION_MTX
                          [--output_name OUTPUT_NAME]

Use transformation matrices generated by chim_session_to_mtx.py to populate a
template relion star file Euler angles and rotation origins.

optional arguments:
  -h, --help            show this help message and exit
  --starfile STARFILE   RELION *.star file to use as template.
  --angpix ANGPIX       Particle pixel size.
  --transformation_mtx TRANSFORMATION_MTX
                    Desired 3x4 transformation matrix in Angstroms. E.g.:
                    "[[1,2,3,4],[5,6,7,8],[9,10,11,12]]"
  --output_name OUTPUT_NAME
                    Name for output *.star file

About

Tools for electron microscopy data analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages