Feat/export cli#66
Open
EliHei2 wants to merge 7 commits into
Open
Conversation
…pers Promote src/segger/utils.py -> src/segger/utils/ package: _logging.py keeps setup_logging/MemFilter (re-exported from __init__), and optional_deps.py adds lazy import + availability helpers for spatialdata/sopa/rapids. pyproject: add rtree dep and the spatialdata/sopa optional extras. Base for the export stack.
export/__init__.py (PEP-562 lazy submodule loader) and output_formats.py (OutputFormat enum + writer registry/get_writer). No writers registered yet.
export/boundary.py: BoundaryIdentification (Delaunay + edge pruning + cycle detection) and parallel generate_boundaries(); extract_largest_polygon.
export/xenium_import.py: write Baysor-style segmentation.csv + viz polygons + cell GeoJSON and the import-segmentation command (10x's current recommended path; output opens in Xenium Explorer).
export/merged_writer.py (join predictions back onto transcripts) and utils/fragment_outputs.py (fragment/cell/unassigned classification helpers).
export/anndata_writer.py: build_anndata_table + AnnDataWriter producing a cell x gene .h5ad from the segmentation (cells / fragments split).
cli/export.py: `segger export` dispatching xenium / merged / anndata / spatialdata, with cell-id alias resolution and keep-column recompute; register in cli/main.py.
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.
feat(export): segger export CLI — get segmentations into the tools people actually use
Motivation : A segger run produces a segger_segmentation.parquet — but that would need post processing to get the transcirpt metadata and make cell table, make polygons for vis etc. this is to get that parquet file into Xenium
Explorer, anndata, +metadata .parquet, or spaitaldata (sopa specs).
Specifics: segger export reads a segmentation result and emits it in four formats:
import-segmentation, and prints the exact command to run next.
Vis: multi-core Delaunay cell-boundary generation from assigned transcripts (or reuse the platform's own
boundaries), and export-time re-thresholding so you can tune the assignment cutoff without re-running
segmentation.
Usage
`segger export -s <segmentation.parquet> -i -o [--format ...]
Key flags:
Cell-ID column
auto-resolves across segger_cell_id/seg_cell_id/cell_id; spatialdata degrades gracefully if the extra isn't
installed.
Implementation
7 focused commits, ~one per module, reviewable in order:
Heavy/optional deps (spatialdata, anndata) are imported lazily so the base install stays light. Covered by
tests/test_export_cli.py and tests/test_export_xenium_import.py.