Skip to content

Commit

Permalink
Merge pull request #64 from goeckslab/wrap-bg-subtract
Browse files Browse the repository at this point in the history
Wrap bg subtract
  • Loading branch information
CameronFRWatson authored Jun 5, 2024
2 parents af71ccb + 6c6d7f6 commit 7030070
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/backsub/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
owner: goeckslab
name: backsub
description: "Background autofluorescence subtraction for MCMICRO"
long_description: |
"Pixel-by-pixel channel subtraction scaled by exposure times, primarily developed for images produced by the COMET platform and to work within the MCMICRO pipeline. Main usecase is autuofluorescence subtraction for multichannel and multicycle images for visualization of images from tissues with high autofluroescence (FFPE), improved segmentation, and quantification (if the previous two usecases aren't necessary, downstream subtraction of autofluorescent signal is encouraged as the script is memory inefficent)."
remote_repository_url: https://github.com/goeckslab/tools-mti/tree/main/tools/background-subtraction
homepage_url: https://github.com/SchapiroLabor/Background_subtraction
categories:
- "Imaging"
96 changes: 96 additions & 0 deletions tools/backsub/backsub.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<tool id="backsub" name="Background subtraction" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">

<description>for sequential immunofluorescence images</description>

<macros>
<import>macros.xml</import>
</macros>

<expand macro="requirements"/>
<expand macro="version_cmd"/>

<command detect_errors="aggressive"><![CDATA[
python /background_subtraction/background_sub.py
##Supply image
--root '$root'
##Supply markers
--markers '$markers'
##Name output image file
--output out.ome.tiff
##Name output markers file
--marker-output out.csv
##Additional arguments
#if $adv.pixel_size
--pixel-size $adv.pixel_size
#end if
#if $adv.tile_size
--tile-size $adv.tile_size
#end if
]]></command>

<inputs>
<param name="root" type="data" format="ome.tiff" optional="false" label="Image to process"/>
<param name="markers" type="data" format="csv" optional="false" label="Markers file mapping channels to subtract" help="Expected columns: marker_name, background, exposure, remove"/>
<section name="adv" title="Advanced Options" expanded="false">
<param name="pixel_size" type="float" optional="true" min=".01" max="1.0" label="Pixel size in microns" help="If not supplied, finds resolution in XML metadata, otherwise defaults to 1"/>
<param name="tile_size" type="integer" optional="true" min="256" max="2048" label="Tile size for pyramid generation (default 1024)"/>
</section>
</inputs>

<outputs>
<data format="ome.tiff" name="image_output" from_work_dir="out.ome.tiff" label="${tool.name} on ${on_string}: Subtracted Image"/>
<data format="csv" name="marker_output" from_work_dir="out.csv" label="${tool.name} on ${on_string}: Markers"/>
</outputs>

<tests>
<test expect_num_outputs="2">
<param name="root" value="test.ome.tiff" />
<param name="markers" value="test_markers.csv" />
<param name="tile_size" value="256" />
<output name="image_output" ftype="ome.tiff">
<assert_contents>
<has_size value="520000" delta="10000" />
</assert_contents>
</output>
<output name="marker_output" ftype="csv">
<assert_contents>
<has_n_columns n="3" sep="," />
<has_n_lines n="3" />
</assert_contents>
</output>
</test>
</tests>
<help><![CDATA[
**Background autofluorescence subtraction for cyclic imaging data**
Performs Pixel-by-pixel channel subtraction scaled by exposure times
primarily developed for images produced by the COMET platform and to work within
the MCMICRO pipeline. Main usecase is autuofluorescence subtraction for
multichannel and multicycle images for visualization of images from tissues with
high autofluroescence (FFPE), improved segmentation, and quantification (if the
previous two usecases aren't necessary, downstream subtraction of
autofluorescent signal is encouraged as the script is memory inefficent).
The markers file (CSV) gives details about the channels and needs to contain
the following columns: "marker_name", "background", "exposure", "remove"
The "marker_name" column should indicate the marker for the acquired channel and all values should be unique.
The "background" column should indicate the marker name of the channel which needs to be subtracted.
This value must match the "marker_name" value of the background channel.
The "exposure" column should contain the exposure time used for channel acquisition,
and the measure unit should be consistent across the column. Exposure time is used for scaling the
value of the background to be comparable to the processed channel. The "remove" column should contain
logical `TRUE` values for channels which should be exluded in the output image.
*Visit https://github.com/SchapiroLabor/Background_subtraction/ for the most up-to-date information*
]]></help>
<expand macro="citations" />
</tool>
22 changes: 22 additions & 0 deletions tools/backsub/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<macros>
<xml name="requirements">
<requirements>
<container type="docker">ghcr.io/schapirolabor/background_subtraction:v@TOOL_VERSION@</container>
</requirements>
</xml>

<xml name="version_cmd">
<version_command>echo @TOOL_VERSION@</version_command>
</xml>
<xml name="citations">
<citations>
<citation type="doi">10.1038/s41592-021-01308-y</citation>
</citations>
</xml>

<token name="@PROFILE@">21.0</token>
<token name="@TOOL_VERSION@">0.4.1</token>
<token name="@VERSION_SUFFIX@">0</token>

</macros>
Binary file added tools/backsub/test-data/test.ome.tiff
Binary file not shown.
3 changes: 3 additions & 0 deletions tools/backsub/test-data/test_markers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
marker_name,background,exposure,remove
CHAN_0,,200,
CHAN_1,CHAN_0,200,

0 comments on commit 7030070

Please sign in to comment.