Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 

Repository files navigation

Cryo-ET Template Matching Analysis Tools

A suite of Python utilities for analyzing template matching results and particle distributions in cryo-electron tomography (cryo-ET) data.

Overview

This toolkit provides two complementary analysis workflows:

  1. Cutoff Determination (gaussian_inside_density_cutoff.py): Statistically determine optimal cross-correlation (CC) score thresholds for particle picking using a binary mask
  2. Spatial Analysis (nearest_neighbor.py): Analyze spatial distribution patterns of picked particles

Tools

1. Gaussian-Based Cutoff Determination

Analyzes template matching score maps to determine an optimal threshold for particle selection using Gaussian distribution fitting.

Features

  • 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

Usage

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.png

2. Nearest Neighbor Spatial Analysis

Analyzes the spatial distribution of particles using RELION5 STAR files.

Features

  • 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:

  • rlnTomoName
  • rlnCenteredCoordinateXAngst
  • rlnCenteredCoordinateYAngst
  • rlnCenteredCoordinateZAngst

Requirements

pip install numpy scipy matplotlib mrcfile starfile

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages