{"id":17761044,"url":"https://github.com/brisvag/stemia","last_synced_at":"2025-03-15T10:31:03.315Z","repository":{"id":57471405,"uuid":"337664259","full_name":"brisvag/stemia","owner":"brisvag","description":"Scripts and Tools for Electron Microscopy Image Analysis.","archived":false,"fork":false,"pushed_at":"2024-10-08T13:12:48.000Z","size":223,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T00:06:11.646Z","etag":null,"topics":["electron-microscopy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brisvag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-10T08:42:21.000Z","updated_at":"2024-10-08T13:12:52.000Z","dependencies_parsed_at":"2023-12-11T14:42:27.600Z","dependency_job_id":"53fb5ee5-ed9b-4cb5-835a-a551c2839589","html_url":"https://github.com/brisvag/stemia","commit_stats":{"total_commits":130,"total_committers":1,"mean_commits":130.0,"dds":0.0,"last_synced_commit":"be86a71c2ddf0e001883edbfd6adfb9adeff0dcd"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brisvag%2Fstemia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brisvag%2Fstemia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brisvag%2Fstemia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brisvag%2Fstemia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brisvag","download_url":"https://codeload.github.com/brisvag/stemia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243718826,"owners_count":20336590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron-microscopy","python"],"created_at":"2024-10-26T19:17:51.475Z","updated_at":"2025-03-15T10:31:02.806Z","avatar_url":"https://github.com/brisvag.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STEMIA\n\n[![License](https://img.shields.io/pypi/l/stemia.svg?color=green)](https://github.com/brisvag/stemia/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/stemia.svg?color=green)](https://pypi.org/project/stemia)\n[![Python Version](https://img.shields.io/pypi/pyversions/stemia.svg?color=green)](https://python.org)\n\n**S**cripts and **T**ools for **E**lectron **M**icroscopy **I**mage **A**nalysis.\n\nThis is a simple personal collection of (sometimes...) useful scripts and tools for cryoem/cryoet.\n\n## Installation\n\n```bash\npip install stemia\n```\n\nYou can quickly list all the available tools with\n\n```\nstemia -l\n```\n\n## Completion\n\nYou can enable completion for your bash shell by running:\n\n```\neval \"$(_STEMIA_COMPLETE=bash_source stemia)\"\n```\n\nSee [the click docs](https://click.palletsprojects.com/en/8.1.x/shell-completion/#enabling-completion) for how to do it for other shells.\n\n\u003c!-- autogenerated content start here --\u003e\n\n## Tools\n\nEverything is accessible through the main command line interface `stemia`.\n\nTry `stemia -h` for help, or `stemia -l` for the command tree:\n\n```\n.stemia\n├── aretomo:  A collection of AreTomo-related tools and scripts.\n│   ├── aln2xf:  Convert AreTomo `aln` file to imod `xf` format.\n│   └── batch:  Run AreTomo on a full directory.\n├── cryosparc:  A collection of Cryosparc-related tools and scripts.\n│   ├── csplot:  Read a cryosparc job directory and plot interactively any column.\n│   ├── fix_filament_ids:  Replace cryosparc filament ids with small unique integers.\n│   ├── generate_tilt_angles:  Generate angle priors for a tilted dataset.\n│   ├── merge_defects_gainref:  Merge serialEM defects and gainref for cryosparc usage.\n│   └── time_wasted:  Print the total amount of time wasted on a project.\n├── image:  Simple image manipulation and processing.\n│   ├── center_filament:  Center an mrc image (stack) containing filament(s).\n│   ├── classify_densities:  Do hierarchical classification of particle stacks based on densities.\n│   ├── create_mask:  Create a mask for INPUT.\n│   ├── extract_z_snapshots:  Grab z slices at regular intervals from a tomogram as jpg images.\n│   ├── flip_z:  Flip the z axis for particles in a RELION star file.\n│   ├── fourier_crop:  Bin mrc images to the specified pixel size using fourier cropping.\n│   ├── project_profiles:  Project re-extracted and straightened membranes and get some stats.\n│   │   ├── prepare:  Generate and select 2D chunked projections for the input data.\n│   │   ├── compute:  Take the outputs from prepare and compute statistics and plots.\n│   │   └── aggregate:  Aggregate the generated data into general stats about given subsets.\n│   └── rescale:  Rescale an mrc image to the specified pixel size.\n├── imod:  A collection of IMOD-related tools and scripts.\n│   └── find_NAD_params:  Test a range of k and iteration values for nad_eed_3d.\n├── relion:  A collection of Relion-related tools and scripts.\n│   ├── align_filament_particles:  Fix filament PsiPriors so they are consistent within a filament.\n│   └── edit_star:  Simple search-replace utility for star files.\n└── warp:  A collection of Warp-related tools and scripts.\n    ├── fix_mdoc:  Fix mdoc files to point to the right data and follow warp format.\n    ├── offset_angle:  Offset tilt angles in warp xml files.\n    ├── parse_xml:  Parse a warp xml file and print its content.\n    ├── prepare_isonet:  Update an isonet starfile with preprocessing data from warp.\n    ├── spoof_mdoc:  Create dummy mdocs for warp.\n    ├── summarize:  Summarize the state of a Warp project.\n    └── preprocess_serialem:  Prepare and unpack data from sterialEM for Warp.\n```\n    \n### stemia aretomo aln2xf\n\n```\nUsage: stemia aretomo aln2xf [OPTIONS] ALN_FILE\n\n  Convert AreTomo `aln` file to imod `xf` format.\n\nOptions:\n  -f, --overwrite  overwrite existing output\n  --help           Show this message and exit.\n```\n\n### stemia aretomo batch\n\n```\nUsage: stemia aretomo batch [OPTIONS]\n\n  Run AreTomo on a full directory.\n\nOptions:\n  --help  Show this message and exit.\n```\n\n### stemia cryosparc csplot\n\n```\nUsage: stemia cryosparc csplot [OPTIONS] JOB_DIR\n\n  Read a cryosparc job directory and plot interactively any column.\n\n  All the related data from parent jobs will also be loaded. An interactive\n  ipython shell will be opened with data loaded into a pandas dataframe.\n\n  JOB_DIR:     a cryosparc job directory.\n\nOptions:\n  --drop-na         drop rows that contain NaN values (e.g: micrographs with\n                    no particles)\n  --no-particles    do not read particles data\n  --no-micrographs  do not read micrographs data\n  --help            Show this message and exit.\n```\n\n### stemia cryosparc fix_filament_ids\n\n```\nUsage: stemia cryosparc fix_filament_ids [OPTIONS] STAR_FILE\n\n  Replace cryosparc filament ids with small unique integers.\n\n  Relion will fail with cryosparc IDs because of overflows.\n\nOptions:\n  -o, --star-output FILE  where to put the updated version of the star file\n                          [default: \u003cSTAR_FILE\u003e_fixed_id.star]\n  -f, --overwrite         overwrite output if exists\n  --help                  Show this message and exit.\n```\n\n### stemia cryosparc generate_tilt_angles\n\n```\nUsage: stemia cryosparc generate_tilt_angles [OPTIONS] STAR_FILE TILT_ANGLE\n                                             TILT_AXIS\n\n  Generate angle priors for a tilted dataset.\n\n  Read a Relion STAR_FILE with in-plane angles and generate priors for rot and\n  tilt angles based on a TILT_ANGLE around a TILT_AXIS.\n\nOptions:\n  -r, --radians           Provide angles in radians instead of degrees\n  -o, --star-output FILE  where to put the updated version of the star file\n                          [default: \u003cSTAR_FILE\u003e_tilted.star]\n  -f, --overwrite         overwrite output if exists\n  --help                  Show this message and exit.\n```\n\n### stemia cryosparc merge_defects_gainref\n\n```\nUsage: stemia cryosparc merge_defects_gainref [OPTIONS] DEFECTS GAINREF\n\n  Merge serialEM defects and gainref for cryosparc usage.\n\n  requires active sbrgrid.\n\nOptions:\n  -d, --output-defects FILE\n  -o, --output-gainref FILE\n  -f, --overwrite            overwrite output if exists\n  --help                     Show this message and exit.\n```\n\n### stemia cryosparc time_wasted\n\n```\nUsage: stemia cryosparc time_wasted [OPTIONS] [PROJECT_DIRS]...\n\n  Print the total amount of time wasted on a project.\n\nOptions:\n  -u, --useful_jobs TEXT  ID of job that gave useful results. Its running time\n                          and that of its parents will be used to calculate\n                          useful time. Can be passed multiple times.\n  --help                  Show this message and exit.\n```\n\n### stemia image center_filament\n\n```\nUsage: stemia image center_filament [OPTIONS] INPUT [OUTPUT]\n\n  Center an mrc image (stack) containing filament(s).\n\n  Can update particles in a RELION .star file accordingly. If OUTPUT is not\n  given, default to INPUT_centered.mrc\n\nOptions:\n  -s, --update-star FILE        a RELION .star file to update with new\n                                particle positions\n  -o, --star-output FILE        where to put the updated version of the star\n                                file. Only used if -s is passed [default:\n                                STARFILE_centered.star]\n  --update-by [class|particle]  whether to update particle positions by\n                                classes or 1 by 1. Only used if -s is passed\n                                [default: class]\n  -f, --overwrite               overwrite output if exists\n  -n, --n-filaments INTEGER     number of filaments on the image  [default: 2]\n  -p, --percentile INTEGER      percentile for binarisation  [default: 85]\n  --help                        Show this message and exit.\n```\n\n### stemia image classify_densities\n\n```\nUsage: stemia image classify_densities [OPTIONS] [STACKS]...\n\n  Do hierarchical classification of particle stacks based on densities.\n\nOptions:\n  -c, --max-classes INTEGER\n  --help                     Show this message and exit.\n```\n\n### stemia image create_mask\n\n```\nUsage: stemia image create_mask [OPTIONS] INPUT OUTPUT\n\n  Create a mask for INPUT.\n\n  Axis order is zyx!\n\nOptions:\n  -t, --mask-type [sphere|cylinder|threshold]\n  -c, --center TEXT               center of the mask (comma-separated floats)\n  -a, --axis INTEGER              main symmetry axis (for cylinder)\n  -r, --radius FLOAT              radius of the mask. If thresholding,\n                                  equivalent to \"hard padding\"  [required]\n  -i, --inner-radius FLOAT        inner radius of the mask (if any)\n  -p, --padding FLOAT             smooth padding\n  --ang / --px                    whether the radius and padding are in\n                                  angstrom or pixels\n  --threshold FLOAT               threshold for binarization of the input map\n  -f, --overwrite                 overwrite output if exists\n  --help                          Show this message and exit.\n```\n\n### stemia image extract_z_snapshots\n\n```\nUsage: stemia image extract_z_snapshots [OPTIONS] [INPUTS]...\n\n  Grab z slices at regular intervals from a tomogram as jpg images.\n\n  INPUTS: any number of paths of volume images\n\nOptions:\n  -o, --output-dir PATH\n  --mrc                   also output mrc files\n  -n, --n-slices INTEGER  number of equidistant slices to extract\n  --keep-extrema          whether to keep slices at z=0 and z=-1 (if false,\n                          slices is reduced by 2)\n  -a, --average INTEGER   number of slices to average over\n  -s, --size TEXT         size of final image (X,Y)\n  -r, --range TEXT        range of slices to image (A,B)\n  --axis INTEGER          axis along which to do the slicing\n  --help                  Show this message and exit.\n```\n\n### stemia image flip_z\n\n```\nUsage: stemia image flip_z [OPTIONS] STAR_PATH\n\n  Flip the z axis for particles in a RELION star file.\n\n  STAR_PATH: star file to flip along z\n\n  Assumes all tomograms have the same shape.\n\nOptions:\n  -o, --output FILE\n  -m, --mrc_path FILE\n  --star_pixel_size FLOAT\n  --mrc_pixel_size FLOAT\n  --z_shape INTEGER\n  --help                   Show this message and exit.\n```\n\n### stemia image fourier_crop\n\n```\nUsage: stemia image fourier_crop [OPTIONS] [INPUTS]...\n\n  Bin mrc images to the specified pixel size using fourier cropping.\n\nOptions:\n  -b, --binning FLOAT  binning amount  [required]\n  -f, --overwrite      overwrite output if exists\n  --help               Show this message and exit.\n```\n\n### stemia image project_profiles prepare\n\n```\nUsage: stemia image project_profiles prepare [OPTIONS] [PATHS]...\n\n  Generate and select 2D chunked projections for the input data.\n\nOptions:\n  -o, --output PATH         [required]\n  -s, --chunk-size INTEGER\n  -f, --overwrite\n  --help                    Show this message and exit.\n```\n\n### stemia image project_profiles compute\n\n```\nUsage: stemia image project_profiles compute [OPTIONS] PROJ_DIR\n\n  Take the outputs from prepare and compute statistics and plots.\n\nOptions:\n  -f, --overwrite\n  --help           Show this message and exit.\n```\n\n### stemia image project_profiles aggregate\n\n```\nUsage: stemia image project_profiles aggregate [OPTIONS] [INPUTS]...\n\n  Aggregate the generated data into general stats about given subsets.\n\n  Inputs are subdirectories of the project_dir from compute.\n\nOptions:\n  -o, --output-name TEXT  Title/filename given to the aggregated outputs.\n  --help                  Show this message and exit.\n```\n\n### stemia image rescale\n\n```\nUsage: stemia image rescale [OPTIONS] INPUT OUTPUT TARGET_PIXEL_SIZE\n\n  Rescale an mrc image to the specified pixel size.\n\n  TARGET_PIXEL_SIZE: target pixel size in Angstrom\n\nOptions:\n  --input-pixel-size FLOAT  force input pizel size and ignore mrc header\n  -f, --overwrite           overwrite output if exists\n  --help                    Show this message and exit.\n```\n\n### stemia imod find_NAD_params\n\n```\nUsage: stemia imod find_NAD_params [OPTIONS] INPUT\n\n  Test a range of k and iteration values for nad_eed_3d.\n\nOptions:\n  -k, --k-values TEXT\n  -i, --iterations TEXT\n  -s, --std TEXT\n  --help                 Show this message and exit.\n```\n\n### stemia relion align_filament_particles\n\n```\nUsage: stemia relion align_filament_particles [OPTIONS] STAR_FILE\n\n  Fix filament PsiPriors so they are consistent within a filament.\n\n  Read a Relion STAR_FILE with in-plane angles and filament info and flip any\n  particle that's not consistent with the rest of the filament.\n\n  If a consensus cannot be reached, or the filament has too few particles,\n  discard the whole filament.\n\nOptions:\n  -o, --star-output FILE          where to put the updated version of the star\n                                  file [default: \u003cSTAR_FILE\u003e_aligned.star]\n  -t, --tolerance FLOAT           angle in degrees within which neighbouring\n                                  particles are considered aligned\n  -c, --consensus-threshold FLOAT\n                                  require an angle consensus at least higher\n                                  than this to use a filament.\n  -d, --drop-below INTEGER        drop filaments if they have fewer than this\n                                  number of particles\n  -r, --rotate-bad-particles      rotate bad particles to match the rest of\n                                  the filament\n  -f, --overwrite                 overwrite output if exists\n  --help                          Show this message and exit.\n```\n\n### stemia relion edit_star\n\n```\nUsage: stemia relion edit_star [OPTIONS] [STAR_FILES]...\n\n  Simple search-replace utility for star files.\n\n  Full regex functionality works (e.g: reusing groups in output)\n\nOptions:\n  -s, --suffix-output TEXT  suffix added to the output files before extension\n  -c, --column TEXT         column(s) to modify\n  -i, --regex-in TEXT       regex sed-like search pattern(s)\n  -o, --regex-out TEXT      regex sed-like substitution to apply to the\n                            column(s)\n  -f, --overwrite           overwrite output if exists\n  --help                    Show this message and exit.\n```\n\n### stemia warp fix_mdoc\n\n```\nUsage: stemia warp fix_mdoc [OPTIONS] MDOC_DIR\n\n  Fix mdoc files to point to the right data and follow warp format.\n\nOptions:\n  -d, --data-dir PATH\n  --dates              fix date format\n  --paths              fix image paths\n  --help               Show this message and exit.\n```\n\n### stemia warp offset_angle\n\n```\nUsage: stemia warp offset_angle [OPTIONS] [WARP_DIR]\n\n  Offset tilt angles in warp xml files.\n\nOptions:\n  --help  Show this message and exit.\n```\n\n### stemia warp parse_xml\n\n```\nUsage: stemia warp parse_xml [OPTIONS] XML_FILE\n\n  Parse a warp xml file and print its content.\n\nOptions:\n  --help  Show this message and exit.\n```\n\n### stemia warp prepare_isonet\n\n```\nUsage: stemia warp prepare_isonet [OPTIONS] WARP_DIR ISO_STAR\n\n  Update an isonet starfile with preprocessing data from warp.\n\nOptions:\n  --help  Show this message and exit.\n```\n\n### stemia warp spoof_mdoc\n\n```\nUsage: stemia warp spoof_mdoc [OPTIONS] [RAWTLT_FILES]...\n\n  Create dummy mdocs for warp.\n\n  RAWTLT_FILES: simple file with one tilt angle per line. Order should match\n  sorted filenames.\n\nOptions:\n  -d, --dose-per-image FLOAT  electron dose per tilt image (or per frame if\n                              inputs are movies)  [required]\n  -p, --pixel-size FLOAT\n  -e, --extension [tif|mrc]\n  -f, --overwrite\n  --help                      Show this message and exit.\n```\n\n### stemia warp summarize\n\n```\nUsage: stemia warp summarize [OPTIONS] [WARP_DIR]\n\n  Summarize the state of a Warp project.\n\n  Reports for each tilt series: - discarded: number of discarded tilts -\n  total: total number oftilts in raw data - stacked: number of image slices in\n  imod output directory - mismatch: whether stacked != (total - discarded) -\n  resolution: estimated resolution if processed\n\nOptions:\n  --help  Show this message and exit.\n```\n\n### stemia warp preprocess_serialem\n\n```\nUsage: stemia warp preprocess_serialem [OPTIONS] RAW_DATA_DIR\n\n  Prepare and unpack data from sterialEM for Warp.\n\n  You must be in a new directory for this to work; new files will be placed\n  there with the same name as the original tifs.\n\n  RAW_DATA_DIR: the directory containing the raw data\n\nOptions:\n  --help  Show this message and exit.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrisvag%2Fstemia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrisvag%2Fstemia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrisvag%2Fstemia/lists"}