susan.project.SubtomogramGenerator

class susan.project.Extractor.SubtomogramGenerator[source]

Bases: object

Generate subtomograms and export them with RELION-compatible metadata.

Warning

This is an experimental class. The interface and output format may change in future versions.

Reconstructs per-particle subtomograms via SubtomoRec and writes a RELION 3.1 STAR file containing the optics group and particle table. Call one of the configure_* methods before generate_subtomos() to set the reconstruction parameters for the target software.

Attributes

list_gpus_ids

GPU device IDs to use for reconstruction. Default: [0].

Type:

list of int

subtomo_rec

Underlying reconstruction module. Advanced parameters can be adjusted directly on this object after calling a configure_* method.

Type:

SubtomoRec

Methods

configure_relion(rec_ctf=True, invert_contrast=True)[source]

Configure reconstruction settings for RELION.

Sets normalisation, contrast, and CTF correction parameters on subtomo_rec to match RELION’s conventions.

Parameters:
  • rec_ctf (bool, optional) – If True (default), use pre-Wiener CTF correction and write a per-particle CTF image (_rlnCtfImage). If False, use standard Wiener filter and write per-particle defocus columns.

  • invert_contrast (bool, optional) – Invert the contrast of the output subtomograms. Default: True.

configure_dynamo(invert_contrast=False)[source]

Configure reconstruction settings for DYNAMO.

Sets normalisation, contrast, and CTF correction parameters on subtomo_rec to match DYNAMO’s conventions (Wiener filter, no low-frequency boost).

Parameters:

invert_contrast (bool, optional) – Invert the contrast of the output subtomograms. Default: False.

generate_subtomos(metadata_file, subtomos_folder, tomos_file, ptcls_in, box_size)[source]

Reconstruct subtomograms and write a RELION STAR metadata file.

The subtomogram MRC files are written to subtomos_folder. A RELION 3.1 STAR file is then written to metadata_file containing an data_optics block (single optics group derived from the first tomogram) and a data_particles block with one row per particle. Currently only .star output is supported.

Parameters:
  • metadata_file (str) – Output path for the STAR file (must end in .star).

  • subtomos_folder (str) – Directory where the per-particle MRC files will be written.

  • tomos_file (str) – Path to the .tomostxt file describing the tomogram stack.

  • ptcls_in (str) – Path to the input .ptclsraw particles file.

  • box_size (int) – Side length of the cubic subtomogram box in pixels.