refactored StrataMap pre-processing code - #317
Open
cornhundred wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review and Refactor Summary — IST → StrataMap Preprocessing Script
Renamed IST → StrataMap (full rename)
IST_Landscape_Pre-process.py→StrataMap_Landscape_Pre-process.py"technology"value written intolandscape_parameters.jsonupdatedtechnology=arguments passed todega.prefunctions updateddescription=updatedBroke up
main()into smaller functionsPreviously one ~350-line function; now split into named steps:
_process_image_process_cell_segmentation_process_gene_metadata_save_landscape_parameters_save_dummy_meta_cluster_process_cbg_process_transcripts_safe_polygon,_simple_format,_transform_polygon,_tile_grid_shape,_load_prep_statsmain()now just calls these in the original order — behavior is unchanged.Reused existing code instead of duplicating
make_column_names_unique_fastwas defined almost identically in both this file andrun_pre_processing.py.landscape.pyasmake_column_names_unique, exported viadega.pre, and updated both call sites (removing the now-unused local copy and itsdefaultdictimport inrun_pre_processing.py)._get_name_mapping,read_cbg_mtx,save_cbg_gene_parquets,write_pseudotranscripts_from_sbg, etc.) already reused shareddega.precode.Expanded_5um_cell_contour_coords.csvpolygon format, barcode-encoded transcript coordinates) as-is — it genuinely isn't shared with the Xenium/MERSCOPE path inboundary_tile.py/trx_tile.py, and forcing a cross-technology abstraction there would be a riskier, larger change.Bugs/cleanup fixed while touching the file
--tile_size,--image_scale,--jitterhad nodefault=, so omitting them on the command line silently passedNoneintomain(), overriding its real defaults (500 / 1.0 / 1) and breaking tile-grid arithmetic. Added matching defaults.--data_dir/--sample/--path_landscape_filesweren't markedrequired=True, so omitting them produced a confusingNone-pathFileNotFoundErrorinstead of a clear argparse error.scipy.sparse.coo_matrix,pathlib.Path).Verification
py_compilepasses on all touched filesruff checkclean on the shared modulesgit mvused to preserve file historytests/unit/test_presuite (26 tests) still passes