← Back to the Datasets tab · Relaunching · RELION 3D Reconstruction
RELION 2D Classification core workflow
This script (dataset/tasks/30_Relion2DClassification.script, a Bash
script) runs a RELION 2D classification on the particles that the
single-particle step
extracted from all images of the project, or from the most recent images only.
If earlier runs left classes in Class2D_RealTime/, a new run builds on
them instead of starting from scratch (relion_continue_from_earlierresults). It is
made to follow the data collection: started with the
relaunch fields set, it runs again every
few minutes, each time on the images as they are then (all, or the newest) and starting from the classes of the
run before, so the class averages keep up with what the microscope delivers. Every
finished iteration appears at once as a tiled image of the class averages.
After a first run with three iterations on the ten most recent images: the Images pane lists, for every iteration, the tiled class averages (important, in red), the stack of averages and the model; the File Preview shows the tiled averages of iteration 3, twenty classes of apoferritin with a 500 Å scale bar; the Output ends with the iterations done. The relaunch fields are set to a run every 60 minutes, 24 times, so the next run will start from these classes.
What it needs
- RELION, found through the RELION directory (
dir_relion) of the Preferences — itsbin/orbuild/bin/— or on thePATH. The log names the RELION found and its version. mpirun(Open MPI) andrelion_refine_mpifor more than one MPI process; without them the run falls back to a single process with a warning. An application started from the macOS Finder does not see Homebrew'sPATH, so the usual Homebrew locations are tried as well.- Images on which the single-particle step has finished: it leaves
spa_particles.mrcandspa_particles.starin the image directory. Without any, the script stops with an error.
Parameters
| Parameter | Role |
|---|---|
dataset_dir | The dataset directory under merge/; the runs go into Class2D_RealTime/ below it. |
relion_continue_from_earlierresults | y = a run builds on the classes of earlier runs in Class2D_RealTime/ (see References below); n = the first run of a launch starts from scratch, and only the relaunched runs of the series build on the run before them. Earlier runs are kept either way. |
relion_work_on_all | y = every image with particles takes part; n = only the last_imgs most recent ones. Images in TRASH are left out. |
last_imgs | With relion_work_on_all = n: how many images take part, those whose single-particle step finished most recently, newest first (by the time of their spa_particles.star). Frozen with relion_work_on_all = y. |
spa_diameter | The particle diameter of the single-particle step, in Å. Used for the mask when no mask diameter is given. |
relion_k | Number of classes (--K). Each class needs a few hundred particles for a meaningful average. |
relion_iter | Iterations (--iter), 25 by default. |
relion_tau2_fudge | Regularisation parameter T (--tau2_fudge); 2 is usual for 2D. |
relion_ptcl_diameter | Mask diameter in Å (--particle_diameter). A negative value takes 1.2 × spa_diameter; when that is unset, 0.95 × the smallest particle box. A mask that would not fit into the box is reduced to 0.95 × the box, with a warning. |
relion_psi_step | In-plane angular sampling in degrees (--psi_step). |
relion_offset_range, relion_offset_step | Translational search range and step in pixels of the stack (--offset_range, --offset_step). The boxes are centred already, so a small range suffices. |
relion_ctf | y adds --ctf. Leave it at n for particles from ptychographic reconstructions, whose images are not CTF-modulated. |
relion_mpi, relion_nthreads | MPI processes (1 = no MPI) and threads per process (--j). Their product should not exceed the CPU cores; with MPI, one process coordinates and the others work. |
relion_pool | Particles per thread at a time (--pool). |
relion_preread | y reads all particles into memory first (--preread_images). |
relion_use_scratch_dir | y copies the particles to the FAST_DISK of the Preferences first (--scratch_dir). |
relion_gpu, relion_gpu_numbers, relion_free_gpu_memory | n = CPU only; y = the GPUs of relion_gpu_numbers, a RELION device list such as 0:1 (--gpu 0:1); * = all GPUs (--gpu). A device list written into relion_gpu itself, as older projects have it, still selects those GPUs. The memory to leave free per GPU in MB. Needs a RELION built with CUDA (not available on macOS). |
relion_extra | Further options passed to relion_refine as typed, e.g. --center_classes. |
KV, CS, phacon | Voltage, Cs and phase-contrast portion for the STAR file. A voltage or Cs left at ScriptWillPutNumberHere is replaced by the Preferences' default and written back to the project. |
Algorithm
- Run directory. Every run writes into the next directory after the runs already in
<dataset_dir>/Class2D_RealTime/:run_001/for the first one, thenrun_002/, and so on, also across separate launches. Earlier runs are kept. The first run of a series (run_iteration_number1, or a single run) clears the results list; a later run adds to the results of the runs before it. - Image list. All
spa_particles.starfiles of the project, or withrelion_work_on_all = nthelast_imgsnewest ones, as<group>/<image>, go toall_images.txt(orlast<N>.txt) in the run directory. The STAR fileparticles_all.star(orparticles_last<N>.star) is made from them by the same generator as the dataset STAR file: one optics group per image, the stacks linked intoParticles/. Both files are listed as results straight away. - Mask. The mask diameter is settled as described for
relion_ptcl_diameter, against the smallest particle box in the STAR file. - References. With
relion_continue_from_earlierresults = yand earlier runs present, the classes of the last iteration completed by the newest earlier run that completed one (itsrun_itNNN_model.star; an iteration is complete once RELION has written its_sampling.star) are the references (--ref) — RELION takes the number of classes from them. A run that stopped before its first iteration is passed over. If no earlier run left classes, or they are a different number thanrelion_kasks for, the run starts from scratch with--K relion_k, and says so. Withn, the first run of a launch starts from scratch, and a relaunched run looks only at the run just before it. - RELION.
relion_refine(ormpirun -np relion_mpi relion_refine_mpi) runs with the parameters above and--dont_combine_weights_via_disc --flatten_solvent --zero_mask --oversampling 1 --norm --scale. The full command is printed in the log; RELION's own output goes torun_output.txtin the run directory. - While it runs, the script checks every second for iterations RELION has completed. For each one it tiles the class averages into a single image (
run_itNNN_classes-tiled.mrc, a square grid of √K × √K panels, byproc/4d/4d_tile_mrcs.py) and lists it as an important result, together with the stack of averages (…_classes.mrcs) and the model (…_model.star). The progress bar advances by iteration and the GUI re-reads the results, so the newest averages appear in the File Preview as soon as they exist. - If RELION stops with an error, the last lines of its output are shown and the run fails.
Results
File (in run_00n/) | What it is |
|---|---|
all_images.txt or last<N>.txt | The images of this run, newest first. |
particles_all.star or particles_last<N>.star, Particles/ | Their particles, RELION 3.1+ STAR file and links to the stacks. |
run_itNNN_classes-tiled.mrc | The class averages of iteration NNN, tiled — a 2D image for the File Preview. Marked important. |
run_itNNN_classes.mrcs, run_itNNN_model.star, run_itNNN_data.star, … | RELION's files of the iteration. The 3D step reads the model.star and data.star of the last iteration. |
run_output.txt | RELION's own output. |