Skip to main content

PyTOM's GPU template matching module as an independent package

Project description

test-badge DOI

pytom-match-pick

GPU-accelerated template matching for cryo-electron tomography, originally developed in PyTom, as a standalone Python package that is run from the command line.

This software is developed by Marten L. Chaillet (@McHaillet) and Sander Roet (@sroet) in the group of Friedrich Förster at Utrecht University.

cover_image

Requires

miniconda3
nvidia-cuda-toolkit

Installation

There are 2 options for creating a conda environment. We recommend option (1) which will later allow cupy to build against a system installed cuda-toolkit. Compared to option (2) this can give an almost two-fold speedup:

  1. (recommended) Create a new python 3 environment:

    conda create -n pytom_tm python=3
    
  2. Create a new environment with a prebuild cupy version and complete CUDA-toolkit. This is more reliable, but takes more disk space and has less optimal performance.

    conda create -n pytom_tm -c conda-forge python=3 cupy cuda-version=11.8
    

Once the environment is created, activate it:

conda activate pytom_tm

Then install the code with pip (building cupy can take a while!):

python -m pip install pytom-match-pick[plotting]

The installation above also adds the optional dependencies [matplotlib, seaborn] which are required to run pytom_estimate_roc.py. They are not essential to the core template matching functionality, so for some systems (such as certain cluster environments) it might be desirable to skip them. In that case remove [plotting] from the pip install command:

python -m pip install pytom-match-pick

Cupy warning

Having issues running the software? If cupy is not correctly installed,

python -c "import pytom_tm"

can show a cupy warning. If this is the case, this probably means cupy is not correctly installed. Alternatively, cupy can sometimes be installed without issue but not detect CUDA correctly. In that case, the following should raise some errors:

python -c "import cupy as cp; a = cp.zeros((100,100))"

To solve cupy installation issues, please check the cupy docs. It might be solved by installing a specific build compatible with the installed cuda toolkit.

Usage

The following scripts are available to run with --help to see parameters:

  • create a template from an mrc file containing a density map: pytom_create_template.py --help
  • create a mask for template matching: pytom_create_mask.py --help
  • run template matching with the mask (.mrc) and template (.mrc) on a tomogram (.mrc): pytom_match_template.py --help
  • extract candidates from a job file (.json) created in the template matching output folder: pytom_extract_candidate.py --help
  • estimate an ROC curve from a job file (.json): pytom_estimate_roc.py --help
  • merge multiple star files to a single starfile: pytom_merge_stars.py --help

Detailed usage instructions and a tutorial are available on our site.

Usage questions, ideas and solutions, engagement, etc

Please use our github discussions for:

  • Asking questions about bottlenecks.
  • Share ideas and solutions.
  • Engage with other community members about processing strategies.
  • etc...

Developer install

If you want the most up-to-date version of the code you can get install it from this repository via:

git clone https://github.com/SBC-Utrecht/pytom-match-pick.git
cd pytom-match-pick
python -m pip install '.[all]'

if you don't want the optional plotting dependencies use the following install command instead:

python -m pip install '.[dev]'

For development, please also install pre-commit to check and autostyle the code before you make PRs:

pre-commit install

This uses Ruff to check and format whenever you make commits.

If you update anything in the (documentation) docs/ folder make sure to test build the website locally:

mkdocs serve

Tests

With the developer install also comes the ability to run the unittests, from the git repository run:

cd tests
python -m unittest discover

Contributing

Contributions to the project are very welcome! Feel free to make a pull request or suggest an implementation in the issues. For PR's we will gladly give you feedback on how to integrate the code.

Citations

Chaillet, M. L., Roet, S., Veltkamp, R. C., & Förster, F. (2025). pytom-match-pick: A tophat-transform constraint for automated classification in template matching. Journal of Structural Biology: X, 11, 100125. https://doi.org/10.1016/j.yjsbx.2025.100125

Chaillet, M. L., van der Schot, G., Gubins, I., Roet, S., Veltkamp, R. C., & Förster, F. (2023). Extensive angular sampling enables the sensitive localization of macromolecules in electron tomograms. International Journal of Molecular Sciences, 24(17), 13375. https://doi.org/10.3390/ijms241713375

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytom_match_pick-0.12.1.tar.gz (101.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytom_match_pick-0.12.1-py3-none-any.whl (79.3 kB view details)

Uploaded Python 3

File details

Details for the file pytom_match_pick-0.12.1.tar.gz.

File metadata

  • Download URL: pytom_match_pick-0.12.1.tar.gz
  • Upload date:
  • Size: 101.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytom_match_pick-0.12.1.tar.gz
Algorithm Hash digest
SHA256 270a09d4dbad5eeec9c283029671b9cf10a66523e2b718e37ed1c1db00fc187f
MD5 bbb9ee3df22bb9d039e4d34e43d20f7d
BLAKE2b-256 f57870d02cb0b25aa7aca547888bd14aa6aa96ee4165d50070b1195cb055fe41

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytom_match_pick-0.12.1.tar.gz:

Publisher: do-release.yml on SBC-Utrecht/pytom-match-pick

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytom_match_pick-0.12.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytom_match_pick-0.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd26a4c5dea15523b146d5e092f3a0692c39f28cb2f24ebb5e8af9972631aa3c
MD5 30d9d653c175c2ce3590e65b4115979e
BLAKE2b-256 23c1176b09bc87aaa2fa99727d1118d5fb18bda759237a7b468930f4f57132fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytom_match_pick-0.12.1-py3-none-any.whl:

Publisher: do-release.yml on SBC-Utrecht/pytom-match-pick

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page