Location & Orientation of Particles using Two-Dimensional Template Matching
Project description
Leopard-EM: Python based template matching
Leopard-EM (Location & oriEntatiOn of PARticles found using two-Dimensional tEmplate Matching) is a python package for running two-dimensional template matching (2DTM) on cryo-EM images.
Basic Installation
The newest released version of the package can be installed from PyPI using pip:
pip install leopard-em
Usage
Template Matching
Inputs to the template matching programs can be configured with Pydantic models (see online documentation for examples and use cases).
Alternatively, configurations can be set in YAML files and loaded into the MatchTemplateManager object.
The example YAML configuration file acts as a template for configuring your own runs.
Once configured with the proper paths, parameters, etc., the program can run as follows:
from leopard_em.pydantic_models import MatchTemplateManager
YAML_CONFIG_PATH = "path/to/mt_config.yaml"
ORIENTATION_BATCH_SIZE = 8
def main():
mt_manager = MatchTemplateManager.from_yaml(YAML_CONFIG_PATH)
mt_manager.run_match_template(ORIENTATION_BATCH_SIZE)
df = mt_manager.results_to_dataframe()
df.to_csv("/path/to/results.csv")
# NOTE: invoking from `if __name__ == "__main__"` is necessary
# for proper multiprocessing/GPU-distribution behavior
if __name__ == "__main__":
main()
Template Refinement
Particle orientations and locations can be refined using the RefineTemplateManager objects after a template matching run.
The RefineTemplateManager is similarly a set of Pydantic models capable of configuration via YAML files.
The example YAML configuration file acts as a template for configuring your own runs.
Once configured with the proper paths, parameters, etc., the program can run as follows:
from leopard_em.pydantic_models import RefineTemplateManager
YAML_PATH = "/path/to/rt_config.yaml"
ORIENTATION_BATCH_SIZE = 80
def main():
rt_manager = RefineTemplateManager.from_yaml(YAML_PATH)
rt_manager.run_refine_template(
output_dataframe_path="/path/to/refined_results.csv",
orientation_batch_size=ORIENTATION_BATCH_SIZE,
)
if __name__ == "__main__":
main()
Installation for Development
The package can be installed from source in editable mode with the optional development libraries via pip.
git clone https://github.com/Lucaslab-Berkeley/Leopard-EM.git
cd Leopard-EM
pip install -e '.[dev,test, docs]'
Further information on development and contributing to the repo can be found in our online documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leopard_em-0.0.4a0.tar.gz.
File metadata
- Download URL: leopard_em-0.0.4a0.tar.gz
- Upload date:
- Size: 76.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7baa8143ac828ad91028666fc5bdfb4ba917af34562516070d2c79d4eff217e6
|
|
| MD5 |
3fa7a8e14b057f5d9e4bb99d31c3e009
|
|
| BLAKE2b-256 |
8a9b146b744f5d5add690b48c4deb7a863af0468f07356fbd9682fb70e3fef65
|
Provenance
The following attestation bundles were made for leopard_em-0.0.4a0.tar.gz:
Publisher:
python-publish.yml on Lucaslab-Berkeley/Leopard-EM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leopard_em-0.0.4a0.tar.gz -
Subject digest:
7baa8143ac828ad91028666fc5bdfb4ba917af34562516070d2c79d4eff217e6 - Sigstore transparency entry: 187258002
- Sigstore integration time:
-
Permalink:
Lucaslab-Berkeley/Leopard-EM@010b6c9a5e06224a2b1043544f4db7a6c3f9b3ec -
Branch / Tag:
refs/tags/v0.0.4alpha - Owner: https://github.com/Lucaslab-Berkeley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@010b6c9a5e06224a2b1043544f4db7a6c3f9b3ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file leopard_em-0.0.4a0-py3-none-any.whl.
File metadata
- Download URL: leopard_em-0.0.4a0-py3-none-any.whl
- Upload date:
- Size: 63.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5a5b49e1ea9a4f69910e916e48d13774e9b2cba3340febc73c3b477cae92ef0
|
|
| MD5 |
f26052e5c45587ff08ec0b2348c26a6e
|
|
| BLAKE2b-256 |
9aa4531b1ac80eec91479d38799ae6ba4e86b79cb69246ba8479dab62f3b033f
|
Provenance
The following attestation bundles were made for leopard_em-0.0.4a0-py3-none-any.whl:
Publisher:
python-publish.yml on Lucaslab-Berkeley/Leopard-EM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leopard_em-0.0.4a0-py3-none-any.whl -
Subject digest:
a5a5b49e1ea9a4f69910e916e48d13774e9b2cba3340febc73c3b477cae92ef0 - Sigstore transparency entry: 187258009
- Sigstore integration time:
-
Permalink:
Lucaslab-Berkeley/Leopard-EM@010b6c9a5e06224a2b1043544f4db7a6c3f9b3ec -
Branch / Tag:
refs/tags/v0.0.4alpha - Owner: https://github.com/Lucaslab-Berkeley
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@010b6c9a5e06224a2b1043544f4db7a6c3f9b3ec -
Trigger Event:
push
-
Statement type: