Skip to content
Open
12 changes: 12 additions & 0 deletions tools/trackastra-galaxy/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: trackastra-galaxy
owner: iuc
categories:
- Machine Learning
description: Track cell instances in time-lapse OME-Zarr datasets using Trackastra and Cellpose.
long_description: |
Trackastra-Galaxy is a wrapper around the Trackastra cell-tracking pipeline that supports
both segmentation+tracking and track-only workflows on time-lapse OME-Zarr datasets.
It can consume remote or local Zarr datasets and outputs a CTC track log plus per-frame mask images.
homepage_url: https://github.com/bioinfbrad/trackastra-galaxy
remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/main/tools/trackastra-galaxy
type: unrestricted
81 changes: 81 additions & 0 deletions tools/trackastra-galaxy/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<macros>
<token name="@TOOL_VERSION@">1.0.1</token>
<token name="@PROFILE@">23.0</token>
<token name="@VERSION_SUFFIX@">0</token>
<xml name="bio_tools">
<xrefs>
<xref type="bio.tools">trackastra-galaxy</xref>
</xrefs>
</xml>
<xml name="creators">
<creator>
<person givenName="Vladimír" familyName="Ulman" url="https://github.com/xulman" />
<person givenName="Khaled" familyName="Jum'ah" url="https://github.com/khaled196" />
<person givenName="Krzysztof" familyName="Poterlowicz" url="https://github.com/kpoterlowicz" />
<organization name="poterlowicz-lab" url="https://github.com/poterlowicz-lab" />
</creator>
</xml>
<xml name="input_source_params">
<conditional name="input_source">
<param name="input_source" type="select" label="Input source" help="Choose whether to use a URL or upload a local Zarr dataset">
<option value="url" selected="true">URL</option>
<option value="file">Local file</option>
</param>
<when value="url">
<param name="zarr_path" type="text" label="Zarr dataset URL" help="URL to OME-Zarr dataset. Can be https://, s3://. Example: https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/0">
<sanitizer>
<valid initial="string.printable" />
</sanitizer>
</param>
</when>
<when value="file">
<param name="zarr_path" type="data" format="zarr" label="Zarr dataset file" help="Local Zarr dataset" />
</when>
</conditional>
</xml>

<xml name="requirements">
<requirements>
<requirement type="package" version="@TOOL_VERSION@">trackastra-galaxy</requirement>
<requirement type="package" version="3.1.1.3">cellpose</requirement>
<requirement type="package" version="0.5.3">trackastra</requirement>
<requirement type="package" version="2.0.2">numpy</requirement>
<requirement type="package" version="0.26.0">scikit-image</requirement>
<requirement type="package" version="0.14.0">ome-zarr</requirement>
</requirements>
</xml>

<xml name="common_tracking_params">
<param name="scale_level" type="integer" value="0" min="0" label="Pyramid scale level" help="Resolution level in zarr pyramid. 0=finest resolution (best quality but slower), higher numbers=lower resolution but faster processing"/>
<param name="downscale_x" type="float" value="1.0" min="0.1" label="Downscale factor X" help="Spatial downscaling for X dimension (1.0=no scaling, 2.0=half resolution). Useful for large images (500+ pixels) to speed up processing"/>
<param name="downscale_y" type="float" value="1.0" min="0.1" label="Downscale factor Y" help="Spatial downscaling for Y dimension (1.0=no scaling, 2.0=half resolution)"/>
<param name="downscale_z" type="float" value="1.0" min="0.1" label="Downscale factor Z" help="Spatial downscaling for Z dimension (1.0=no scaling, 2.0=half resolution) for 3D tracking"/>
<param name="start_tp" type="integer" value="0" min="0" label="Start time point" help="First frame to process (0-indexed). Use to test on subset of frames"/>
<param name="end_tp" type="integer" value="-1" label="End time point" help="Last frame to process. Use -1 to process all frames"/>
<param name="raw_channel_coords" type="text" value="0" label="Raw channel coordinate" help="For multi-dimensional zarr, specify coordinates to select the raw image channel. Space or comma-separated. Example: '0' or '0 1' for 6D data">
<sanitizer>
<valid initial="string.printable" />
</sanitizer>
</param>
<param name="tracking_model" type="select" label="Tracking model" help="Trackastra model to use for tracking cells across frames">
<option value="ctc" selected="true">ctc - Default CTC model</option>
</param>
</xml>

<xml name="citations">
<citations>
<citation type="bibtex">@article{trackastra,
title={Trackastra: transformer-based cell tracking},
author={Theis, F. J. and others},
journal={Nature Methods},
year={2024}
}</citation>
<citation type="bibtex">@article{cellpose,
title={Cellpose: a generalist algorithm for cellular segmentation},
author={Stringer, C. and Wang, T. and others},
journal={Nature Methods},
year={2021}
}</citation>
</citations>
</xml>
</macros>
Empty file.
Empty file.
Empty file.
169 changes: 169 additions & 0 deletions tools/trackastra-galaxy/trackastra-galaxy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<tool id="trackastra" name="Trackastra" version="@TOOL_VERSION@+galaxyy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>Track cell instances in time-lapse OME-Zarr datasets</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements" />
<expand macro="creators"/>
<command detect_errors="exit_code"><![CDATA[

mkdir -p result_directory &&

#if $method.input_source.input_source == "file"
ln -s '$method.input_source.zarr_path' ./file.zarr &&
#end if

trackastra-galaxy $method.mode
#if $method.input_source.input_source == "file"
--zarr-path ./file.zarr
#else
--zarr-path '$method.input_source.zarr_path'
#end if
--scale-level $method.scale_level
--raw-channel-coords '$method.raw_channel_coords'
#if $method.mode == 'track'
--seg-channel-coords '$method.seg_channel_coords'
#end if
--result-path ./result_directory
--downscale-x $method.downscale_x
--downscale-y $method.downscale_y
--downscale-z $method.downscale_z
--start-tp $method.start_tp
--end-tp $method.end_tp
--tracking-model '$method.tracking_model'
#if $method.mode == 'segment-and-track'
--segmentation-model '$method.segmentation_model'
--objects-diameter-px $method.objects_diameter_px
#end if
]]></command>
<inputs>
<conditional name="method">
<param name="mode" type="select" label="Processing mode" help="Choose between segmentation+tracking or tracking only">
<option value="segment-and-track" selected="true">Segment cells and track (Cellpose v3 + Trackastra)</option>
<option value="track">Track only (requires pre-segmented data)</option>
</param>
<when value="segment-and-track">
<expand macro="input_source_params" />
<expand macro="common_tracking_params" />
<param name="segmentation_model" type="select" label="Segmentation model" help="Cellpose v3 model to use for cell/nuclei detection">
<option value="cyto3" selected="true">cyto3 - Cytoplasm (recommended)</option>
<option value="cyto2">cyto2 - Cytoplasm (older model)</option>
<option value="nuclei">nuclei - Nuclei only</option>
</param>
<param name="objects_diameter_px" type="integer" value="25" min="1" label="Object diameter (px)" help="Expected object diameter in pixels for Cellpose v3 segmentation"/>
</when>
<when value="track">
<expand macro="input_source_params" />
<expand macro="common_tracking_params" />
<param name="seg_channel_coords" type="text" value="1" label="Segmentation channel coordinate" help="For multi-dimensional zarr, specify coordinates to select the segmentation channel. Space or comma-separated. Example: '1' or '0 1' for 6D data">
<sanitizer>
<valid initial="string.printable" />
</sanitizer>
</param>
</when>
</conditional>
</inputs>
<outputs>
<data name="output_ctc_tracklog" format="txt" from_work_dir="result_directory/man_track.txt" label='${tool.name} on ${on_string}: CTC track log'/>
<collection name="output_ctc_masks" type="list" label='${tool.name} on ${on_string}: CTC mask images'>
<discover_datasets pattern="man_track[0-9][0-9][0-9][0-9].tif" format="tiff" directory="result_directory" />
</collection>
</outputs>
<tests>
<test expect_num_outputs="2">
<conditional name="method">
<param name="mode" value="segment-and-track"/>
<conditional name="input_source">
<param name="input_source" value="url"/>
<param name="zarr_path" value="https://s3.cl2.du.cesnet.cz/35b9fef6_a5c7_4724_b7ad_0db97899a356:public/CTC_trif_01_cropped_2channels_v04.zarr"/>
</conditional>
<param name="scale_level" value="3"/>
<param name="downscale_x" value="1.0"/>
<param name="downscale_y" value="1.0"/>
<param name="downscale_z" value="1.0"/>
<param name="start_tp" value="0"/>
<param name="end_tp" value="0"/>
<param name="raw_channel_coords" value="0"/>
<param name="segmentation_model" value="cyto3"/>
<param name="objects_diameter_px" value="25"/>
<param name="tracking_model" value="ctc"/>
</conditional>
<output name="output_ctc_tracklog" file="man_segment_and_track1.txt" />
<output_collection name="output_ctc_masks" type="list" count="1" />
</test>
<test expect_num_outputs="2">
<conditional name="method">
<param name="mode" value="segment-and-track"/>
<conditional name="input_source">
<param name="input_source" value="url"/>
<param name="zarr_path" value="https://s3.cl2.du.cesnet.cz/35b9fef6_a5c7_4724_b7ad_0db97899a356:public/CTC_trif_01_cropped_2channels_v04.zarr"/>
</conditional>
<param name="scale_level" value="3"/>
<param name="downscale_x" value="1.0"/>
<param name="downscale_y" value="1.0"/>
<param name="downscale_z" value="1.0"/>
<param name="start_tp" value="0"/>
<param name="end_tp" value="1"/>
<param name="raw_channel_coords" value="0"/>
<param name="segmentation_model" value="cyto3"/>
<param name="objects_diameter_px" value="25"/>
<param name="tracking_model" value="ctc"/>
</conditional>
<output name="output_ctc_tracklog" file="man_segment_and_track2.txt" />
<output_collection name="output_ctc_masks" type="list" count="2" />
</test>
<test expect_num_outputs="2">
<conditional name="method">
<param name="mode" value="track"/>
<conditional name="input_source">
<param name="input_source" value="url"/>
<param name="zarr_path" value="https://s3.cl2.du.cesnet.cz/35b9fef6_a5c7_4724_b7ad_0db97899a356:public/CTC_trif_01_cropped_2channels_v04.zarr"/>
</conditional>
<param name="scale_level" value="3"/>
<param name="downscale_x" value="1.0"/>
<param name="downscale_y" value="1.0"/>
<param name="downscale_z" value="1.0"/>
<param name="start_tp" value="0"/>
<param name="end_tp" value="1"/>
<param name="raw_channel_coords" value="0"/>
<param name="seg_channel_coords" value="1"/>
<param name="tracking_model" value="ctc"/>
</conditional>
<output name="output_ctc_tracklog" file="man_track.txt" />
<output_collection name="output_ctc_masks" type="list" count="2" />
</test>
</tests>
<help><![CDATA[
**Trackastra: Deep Learning-based Cell Tracking in Zarr Datasets**

This tool performs automated cell instance tracking in time-lapse OME-Zarr (NGFF) datasets. It supports two workflows:

1. **Segment and Track**: Automatically segments cell instances using Cellpose v3, then performs tracking using Trackastra
2. **Track Only**: Performs tracking on pre-segmented data (segmentation provided by other tools)

**Input Sources**

Choose between URL or local Zarr dataset:

- **URL**: HTTP/HTTPS or S3 path to remote OME-Zarr dataset
- **Local file**: Upload or select a local Zarr dataset directory

**Key Parameters**

- **scale_level**: Pyramid resolution level. 0 is finest resolution.
- **Downscale factors (x, y, z)**: Additional spatial downscaling to speed up processing.
- **Time point range**: start_tp and end_tp select the processed frames.
- **Raw/segmentation channel coordinates**: Use space- or comma-separated coordinates for non-tzyx dimensions.

**Outputs**

The tool writes its results into an internal result directory named `result_directory`.
Galaxy exposes the key result files from this directory as outputs:

- **man_track.txt**: CTC track log
- **man_trackNNNN.tif**: Frame-wise mask images

These are exposed as Galaxy outputs for downstream analysis.
]]></help>
<expand macro="citations" />
</tool>
14 changes: 14 additions & 0 deletions tools/trackastra_galaxy/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: trackastra_galaxy
owner: iuc
categories:
- Machine Learning
- Imaging
description: Track cell instances in time-lapse OME-Zarr datasets using Trackastra and Cellpose.
long_description: |
Trackastra-Galaxy is a wrapper around the Trackastra cell-tracking pipeline that supports
both segmentation+tracking and track-only workflows on time-lapse OME-Zarr datasets.
It can consume remote or local Zarr datasets and outputs a CTC track log plus per-frame mask images.
homepage_url: https://github.com/bioinfbrad/trackastra_galaxy
remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/main/tools/trackastra_galaxy
type: unrestricted

81 changes: 81 additions & 0 deletions tools/trackastra_galaxy/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<macros>
<token name="@TOOL_VERSION@">1.0.1</token>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the main package here (the one that implements the main functionallity) is trackastra, not trackastra-galaxy, right? In that case:

Suggested change
<token name="@TOOL_VERSION@">1.0.1</token>
<token name="@TOOL_VERSION@">0.5.3</token>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main package is tracksatra-galaxy https://github.com/bioinfbrad/trackastra-galaxy.

The tool itself is a pipeline that automates and orchestrates the process of running Trackastra on Galaxy's servers, allowing users to process large datasets efficiently

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case I need to revise the comment that I previously made here, the description of the tool should rather be with Trackastra Galaxy Tool, assuming from PyPI that the name of the package actually is Trackastra Galaxy Tool.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of the tool is peculiar.... It is a tool for tracking (and segmenting) that features Trackastra (and Cellpose) and came to being only specifically for Galaxy. In its journey to possibly become a Galaxy node, it got published on PyPI as a package in its own right (currently at version 1.0.1) -- this is what we're trying to turn into a Galaxy node.

The PyPI package is basically an adapter around Trackastra (and Cellpose) to

  • read OME-Zarrs, and
  • save into CellTrackingChallenge format,
  • exposing both Python API and CLI for Galaxy.

For the PyPI, it needed to have a name, which perhaps unfortunately ended up being trackastra-galaxy to reflect what its main star is and what it is meant for...

In Galaxy itself, it could probably be named better, e.g., "tracking cells with Trackastra".... I'm open to anything.

<token name="@PROFILE@">23.0</token>
Comment thread
SaimMomin12 marked this conversation as resolved.
Outdated
<token name="@VERSION_SUFFIX@">0</token>
<xml name="bio_tools">
<xrefs>
<xref type="bio.tools">trackastra-galaxy</xref>
</xrefs>
</xml>
<xml name="creators">
<creator>
<person givenName="Vladimír" familyName="Ulman" url="https://github.com/xulman" />
<person givenName="Khaled" familyName="Jum'ah" url="https://github.com/khaled196" />
<person givenName="Krzysztof" familyName="Poterlowicz" url="https://github.com/kpoterlowicz" />
<organization name="poterlowicz-lab" url="https://github.com/poterlowicz-lab" />
</creator>
</xml>
<xml name="input_source_params">
<conditional name="input_source">
<param name="input_source" type="select" label="Input source" help="Choose whether to use a URL or upload a local Zarr dataset">
<option value="url" selected="true">URL</option>
<option value="file">Local file</option>
</param>
<when value="url">
<param name="zarr_path" type="text" label="Zarr dataset URL" help="URL to OME-Zarr dataset. Can be https://, s3://. Example: https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/0">
<sanitizer>
<valid initial="string.printable" />
</sanitizer>
</param>
</when>
<when value="file">
<param name="zarr_path" type="data" format="zarr" label="Zarr dataset file" help="Local Zarr dataset" />
</when>
</conditional>
</xml>

<xml name="requirements">
<requirements>
<requirement type="package" version="@TOOL_VERSION@">trackastra-galaxy</requirement>
<requirement type="package" version="3.1.1.3">cellpose</requirement>
<requirement type="package" version="0.5.3">trackastra</requirement>
<requirement type="package" version="2.0.2">numpy</requirement>
<requirement type="package" version="0.26.0">scikit-image</requirement>
<requirement type="package" version="0.14.0">ome-zarr</requirement>
</requirements>
</xml>

<xml name="common_tracking_params">
<param name="scale_level" type="integer" value="0" min="0" label="Pyramid scale level" help="Resolution level in zarr pyramid. 0=finest resolution (best quality but slower), higher numbers=lower resolution but faster processing"/>
<param name="downscale_x" type="float" value="1.0" min="0.1" label="Downscale factor X" help="Spatial downscaling for X dimension (1.0=no scaling, 2.0=half resolution). Useful for large images (500+ pixels) to speed up processing"/>
<param name="downscale_y" type="float" value="1.0" min="0.1" label="Downscale factor Y" help="Spatial downscaling for Y dimension (1.0=no scaling, 2.0=half resolution)"/>
<param name="downscale_z" type="float" value="1.0" min="0.1" label="Downscale factor Z" help="Spatial downscaling for Z dimension (1.0=no scaling, 2.0=half resolution) for 3D tracking"/>
<param name="start_tp" type="integer" value="0" min="0" label="Start time point" help="First frame to process (0-indexed). Use to test on subset of frames"/>
<param name="end_tp" type="integer" value="-1" label="End time point" help="Last frame to process. Use -1 to process all frames"/>
<param name="raw_channel_coords" type="text" value="0" label="Raw channel coordinate" help="For multi-dimensional zarr, specify coordinates to select the raw image channel. Space or comma-separated. Example: '0' or '0 1' for 6D data">
<sanitizer>
<valid initial="string.printable" />
</sanitizer>
</param>
<param name="tracking_model" type="select" label="Tracking model" help="Trackastra model to use for tracking cells across frames">
<option value="ctc" selected="true">ctc - Default CTC model</option>
</param>
</xml>

<xml name="citations">
<citations>
<citation type="bibtex">@article{trackastra,
title={Trackastra: transformer-based cell tracking},
author={Theis, F. J. and others},
journal={Nature Methods},
year={2024}
}</citation>
<citation type="bibtex">@article{cellpose,
title={Cellpose: a generalist algorithm for cellular segmentation},
author={Stringer, C. and Wang, T. and others},
journal={Nature Methods},
year={2021}
}</citation>
</citations>
</xml>
</macros>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 2 0
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions tools/trackastra_galaxy/test-data/track_only/man_track.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
1 0 2 0
2 0 2 0
3 0 1 0
4 0 1 0
5 0 2 0
6 0 1 0
7 0 2 0
8 0 1 0
9 1 2 0
10 1 2 0
11 1 2 0
12 1 2 0
13 1 2 0
14 1 2 0
15 1 2 0
16 1 1 0
17 1 2 0
18 1 2 0
19 1 1 0
20 1 2 0
21 1 2 0
22 1 2 0
23 1 2 0
24 1 2 0
25 1 2 0
26 1 2 0
27 2 2 16
28 2 2 16
29 2 2 19
30 2 2 19
Binary file not shown.
Binary file not shown.
Loading
Loading