Open huwjenkins opened 3 months ago
As mentioned on CCPEM mailing list, if the particle star file contains more group_ids than the run_model.star
file referenced in the run_optimiser.star
file then opt.mymodel.scale_correction[group_id]
eventually becomes undefined.
To demonstrate I made 100 copies of the first particle and incremented rlnMicrographName
from MotionCorr/job002/Movies/20170629_00001_frameImage.mrc
to
MotionCorr/job002/Movies/20170629_00100_frameImage.mrc
.
Some of the subtracted particles then have nonsense pixel values:
$ relion_image_handler --i Subtract/job038/particles_subtracted.star --stats
NOTE: the input (--i) is a STAR file but the output (--o) does not have .mrcs extension. The output is treated as a suffix, not a path.
000001@Subtract/job038/Particles/sub... ; avg= 0.00442051 stddev= 0.989596 minval= -4.48153 maxval= 3.99965; angpix = 1.24484
...
000071@Subtract/job038/Particles/sub... ; avg= 4.81034e-05 stddev= 0.990762 minval= -4.52113 maxval= 4.00155; angpix = 1.24484
000072@Subtract/job038/Particles/sub... ; avg= nan stddev= -nan minval= 1.79769e+308 maxval= -1.79769e+308; angpix = 1.24484
000073@Subtract/job038/Particles/sub... ; avg= nan stddev= -nan minval= 1.79769e+308 maxval= -1.79769e+308; angpix = 1.24484
000074@Subtract/job038/Particles/sub... ; avg= 4.81034e-05 stddev= 0.990762 minval= -4.52113 maxval= 4.00155; angpix = 1.24484
Thank you very much for your report. Indeed this is a bug but I myself do not have time to fix this. I am happy to review a pull request if someone sends one.
There is a bug in
relion_particle_subtract
when the optional particle star file supplied with the--data
option contains particles from fewer micrographs than therun_model.star
referenced from therun_optimiser.star
star file supplied with--i
.rlnGroupNumber
is reset based on the contents of the--data
star file and theserlnGroupNumber
s are used to select the scale factor from therun_model.star
file referenced in therun_optimiser.star
file:https://github.com/3dem/relion/blob/b978db95709703a2798aca79402019152861603c/src/particle_subtractor.cpp#L742-L750
To demonstrate I made particle star files from
Refine3D/job029/run_data.star
from the tutorial data (relion50_tutorial_precalculated_results.tar.gz
). These files are here: relion_particle_subtract_bug.tar.gzselected_particles.star
contains 1 particle from every micrograph except that corresponding torlnGroupNumber
2 which has 3 particles.selected_particles_no_rlnGroupNumber_2.star
is that file with all particles fromrlnGroupNumber
2 removed.To make it clearer to visualise I also modified
run_model.star
to setrlnGroupScaleCorrection
forrlnGroupNumber
2 to an extreme value:Running
relion_particle_subtract
withselected_particles.star
:produces subtracted particles where the 2nd, 3rd and 4th particle have crazy stats as expected (output shortened to make it easier to read):
However, running the same command with
selected_particles_no_rlnGroupNumber_2.star
:produces subtracted particles where only the 2nd particle has crazy stats and all subsequent particles have different stats from the previous example (again output shortened to make it easier to read):
To further confirm running the command:
confirms
rlnGroupNumber
corresponds to different micrographs in the 2 files:Subtract/job036/particles_subtracted.star
:Subtract/job037/particles_subtracted.star
:This probably doesn't have much effect as the
rlnGroupScaleCorrection
values are often close to 1 but it is incorrect. The relevant code seems to be here:https://github.com/3dem/relion/blob/b978db95709703a2798aca79402019152861603c/src/exp_model.cpp#L954-L958