Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added first simple version of CLI script. #72

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/spatialdata_io/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os

import click

import spatialdata_io


@click.command()
@click.argument("input_path", type=click.Path(exists=True))
@click.argument("output_path", type=click.Path())
@click.option(
"--reader_name",
type=click.Choice(
["codex", "cosmx", "curio", "mcmicro", "merscope", "metaspace", "resolve", "steinbock", "visium", "xenium"]
),
help="name of the reader to use",
required=True,
)
def main(input_path, output_path, reader_name):
if os.path.exists(output_path):
print("Spatialdata object already exists! If you want to recompute it, please delete the existing Zarr store.")
else:
reader_func = getattr(spatialdata_io, reader_name)
sdata = reader_func(input_path) ## Can only handle mcmicro at the moment. Add logic for other readers!!!
sdata.write(output_path)


if __name__ == "__main__":
main()