|
| 1 | +""" |
| 2 | +Legacy Preprocessing Pipeline |
| 3 | +============================= |
| 4 | +
|
| 5 | +This notebook demonstrates reproducing preprocessing results from the |
| 6 | +legacy ASPIRE MATLAB workflow system for the EMPIAR 10028 ribosome |
| 7 | +dataset. |
| 8 | +
|
| 9 | +https://www.ebi.ac.uk/empiar/EMPIAR-10028 |
| 10 | +""" |
| 11 | + |
| 12 | +# %% |
| 13 | +# Source data and Preprocessing |
| 14 | +# ----------------------------- |
| 15 | +# |
| 16 | +# Load the data and apply preprocessing steps corresponding to the MATLAB prompts: |
| 17 | +# |
| 18 | +# >>> Phaseflip projections? (Y/N)? [Y] Y |
| 19 | +# >>> Enter pixel size in Angstrom (-1 to read from STAR file): [-1.000000] |
| 20 | +# >>> Number of projections to read? [105247] |
| 21 | +# >>> Crop? (Y/N)? [Y] Y |
| 22 | +# >>> Crop to size? [360]359 |
| 23 | +# >>> Downsample? (Y/N)? [Y] Y |
| 24 | +# >>> Downsample to size? [360]179 |
| 25 | +# >>> Normalize background of images to variance 1? (Y/N)? [Y] |
| 26 | +# >>> Prewhiten? (Y/N)? [Y] |
| 27 | +# >>> Split data into groups? (Y/N)? [Y] N |
| 28 | + |
| 29 | +from aspire.source import RelionSource |
| 30 | + |
| 31 | +# Inputs |
| 32 | +# Note the published ``shiny_2sets.star`` requires removal of a stray '9' character on line 5476. |
| 33 | +starfile_in = "10028/data/shiny_2sets_fixed9.star" |
| 34 | +# Caching, while not required, will increase speed in exchange for potentially increased memory usage. |
| 35 | +src = RelionSource(starfile_in).cache() |
| 36 | + |
| 37 | +# Define preprocessing steps. |
| 38 | +src = src.phase_flip().cache() |
| 39 | +src = src.crop_pad(359).cache() |
| 40 | +src = src.legacy_downsample(179).cache() |
| 41 | +src = src.legacy_normalize_background().cache() |
| 42 | +src = src.legacy_whiten().cache() |
| 43 | +src = src.invert_contrast().cache() |
| 44 | + |
| 45 | +# Save the preprocessed images. |
| 46 | +# `save_mode=single` will save a STAR file and single mrcs holding the image stack. |
| 47 | +src.save("10028_legacy_preprocessed_179px.star", save_mode="single", overwrite=True) |
0 commit comments