From 3fca57b7f2fd1412772ec51d61235df02a09a2d5 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 10 Nov 2025 11:55:34 -0800 Subject: [PATCH 1/4] add `description` and `randomness_seed` to top level recipe settings --- cellpack/autopack/validation/recipe_models.py | 2 ++ docs/RECIPE_SCHEMA.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/cellpack/autopack/validation/recipe_models.py b/cellpack/autopack/validation/recipe_models.py index 44d5ac34..558b45b5 100644 --- a/cellpack/autopack/validation/recipe_models.py +++ b/cellpack/autopack/validation/recipe_models.py @@ -417,10 +417,12 @@ def validate_entry_content(self): # RECIPE-METADATA-LEVEL class Recipe(BaseModel): name: str + description: Optional[str] = None version: str = Field("1.0.0") format_version: str = Field("2.0") bounding_box: List[List[float]] = Field([[0, 0, 0], [100, 100, 100]]) grid_file_path: Optional[str] = None + randomness_seed: Optional[int] = None objects: Dict[str, RecipeObject] = Field(default_factory=dict) gradients: Union[Dict[str, RecipeGradient], List[Dict[str, Any]]] = Field( default_factory=dict diff --git a/docs/RECIPE_SCHEMA.md b/docs/RECIPE_SCHEMA.md index 82426da4..0403492b 100644 --- a/docs/RECIPE_SCHEMA.md +++ b/docs/RECIPE_SCHEMA.md @@ -9,15 +9,18 @@ The top-level fields include metadata about the recipe, such as its name, versio | Field Path | Type | Description | Default Value | Notes | | ---------------- | ------------------------------------------------ | ---------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | `name` | string | Name of the recipe | | | +| `description` | string | Description of the recipe | | | | `version` | string | Recipe version string | "default" | Version of the recipe is appended to the output file name. | | `format_version` | string | Schema format version | "1.0" | Older recipe formats do not have this field. Recipes are automatically migrated to the latest format version before packing. | | `bounding_box` | array `[[minX, minY, minZ], [maxX, maxY, maxZ]]` | Bounding box of the packing result | `[[ 0, 0, 0 ], [ 100, 100, 100 ]]` | | | `grid_file_path` | string | File path to read/write grid data | | If not specified, a grid file is created and stored at the output path. | +| `randomness_seed` | integer | Seed for random number generation | | | **Example:** ```JSON { "name": "one_sphere", + "description": "Single sphere packed within a bounding box", "version": "1.0.0", "format_version": "2.0", "bounding_box": [ From 670b8748da3b9bea4abda4ff83eeadbd0eb60ac9 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 10 Nov 2025 12:01:43 -0800 Subject: [PATCH 2/4] add description in example recipes --- examples/recipes/v2/endosome.json | 1 + examples/recipes/v2/er_peroxisome.json | 1 + examples/recipes/v2/golgi_endosome.json | 1 + examples/recipes/v2/peroxisome.json | 1 + examples/recipes/v2/spheres_in_a_box.json | 1 + 5 files changed, 5 insertions(+) diff --git a/examples/recipes/v2/endosome.json b/examples/recipes/v2/endosome.json index 2332dc12..06532076 100644 --- a/examples/recipes/v2/endosome.json +++ b/examples/recipes/v2/endosome.json @@ -2,6 +2,7 @@ "version": "gradient_packing", "format_version": "2.1", "name": "endosome", + "description": "Endosomes puncta (represented as spheres) packed with various biases in mesh containers, representing the cell membrane and nucleus, derived from a segmented hiPS cell.", "bounding_box": [ [ -124.39499130249024, diff --git a/examples/recipes/v2/er_peroxisome.json b/examples/recipes/v2/er_peroxisome.json index abf94a44..348ad374 100644 --- a/examples/recipes/v2/er_peroxisome.json +++ b/examples/recipes/v2/er_peroxisome.json @@ -2,6 +2,7 @@ "version": "gradient_packing", "format_version": "2.1", "name": "ER_peroxisome", + "description": "Peroxisome puncta (represented as spheres) packed in and around mesh containers representing the cell membrane, the nucleus, and the endoplasmic reticulum (ER), derived from a segmented hiPS cell.", "bounding_box": [ [ 33.77499999999999, diff --git a/examples/recipes/v2/golgi_endosome.json b/examples/recipes/v2/golgi_endosome.json index 2f84d437..d4fcd99a 100644 --- a/examples/recipes/v2/golgi_endosome.json +++ b/examples/recipes/v2/golgi_endosome.json @@ -2,6 +2,7 @@ "version": "gradient_packing", "format_version": "2.1", "name": "golgi_endosome", + "description": "Endosome puncta (represented as spheres) packed in and around mesh containers representing the cell membrane, the nucleus, and the Golgi, derived from a segmented hiPS cell.", "bounding_box": [ [ 34.5, diff --git a/examples/recipes/v2/peroxisome.json b/examples/recipes/v2/peroxisome.json index 3d3be864..e89c297e 100644 --- a/examples/recipes/v2/peroxisome.json +++ b/examples/recipes/v2/peroxisome.json @@ -2,6 +2,7 @@ "version": "gradient_packing", "format_version": "2.1", "name": "peroxisome", + "description": "Peroxisomes puncta (represented as spheres) packed with various biases in mesh containers representing the cell membrane and nucleus derived from a segmented hiPS cell.", "bounding_box": [ [ 35.325, diff --git a/examples/recipes/v2/spheres_in_a_box.json b/examples/recipes/v2/spheres_in_a_box.json index 5b2859be..bd655154 100644 --- a/examples/recipes/v2/spheres_in_a_box.json +++ b/examples/recipes/v2/spheres_in_a_box.json @@ -2,6 +2,7 @@ "version": "1.0.0", "format_version": "2.0", "name": "spheres_in_a_box", + "description": "Multiple spheres packed within a bounding box.", "bounding_box": [ [ 0, From 7961c1170d16cceb45ed7c27792eedc78e9b5ad2 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 10 Nov 2025 12:07:06 -0800 Subject: [PATCH 3/4] add description to download and upload script --- cellpack/autopack/DBRecipeHandler.py | 2 ++ cellpack/bin/upload.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cellpack/autopack/DBRecipeHandler.py b/cellpack/autopack/DBRecipeHandler.py index 27c35c39..23883349 100644 --- a/cellpack/autopack/DBRecipeHandler.py +++ b/cellpack/autopack/DBRecipeHandler.py @@ -855,6 +855,8 @@ def compile_db_recipe_data(db_recipe_data, obj_dict, grad_dict, comp_dict): recipe_data["grid_file_path"] = db_recipe_data.get("grid_file_path") if db_recipe_data.get("randomness_seed"): recipe_data["randomness_seed"] = db_recipe_data.get("randomness_seed") + if db_recipe_data.get("description"): + recipe_data["description"] = db_recipe_data.get("description") if grad_dict: recipe_data["gradients"] = [ {**v} for v in DBRecipeLoader.remove_dedup_hash(grad_dict).values() diff --git a/cellpack/bin/upload.py b/cellpack/bin/upload.py index 8a7616ce..73ec8972 100644 --- a/cellpack/bin/upload.py +++ b/cellpack/bin/upload.py @@ -21,6 +21,8 @@ def get_recipe_metadata(loader): "bounding_box": loader.recipe_data["bounding_box"], "composition": {}, } + if "description" in loader.recipe_data: + recipe_meta_data["description"] = loader.recipe_data["description"] if "grid_file_path" in loader.recipe_data: recipe_meta_data["grid_file_path"] = loader.recipe_data["grid_file_path"] if "randomness_seed" in loader.recipe_data: From e83e546219b180b95d30a55ca603b7960b8962d0 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 10 Nov 2025 12:17:04 -0800 Subject: [PATCH 4/4] add description field to unit tests --- cellpack/tests/test_db_recipe_loader.py | 2 ++ cellpack/tests/test_db_uploader.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/cellpack/tests/test_db_recipe_loader.py b/cellpack/tests/test_db_recipe_loader.py index 7d87cdd4..ccf25f20 100644 --- a/cellpack/tests/test_db_recipe_loader.py +++ b/cellpack/tests/test_db_recipe_loader.py @@ -91,11 +91,13 @@ "version": "linear", "bounding_box": [[-110, -45, -62], [110, 45, 62]], "name": "test_recipe", + "description": "test_description", } compiled_firebase_recipe_example = { "name": "test_recipe", + "description": "test_description", "format_version": "2.1", "version": "linear", "bounding_box": [[-110, -45, -62], [110, 45, 62]], diff --git a/cellpack/tests/test_db_uploader.py b/cellpack/tests/test_db_uploader.py index 9ffb589f..0c91cbd5 100644 --- a/cellpack/tests/test_db_uploader.py +++ b/cellpack/tests/test_db_uploader.py @@ -27,6 +27,7 @@ def test_upload_data_with_recipe_and_id(): collection = "recipe" data = { "name": "test", + "description": "test_description", "bounding_box": [[0, 0, 0], [1000, 1000, 1]], "version": "1.0.0", "composition": {"test": {"inherit": "firebase:test_collection/test_id"}}, @@ -147,11 +148,13 @@ def test_upload_collections(): def test_upload_recipe(): recipe_meta_data = { "name": "one_sphere", + "description": "test_description", "version": "1.0.0", "composition": {}, } recipe_data = { "name": "one_sphere", + "description": "test_description", "version": "1.0.0", "objects": { "sphere_25": {