Skip to content

Commit

Permalink
fixed createHash function to include ColorByEvent (#160)
Browse files Browse the repository at this point in the history
* fixed createHash function to include ColorByEvent

* precommit fix
  • Loading branch information
TeunHuijben authored Jan 27, 2025
1 parent fe3bb28 commit 0a78a79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 10 additions & 1 deletion python/src/intracktive/createHash.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ def generate_viewer_state_hash(data_url: str) -> str:
The inTRACKtive hash string (to be added to the URL).
"""

# Define the Python equivalent of DEFAULT_DROPDOWN_OPTION
default_dropdown_option = {
"name": "uniform",
"label": 0,
"type": "default",
"action": "default",
"numCategorical": None, # Equivalent to undefined in TypeScript
}

# Replicate the initial state based on your ViewerState defaults
viewer_state = {
"dataUrl": data_url,
Expand All @@ -35,7 +44,7 @@ def generate_viewer_state_hash(data_url: str) -> str:
"pointSize": 0.1,
"trackWidthFactor": 1,
"colorBy": False,
# TODO: add colorByEvent
"colorByEvent": default_dropdown_option,
}

# Step 1: Serialize the viewer state to a JSON string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Choose the location where the Zarr file will be stored, providing an empty path (Path()) means that the data will be stored in a temporary location\n",
"zarr_dir = Path()\n",
"# zarr_dir = '/path/on/your/computer/\n",
"\n",
"# dataframe_to_browser(df, zarr_dir)"
"dataframe_to_browser(df, zarr_dir)"
]
},
{
Expand All @@ -84,7 +84,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[OPTIONAL] add attributes to color the cells (takes ~20 sec to run)"
"[OPTIONAL] add attributes to color the cells based on lineage (takes ~20 sec to run)"
]
},
{
Expand All @@ -110,13 +110,6 @@
"# Open the data in inTRACKtive\n",
"dataframe_to_browser(df2, zarr_dir, extra_cols=[\"lineage\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit 0a78a79

Please sign in to comment.