Skip to content

Commit f06446a

Browse files
committed
Rejection sampling. Integrative postprocessing. XML/Star support for ctf / tilt specification in match_template. GPL license. Streamlined analyzer and composable filters.
1 parent 32ca042 commit f06446a

63 files changed

Lines changed: 3217 additions & 1889 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/conf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@
6161
}
6262

6363
html_theme_options = {
64-
# "logo": {
65-
# "text": "pytme",
66-
# "image_light": "_static/index_api.svg",
67-
# "image_dark": "_static/index_api.svg",
68-
# },
64+
"logo": {
65+
"text": "pytme",
66+
},
6967
"header_links_before_dropdown": 4,
7068
"icon_links": [
7169
{

doc/quickstart/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ User Guide
3333
postprocessing/motivation
3434
postprocessing/example
3535
postprocessing/summary
36-
integrations
3736

3837

3938
.. toctree::

doc/quickstart/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Installation
55

66
.. _installation-section:
77

8-
This section provides instructions on how to install |project|. We recommend creating an installation enviroment for a clean and isolated setup. Available options for different use cases are outlined in the tabs below.
8+
We recommend creating a virtual environment for a clean and isolated setup.
99

1010
.. tab-set::
1111

doc/quickstart/license.rst

Lines changed: 343 additions & 169 deletions
Large diffs are not rendered by default.

doc/quickstart/matching/cluster.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ The following subsections provide templates for the execution of |project| on di
1010

1111
.. note::
1212

13-
The ``estimate_ram_usage.py`` script computes an initial memory estimate on a given template matching case for clusters that require memory reservations.
13+
The ``estimate_memory_usage.py`` script computes an initial memory estimate on a given template matching case for clusters that require memory reservations.
1414

1515
.. code-block:: bash
1616
17-
estimate_ram_usage.py --help
17+
estimate_memory_usage.py --help
1818
1919
SLURM (EMBL)
2020
------------

doc/quickstart/postprocessing/example.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ The final orientations can be passed to ``postprocess.py`` via the ``--orientati
111111
112112
from tme import Orientations
113113
orientations = Orientations.from_file("orientations.tsv")
114-
orientations.to_file("orientations.star", name = "/path/to/your/tomogram")
114+
orientations.to_file(
115+
"orientations.star",
116+
source_path="/path/to/your/tomogram"
117+
)
115118
116119
117120
References

doc/quickstart/postprocessing/motivation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Motivation
55
==========
66

7-
Postprocessing identifies regions of high similarity from the template matching output, which we refer to as peaks. Each peak corresponds to an occurence of the template in the target, which is fully characterized by a translation and rotation vector. Identifying peaks is challenging by itself, hence |project| implements a variety of analysis strategies for optimal performance.
7+
Postprocessing identifies regions of high similarity from the template matching output, which we refer to as peaks. Each peak corresponds to an occurence of the template in the target, which is fully characterized by a translation and rotation matrix. Identifying peaks is challenging by itself, hence |project| implements a variety of analysis strategies for optimal performance.
88

99

1010
Background
@@ -18,14 +18,14 @@ Lets recall an example from the preprocessing section. The highest peak is locat
1818
import numpy as np
1919
import matplotlib.pyplot as plt
2020
import matplotlib.patches as patches
21-
from skimage.feature import match_template
2221

2322
from tme import Density
23+
from tme.cli import match_template
2424

2525
target = Density.from_file("../../_static/examples/preprocessing_target.png").data
2626
template = Density.from_file("../../_static/examples/preprocessing_template.png").data
2727

28-
result = match_template(target, template, pad_input=True)
28+
result = match_template(target, template)[0]
2929
ij = np.unravel_index(np.argmax(result), result.shape)
3030
x, y = ij[::-1]
3131

doc/quickstart/postprocessing/summary.rst

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,31 @@
44
Summary
55
=======
66

7-
The ``postprocess.py`` command-line tool can be used to analyze the results generated by ``match_template.py``.
7+
The ``postprocess.py`` tool analyzes results generated by ``match_template.py`` to identify and characterize top-scoring peaks from template matching.
88

99
.. code-block:: bash
1010
1111
postprocess.py --help
1212
13-
Top-scoring peaks can be identified using
13+
.. tip::
1414

15-
.. code-block:: bash
16-
17-
postprocess.py \
18-
--input_file output.pickle \
19-
--output_prefix output \
20-
--output_format orientations \
21-
--min_distance 30 \
22-
--min_boundary_distance 20 \
23-
--num_peaks 1000
24-
25-
Identifying no more than 1,000 top-scoring peaks that are separated by at least 20 voxel from each other and 30 voxel from the boundaries. Different peak calling strategies can be chosen from using the ``--peak_caller`` argument.
15+
From version 0.3.0 onwards, postprocessing supports advanced multi-input and background correction. Multiple input files can be specified to distinguish between different macromolecular species, with corresponding class identifiers made available in orientations and RELION output formats. Additionally, multiple background corrections can be applied simultaneously via ``--background_file``, enabling users to account for various noise sources beyond single backgrounds (e.g., from ``--scramble_phases``) and incorporate complex cellular environments such as membrane backgrounds.
2616

2717
Depending on the subequent use case, different ``output_format`` options are available and outlined below.
2818

2919
.. tab-set::
3020

3121
.. tab-item:: Orientations
3222

33-
A tab-separated file *output.tsv* will be created in the process containing eight columns. The z, y and x column correspond to the translation, the euler_z, euler_y and euler_x column to the rotation used to obtain the column score. The detail column contains peak caller specific information.
23+
A tab-separated file *output.tsv* will be created in the process containing eight columns. The x, y and z column correspond to the translation, the euler_x, euler_y and euler_z column to the rotation used to obtain the column score. The detail column contains peak caller specific information.
3424

3525
.. code-block:: bash
3626
3727
postprocess.py \
3828
--input_file output.pickle \
3929
--output_prefix output \
4030
--output_format orientations \
41-
--min_distance 30 \
31+
--mask_edges \
4232
--min_boundary_distance 20 \
4333
--num_peaks 1000
4434
@@ -52,7 +42,8 @@ Depending on the subequent use case, different ``output_format`` options are ava
5242
--input_file output.pickle \
5343
--output_prefix output \
5444
--output_format relion4 \
55-
--min_distance 20 \
45+
--mask_edges \
46+
--min_boundary_distance 20 \
5647
--num_peaks 1000
5748
5849
@@ -66,6 +57,8 @@ Depending on the subequent use case, different ``output_format`` options are ava
6657
--input_file output.pickle \
6758
--output_prefix output \
6859
--output_format alignment \
60+
--mask_edges \
61+
--min_boundary_distance 20 \
6962
--num_peaks 10
7063
7164
.. tab-item:: Extraction
@@ -78,9 +71,9 @@ Depending on the subequent use case, different ``output_format`` options are ava
7871
--input_file output.pickle \
7972
--output_prefix output \
8073
--output_format extraction \
81-
--min_distance 20 \
82-
--num_peaks 500 \
83-
--peak_caller PeakCallerMaximumFilter
74+
--mask_edges \
75+
--min_boundary_distance 20 \
76+
--num_peaks 100
8477
8578
.. tab-item:: Average
8679

@@ -92,13 +85,28 @@ Depending on the subequent use case, different ``output_format`` options are ava
9285
--input_file output.pickle \
9386
--output_prefix average \
9487
--output_format average \
95-
--min_distance 20 \
96-
--num_peaks 500 \
97-
--peak_caller PeakCallerMaximumFilter
88+
--mask_edges \
89+
--min_boundary_distance 20 \
90+
--num_peaks 100
91+
92+
93+
.. tab-item:: Pickle
94+
95+
The code below will apply background correction, and create a new pickle file containing the corrected scores. The output is intended for visual assessment of the normalization procedure, and can be reused for postprocessing.
96+
97+
.. code-block:: bash
98+
99+
postprocess.py \
100+
--input_file output.pickle \
101+
--output_prefix output_new \
102+
--output_format pickle \
103+
--background_file background1.pickle background2.pickle
98104
99105
.. note::
100106

101-
Orientations are following the conventions outlined in [1]_. We use a right-handed coordinate system with orthogonal X, Y and Z axes. Euler angles are expressed using intrinsic ZYZ convention, with the first rotation around the Z-axis, the second around the new Y-axis and the third around the new Z-axis (see :py:meth:`euler_to_rotationmatrix <tme.rotations.euler_to_rotationmatrix>`). The default orientation the z-unit vector (0, 0, 1).
107+
Orientations are following the conventions outlined in [1]_. We use a right-handed coordinate system with orthogonal X, Y and Z axes. Euler angles are expressed using intrinsic ZYZ convention, with the first rotation around the Z-axis, the second around the new Y-axis and the third around the new Z-axis (see :py:meth:`euler_to_rotationmatrix <tme.rotations.euler_to_rotationmatrix>`). The default orientation is the z-unit vector (0, 0, 1).
108+
109+
102110

103111

104112
References

0 commit comments

Comments
 (0)