I3 Processor¶
This module implements the processing function for the I3 software package.
The module will create an I3 project directory.
- processors.i3_processor.center_coordinates(coords, size, binning=1)¶
- Given an XYZ tuple of particle coordinates and the reconstruction they came from, shift the
coordinates so that the origin is at the center of the tomogram
- Parameters
coords – the (x, y, z) coordinates for the particle
size – the reconstruction MRC half-dimensions in (nx/2, ny/2, nz/2) form
binning – the bin factor from the original stack to the final reconstruction
Returns: the new coordinates as a (x, y, z) tuple
- processors.i3_processor.check_and_fix_names_starting_with_numbers(name)¶
- Since I3 map names cannot start with a number, add a letter ‘a’ to any names starting with a
number
- Parameters
name – The name to check for a beginning number
Returns: The new name (unchanged if the name properly started with a letter)
- processors.i3_processor.convert_tlt_eman2(info_file, map_file, output)¶
Given an EMAN2 tomogram info JSON file, write out an I3 format .tlt file for that tomogram
- Parameters
info_file – The EMAN2 JSON info file for the tomogram
map_file – The map file to place at the head of the .tlt file
output – The output file path to write the new I3 .tlt file to
Returns: None
- processors.i3_processor.convert_tlt_imod(map_file, tilt_angle, file_in, file_out)¶
Convert an IMOD .tlt file to I3 tilt file format :param map_file: The map MRC file (not the full path) :param tilt_angle: The angle to put as the tilt azimuth :param file_in: The IMOD .tlt file :param file_out: The I3 tilt file
Returns: None
- processors.i3_processor.eman2_processor_to_i3(root, name, i3_args)¶
Implements the I3 processing of simulated data that was reconstructed using the EMAN2 Processor.
- Parameters
root – The ETSimulations project root directory
name – The particle name
i3_args – The I3 Processor arguments
Returns: None
- processors.i3_processor.eman2_real_to_i3(i3_args)¶
Implements the I3 processing of a real data set reconstructed/particle-picked with EMAN2
- Parameters
i3_args – The I3 Processor arguments
Returns: None
- processors.i3_processor.extract_e2_particles(stack_file, name, destination)¶
Unpack a stack of EMAN2 particles into individual sub-volume maps
- Parameters
stack_file – The EMAN2 particle stack file (either a .lst set or .hdf stack)
name – The basename to assign to extracted maps
destination – The destination folder to place the extracted particles in
Returns: None
- processors.i3_processor.get_eman2_tilts(info_file)¶
- Given an EMAN2 tomogram info JSON file, extract an array of the tilt angles as would be given in
an IMOD .tlt file
- Parameters
info_file – The tomogram JSON info file path
- Returns: A tuple of (average tilt axis computed across all tilts,
a numpy array of the tilt angles for that tomogram)
- processors.i3_processor.get_mrc_size(rec)¶
- Return the half the size of each dimension for an MRC file, so that we can move the origin to
the center instead of the corner of the file
- Parameters
rec – the MRC file to get the size of
Returns: A tuple (x/2, y/2, z/2) of the half-lengths in each dimension
- processors.i3_processor.get_slicer_info(mod_file)¶
Open an IMOD .mod file and retrieve the Slicer information
- Parameters
mod_file – The .mod file path
Returns: A list of Slicer point objects with keys {“angles”, “coords”}
- processors.i3_processor.get_trf_lines_imod(slicer_info, basename)¶
- Given the particle coordinates and angles for a tomogram, format them into a list of lines to
write out to a .trf file
- Parameters
slicer_info – A list of dictionary objects with keys {“coords”, “angles”} for the particles in a tomogram (returned from get_slicer_info())
basename – A basename for the tomogram, to be put as the data subset identifier for the .trf
Returns: A list of lines to write out to a .trf file
- processors.i3_processor.imod_processor_to_i3(root, name, i3_args)¶
Implements the I3 processing of simulated data that was reconstructed using the IMOD Processor.
- Parameters
root – The ETSimulations project root directory
name – The particle name
i3_args – The I3 Processor arguments
Returns: None
- processors.i3_processor.imod_real_to_i3(name, i3_args)¶
Implements the I3 processing of a real data set reconstructed/particle-picked with IMOD
- Parameters
name – The particle name
i3_args – The I3 Processor arguments
Returns: None
- processors.i3_processor.parse_lst_file(filename)¶
- Read EMAN2 .lst particle sets and extract a dictionary of particle numbers mapped to the
particle’s tomogram info file, extracted stack file, and local particle number within that tomogram
- Parameters
filename – The .lst file path
- Returns: A tuple of
- (
Dictionary of { particle number: {“info”, “stack”, “local_no”} } objects, Dictionary of { stack: number of particles in stack }
)
- processors.i3_processor.read_particle_params(json_file)¶
- Given a particle_parms_*.json file from EMAN2 STA, extract the particle list and their
transformation matrices.
- Parameters
json_file – The particle_parms_*.json file path
Returns: A tuple of (.lst file name, dictionary of {particle number, transformation matrix})
- processors.i3_processor.rotate_positions_around_z(positions)¶
- Given a list of coordinates, rotate them all by 90 degrees around the z-axis. This is used to
convert particle coordinates from the raw tiltseries to the final reconstruction’s coordinate system for simulated data.
- Parameters
positions – A list of [x, y, z] coordinates
Returns: None
- processors.i3_processor.shift_coordinates_bottom_left(coords, size, binning=1)¶
- Given an XYZ tuple of particle coordinates and the reconstruction they came from, shift the
coordinates so that the origin is at the bottom-left of the tomogram
- Parameters
coords – the (x, y, z) coordinates for the particle
size – the reconstruction MRC half-dimensions in (nx/2, ny/2, nz/2) form
binning – the bin factor from the original stack to the final reconstruction, to be used if you are using coordinates based on the original unbinned coordinate system
Returns: the new coordinates as a (x, y, z) tuple
- processors.i3_processor.slicer_angles_to_i3_matrix(angles)¶
Given a set of angles from IMOD’s Slicer, convert those angles to a rotation matrix.
- Parameters
angles – The (x, y, z) Slicer angles
- Returns
The corresponding rotation matrix
- processors.i3_processor.split_coords(coords)¶
- Given XYZ coordinates, split into the integer positions and displacements from the integer
position, as required by the trf files
- Parameters
coords – The X, Y, Z coordinates
Returns: tuple (icoor, diff_coord) of the integer and decimal parts, respectively
- processors.i3_processor.write_trf_eman2_extracted(set_name, translations, rot_matrix, trf_file)¶
Helper function to write out the .trf file for one extracted particle
- Parameters
set_name – The I3 set name to write (should be the basename of the extracted map file)
translations – The particle translations
rot_matrix – The rotation matrix for the particle
trf_file – The output file path
Returns: None