changeset 2:244f67290d28 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/superdsm/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author imgteam
date Mon, 13 Nov 2023 22:12:35 +0000
parents 700ae37e5c69
children 7fd8dba15bd3
files run-superdsm.py superdsm.xml
diffstat 2 files changed, 75 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/run-superdsm.py	Thu Jul 06 00:01:18 2023 +0000
+++ b/run-superdsm.py	Mon Nov 13 22:12:35 2023 +0000
@@ -13,11 +13,6 @@
 import shutil
 import tempfile
 
-import ray
-import superdsm.automation
-import superdsm.io
-import superdsm.render
-
 
 hyperparameters = [
     ('AF_scale', float),
@@ -71,7 +66,11 @@
 
     os.environ['MKL_NUM_THREADS'] = str(num_threads_per_process)
     os.environ['OPENBLAS_NUM_THREADS'] = str(num_threads_per_process)
-    os.environ['MKL_DEBUG_CPU_TYPE'] = '5'
+
+    import ray
+    import superdsm.automation
+    import superdsm.io
+    import superdsm.render
 
     ray.init(num_cpus=num_processes, log_to_driver=True)
 
--- a/superdsm.xml	Thu Jul 06 00:01:18 2023 +0000
+++ b/superdsm.xml	Mon Nov 13 22:12:35 2023 +0000
@@ -1,64 +1,76 @@
-<tool id="ip_superdsm" name="SuperDSM" version="0.1.3" profile="20.05">
-   <description>globally optimal segmentation method based on superadditivity and deformable shape models for cell nuclei in fluorescence microscopy images</description>
-   <requirements> 
+<tool id="ip_superdsm" name="Perform segmentation using deformable shape models" version="0.1.3+galaxy2" profile="20.05">
+    <description>with SuperDSM</description>
+    <edam_operations>
+        <edam_operation>operation_3443</edam_operation>
+    </edam_operations>
+    <xrefs>
+        <xref type="bio.tools">superdsm</xref>
+        <xref type="biii">superdsm</xref>
+    </xrefs>
+    <requirements> 
         <requirement type="package" version="0.1.3">superdsm</requirement>
         <requirement type="package" version="1.6.0">ray-core</requirement>
         <requirement type="package" version="0.18.1">scikit-image</requirement>
-   </requirements>
-   <command detect_errors="aggressive">
-   <![CDATA[
-   python '$__tool_directory__/run-superdsm.py'
-   '${dataset}'
-   'cfg.json'
-   'masks.png'
-   'overlay.png'
-   $seg_border
-   \${GALAXY_SLOTS:-4}
-   #if str($config.AF_scale) != '':
-       --AF_scale '${config.AF_scale}'
-   #end if
-   #if str($config.c2f_region_analysis_min_atom_radius) != '':
-       --c2f_region_analysis_min_atom_radius '${config.c2f_region_analysis_min_atom_radius}'
-   #end if
-   #if str($config.c2f_region_analysis_min_norm_energy_improvement) != '':
-       --c2f_region_analysis_min_norm_energy_improvement '${config.c2f_region_analysis_min_norm_energy_improvement}'
-   #end if
-   #if str($config.c2f_region_analysis_max_atom_norm_energy) != '':
-       --c2f_region_analysis_max_atom_norm_energy '${config.c2f_region_analysis_max_atom_norm_energy}'
-   #end if
-   #if str($config.c2f_region_analysis_max_cluster_marker_irregularity) != '':
-       --c2f_region_analysis_max_cluster_marker_irregularity '${config.c2f_region_analysis_max_cluster_marker_irregularity}'
-   #end if
-   #if str($config.dsm_alpha) != '':
-       --dsm_alpha '${config.dsm_alpha}'
-   #end if
-   #if str($config.dsm_AF_alpha) != '':
-       --dsm_AF_alpha '${config.dsm_AF_alpha}'
-   #end if
-   #if str($config.global_energy_minimization_beta) != '':
-       --global_energy_minimization_beta '${config.global_energy_minimization_beta}'
-   #end if
-   #if str($config.global_energy_minimization_AF_beta) != '':
-       --global_energy_minimization_AF_beta '${config.global_energy_minimization_AF_beta}'
-   #end if
-   #if str($config.postprocess_mask_max_distance) != '':
-       --postprocess_mask_max_distance '${config.postprocess_mask_max_distance}'
-   #end if
-   #if str($config.postprocess_mask_stdamp) != '':
-       --postprocess_mask_stdamp '${config.postprocess_mask_stdamp}'
-   #end if
-   #if str($config.postprocess_max_norm_energy) != '':
-       --postprocess_max_norm_energy '${config.postprocess_max_norm_energy}'
-   #end if
-   #if str($config.postprocess_min_contrast) != '':
-       --postprocess_min_contrast '${config.postprocess_min_contrast}'
-   #end if
-   #if str($config.postprocess_min_object_radius) != '':
-       --postprocess_min_object_radius '${config.postprocess_min_object_radius}'
-   #end if
-   ]]>
-   </command>
-   <inputs>
+        <requirement type="package" version="2020.0">mkl</requirement><!-- this seems to be the last version of MKL which supports the "MKL_DEBUG_CPU_TYPE" environment variable -->
+        <requirement type="package" version="*=mkl">blas</requirement><!-- using MKL instead of other BLAS can significantly improve performance on some hardware, cf. https://stackoverflow.com/questions/62783262/why-is-numpy-with-ryzen-threadripper-so-much-slower-than-xeon -->
+    </requirements>
+    <command detect_errors="aggressive">
+    <![CDATA[
+    python '$__tool_directory__/run-superdsm.py'
+    '${dataset}'
+    'cfg.json'
+    'masks.png'
+    'overlay.png'
+    $seg_border
+    \${GALAXY_SLOTS:-4}
+    #if str($config.AF_scale) != '':
+        --AF_scale '${config.AF_scale}'
+    #end if
+    #if str($config.c2f_region_analysis_min_atom_radius) != '':
+        --c2f_region_analysis_min_atom_radius '${config.c2f_region_analysis_min_atom_radius}'
+    #end if
+    #if str($config.c2f_region_analysis_min_norm_energy_improvement) != '':
+        --c2f_region_analysis_min_norm_energy_improvement '${config.c2f_region_analysis_min_norm_energy_improvement}'
+    #end if
+    #if str($config.c2f_region_analysis_max_atom_norm_energy) != '':
+        --c2f_region_analysis_max_atom_norm_energy '${config.c2f_region_analysis_max_atom_norm_energy}'
+    #end if
+    #if str($config.c2f_region_analysis_max_cluster_marker_irregularity) != '':
+        --c2f_region_analysis_max_cluster_marker_irregularity '${config.c2f_region_analysis_max_cluster_marker_irregularity}'
+    #end if
+    #if str($config.dsm_alpha) != '':
+        --dsm_alpha '${config.dsm_alpha}'
+    #end if
+    #if str($config.dsm_AF_alpha) != '':
+        --dsm_AF_alpha '${config.dsm_AF_alpha}'
+    #end if
+    #if str($config.global_energy_minimization_beta) != '':
+        --global_energy_minimization_beta '${config.global_energy_minimization_beta}'
+    #end if
+    #if str($config.global_energy_minimization_AF_beta) != '':
+        --global_energy_minimization_AF_beta '${config.global_energy_minimization_AF_beta}'
+    #end if
+    #if str($config.postprocess_mask_max_distance) != '':
+        --postprocess_mask_max_distance '${config.postprocess_mask_max_distance}'
+    #end if
+    #if str($config.postprocess_mask_stdamp) != '':
+        --postprocess_mask_stdamp '${config.postprocess_mask_stdamp}'
+    #end if
+    #if str($config.postprocess_max_norm_energy) != '':
+        --postprocess_max_norm_energy '${config.postprocess_max_norm_energy}'
+    #end if
+    #if str($config.postprocess_min_contrast) != '':
+        --postprocess_min_contrast '${config.postprocess_min_contrast}'
+    #end if
+    #if str($config.postprocess_min_object_radius) != '':
+        --postprocess_min_object_radius '${config.postprocess_min_object_radius}'
+    #end if
+    ]]>
+    </command>
+    <environment_variables>
+        <environment_variable name="MKL_DEBUG_CPU_TYPE">5</environment_variable><!-- this enables accelerated CPU instruction sets on AMD hardware, does nothing in Intel hardware, thus no need to change this -->
+    </environment_variables>
+    <inputs>
         <param name="dataset" type="data" format="tiff,png" label="Dataset" />
         <param name="seg_border" type="integer" min="1" value="8" label="Width of the outlines (in pixels) of the segmentation results (overlays)" />
         <section name="config" title="Hyperparameters" expanded="false">