A suite of Python utilities for analyzing template matching results and particle distributions in cryo-electron tomography (cryo-ET) data.
This toolkit provides two complementary analysis workflows:
- Cutoff Determination (
gaussian_inside_density_cutoff.py): Statistically determine optimal cross-correlation (CC) score thresholds for particle picking using a binary mask - Spatial Analysis (
nearest_neighbor.py): Analyze spatial distribution patterns of picked particles
Analyzes template matching score maps to determine an optimal threshold for particle selection using Gaussian distribution fitting.
- Identifies local maxima in 3D score maps
- Separates peaks into "inside" (true positives) and "outside" (background) populations using a tomogram mask
- Fits Gaussian distributions to both populations
- Calculates cutoff threshold: μ_inside - N×σ_inside
check with python gaussian_inside_density_cutoff.py -h
example:
python gaussian_inside_density_cutoff.py \
--score_file template_matching_scores.mrc \
--mask_file reference_mask.mrc \
--min_distance 28 \
--sigma_mult 2.0 \
--bins 100 \
--output cutoff_analysis.pngAnalyzes the spatial distribution of particles using RELION5 STAR files.
- Nearest neighbor distance distributions
- Kernel density estimation
- Neighbor counts within spherical distances
- Radial distribution function (RDF)
Note: Edit the following parameters directly in the script:
star_path = "path/to/particles.star" # Path to your STAR file
k_max = 8 # Number of nearest neighbors
xlim = (100, 300) # X-axis limits for distance plots (Å)
rdf_r_max = 800 # Max radius for RDF (Å)
rdf_dr = 20 # RDF bin width (Å)
radii_nm = [15, 20, 25, 30, 35, 40] # Radii for neighbor counts (nm)The script expects the following RELION5 columns in your STAR file:
rlnTomoNamerlnCenteredCoordinateXAngstrlnCenteredCoordinateYAngstrlnCenteredCoordinateZAngst
pip install numpy scipy matplotlib mrcfile starfileMIT