diff flexynesis.xml @ 6:33816f44fc7d draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/flexynesis commit 6b520305ec30e6dc37eba92c67a5368cea0fc5ad
author bgruening
date Wed, 23 Jul 2025 07:49:41 +0000
parents 466b593fd87e
children
line wrap: on
line diff
--- a/flexynesis.xml	Fri Jul 04 14:57:40 2025 +0000
+++ b/flexynesis.xml	Wed Jul 23 07:49:41 2025 +0000
@@ -7,15 +7,18 @@
     <expand macro="requirements"/>
     <required_files>
         <include path="flexynesis_plot.py" />
+        <include path="flexynesis_utils.py" />
+        <include path="convert.py" />
+        <include path="index_to_name.py" />
     </required_files>
     <command detect_errors="exit_code"><![CDATA[
         @CHECK_NON_COMMERCIAL_USE@
         mkdir -p input/test input/train output &&
         ln -s '$train_clin' input/train/clin.tabular &&
-        python $__tool_directory__/convert.py input/train/clin.tabular input/train/clin.csv &&
+        python '$__tool_directory__/convert.py' input/train/clin.tabular input/train/clin.csv &&
 
         ln -s '$test_clin' input/test/clin.tabular &&
-        python $__tool_directory__/convert.py input/test/clin.tabular input/test/clin.csv &&
+        python '$__tool_directory__/convert.py' input/test/clin.tabular input/test/clin.csv &&
 
         #if str($assay_main) != '':
             #set $name = str($assay_main.replace(" ", "_"))
@@ -46,54 +49,61 @@
             #if str($element.train_omics) != 'None' and str($element.test_omics) != 'None':
                 #if str($element.assay) != '':
                     #set $i = str($element.assay.replace(" ", "_"))
-                #end if
-                ln -s '${element.train_omics}' input/train/omics_${i}.tabular &&
-                python '$__tool_directory__/convert.py' input/train/omics_${i}.tabular input/train/omics_${i}.csv &&
+                    ln -s '${element.train_omics}' input/train/${i}.tabular &&
+                    python '$__tool_directory__/convert.py' input/train/${i}.tabular input/train/${i}.csv &&
 
-                ln -s '${element.test_omics}' input/test/omics_${i}.tabular &&
-                python '$__tool_directory__/convert.py' input/test/omics_${i}.tabular input/test/omics_${i}.csv &&
+                    ln -s '${element.test_omics}' input/test/${i}.tabular &&
+                    python '$__tool_directory__/convert.py' input/test/${i}.tabular input/test/${i}.csv &&
 
-                $data_names.append("omics_" + str($i))
-                #if str($training_type.model) == 'cm_train':
-                    #if str($element.layer) == 'input':
-                        $input_layers.append("omics_" + str($i))
-                    #else
-                        $output_layers.append("omics_" + str($i))
+                    $data_names.append(str($i))
+                    #if str($training_type.model) == 'cm_train':
+                        #if str($element.layer) == 'input':
+                            $input_layers.append(str($i))
+                        #else
+                            $output_layers.append(str($i))
+                        #end if
+                    #end if
+                #else
+                    ln -s '${element.train_omics}' input/train/omics_${i}.tabular &&
+                    python '$__tool_directory__/convert.py' input/train/omics_${i}.tabular input/train/omics_${i}.csv &&
+
+                    ln -s '${element.test_omics}' input/test/omics_${i}.tabular &&
+                    python '$__tool_directory__/convert.py' input/test/omics_${i}.tabular input/test/omics_${i}.csv &&
+
+                    $data_names.append("omics_" + str($i))
+                    #if str($training_type.model) == 'cm_train':
+                        #if str($element.layer) == 'input':
+                            $input_layers.append("omics_" + str($i))
+                        #else
+                            $output_layers.append("omics_" + str($i))
+                        #end if
                     #end if
                 #end if
             #end if
         #end for
-        ## set target variables
         #if str($training_type.model) == 's_train':
-            #if len($targets) > 0:
-                target_variables="" &&
-                #for $i, $element in enumerate($targets)
-                    target_name=`$__tool_directory__/index_to_name.py input/train/clin.csv $element.target_variables` &&
-                    #if $i == 0:
-                        target_variables="\$target_name" &&
-                    #else:
-                        target_variables="\$target_variables,\$target_name" &&
-                    #end if
-                #end for
-                echo "Target variables: \$target_variables" &&
+            ## set target variables
+            #if str($target_variables) != 'None':
+                targets=`'$__tool_directory__/index_to_name.py' input/train/clin.csv $target_variables` &&
+                echo "Target variables: \$targets" &&
             #end if
             ## set survival variables
             #if str($surv_event_var) != 'None' and str($surv_time_var) != 'None':
-                surv_event_var=`$__tool_directory__/index_to_name.py input/train/clin.csv $surv_event_var` &&
-                echo "Survival event variable: \$surv_event_var" &&
-                surv_time_var=`$__tool_directory__/index_to_name.py input/train/clin.csv $surv_time_var` &&
-                echo "Survival time variable: \$surv_time_var" &&
+                survival_event=`'$__tool_directory__/index_to_name.py' input/train/clin.csv $surv_event_var` &&
+                ## check if survival variable is numerical
+                echo "Survival event variable: \$survival_event" &&
+                python '$__tool_directory__/flexynesis_utils.py' --util validate_survival --clin input/train/clin.csv --clin_variable \$survival_event &&
+                survival_time=`$__tool_directory__/index_to_name.py input/train/clin.csv $surv_time_var` &&
+                echo "Survival time variable: \$survival_time" &&
             #end if
-            ## set target value for plots
-            #if str($surv_event_var) != 'None' and str($surv_time_var) != 'None' and len($targets) > 0:
-                target_value="\$target_variables,\$surv_event_var" &&
-                echo "Target value for plots: \$target_value" &&
-            #else if str($surv_event_var) == 'None' and str($surv_time_var) == 'None' and len($targets) > 0:
-                target_value="\$target_variables" &&
-                echo "Target value for plots: \$target_value" &&
-            #else if str($surv_event_var) != 'None' and str($surv_time_var) != 'None' and len($targets) == 0:
-                target_value="\$surv_event_var" &&
-                echo "Target value for plots: \$target_value" &&
+            ## set clinical variables for Cox model
+            #if str($plot.plot_cox_conditional.plot_cox) == 'yes':
+                #if str($plot.plot_cox_conditional.clinical_variables) != 'None':
+                    covars=`'$__tool_directory__/index_to_name.py' input/train/clin.csv $plot.plot_cox_conditional.clinical_variables` &&
+                    ## check if covariates is numerical
+                    echo "Clinical variables for Cox model: \$covars" &&
+                    python '$__tool_directory__/flexynesis_utils.py' --util validate_covariate --clin input/train/clin.csv --clin_variable \$covars &&
+                #end if
             #end if
         #end if
 
@@ -107,12 +117,12 @@
                 --string_node_name $string_node_name
             #end if
             #if str($training_type.model) == 's_train':
-                #if len($targets) > 0:
-                    --target_variables \$target_variables
+                #if str($target_variables) != 'None':
+                    --target_variables \$targets
                 #end if
                 #if str($surv_event_var) != 'None' and str($surv_time_var) != 'None':
-                    --surv_event_var \$surv_event_var
-                    --surv_time_var \$surv_time_var
+                    --surv_event_var \$survival_event
+                    --surv_time_var \$survival_time
                 #end if
             #end if
             #if str($training_type.model) == 'cm_train':
@@ -142,143 +152,151 @@
         && for file in output/*.csv; do
             if [ -f "\$file" ]; then
                 basename="\${file%.csv}";
-                python $__tool_directory__/convert.py "\$file" "\${basename}.tabular";
+                python '$__tool_directory__/convert.py' "\$file" "\${basename}.tabular";
                 echo "Converted \$file to \${basename}.tabular";
             fi
         done
-        #if str($plot.plot_embeddings_conditional.plot_embeddings) == 'yes':
-                && python $__tool_directory__/flexynesis_plot.py
-                    --plot_type dimred
-                    --embeddings output/job.embeddings_test.tabular
+        #if str($training_type.model) == 's_train':
+            #if str($plot.plot_embeddings_conditional.plot_embeddings) == 'yes':
+                    && python '$__tool_directory__/flexynesis_plot.py'
+                        --plot_type dimred
+                        --embeddings output/job.embeddings_test.tabular
+                        --labels output/job.predicted_labels.tabular
+                        --method $plot.plot_embeddings_conditional.method
+                        #if str($training_type.model) == 's_train':
+                            #if str($target_variables) != 'None':
+                                --target_value \$targets
+                            #end if
+                        #end if
+                        --output_dir plots
+                        --format $plot.plot_embeddings_conditional.format
+                        --dpi $plot.plot_embeddings_conditional.dpi
+            #end if
+            #if str($plot.plot_km_conditional.plot_km) == 'yes':
+                #if str($surv_event_var) == '' or str($surv_time_var) == '':
+                    && echo "Survival event and time variables must be specified for Kaplan-Meier plots."
+                    && exit 1
+                #else
+                    && python '$__tool_directory__/flexynesis_plot.py'
+                        --plot_type kaplan_meier
+                        --labels output/job.predicted_labels.tabular
+                        --survival_data input/test/clin.csv
+                        --surv_event_var \$survival_event
+                        --surv_time_var \$survival_time
+                        --output_dir plots
+                        --format $plot.plot_km_conditional.format
+                        --dpi $plot.plot_km_conditional.dpi
+                #end if
+            #end if
+            #if str($plot.plot_cox_conditional.plot_cox) == 'yes':
+                #if str($surv_event_var) == '' or str($surv_time_var) == '':
+                    && echo "Survival event and time variables must be specified for cox plots."
+                    && exit 1
+                #else
+                    && python '$__tool_directory__/flexynesis_plot.py'
+                        --plot_type cox
+                        #if str($feature_importance_method) == 'GradientShap':
+                            --important_features output/job.feature_importance.GradientShap.tabular
+                        #else if str($feature_importance_method) == 'IntegratedGradients':
+                            --important_features output/job.feature_importance.IntegratedGradients.tabular
+                        #else
+                            --important_features output/job.feature_importance.IntegratedGradients.tabular
+                        #end if
+                        --clinical_train input/train/clin.csv
+                        --clinical_test input/test/clin.csv
+                        #if str($plot.plot_cox_conditional.omics_name) != '':
+                            #set $omics_name = str($plot.plot_cox_conditional.omics_name.replace(" ", "_"))
+                            --omics_train input/train/${omics_name}.csv
+                            --omics_test input/test/${omics_name}.csv
+                            --layer ${omics_name}
+                        #else
+                            --omics_train input/train/${data_names}.csv
+                            --omics_test input/test/${data_names}.csv
+                            --layer ${data_names}
+                        #end if
+                        --surv_time_var \$survival_time
+                        --surv_event_var \$survival_event
+                        #if str($plot.plot_cox_conditional.clinical_variables) != 'None':
+                            --clinical_variables \$covars
+                        #end if
+                        --top_features $plot.plot_cox_conditional.top_features
+                        #if str($plot.plot_cox_conditional.crossval_conditional.crossval) == 'yes':
+                            --crossval
+                        #end if
+                        #if str($plot.plot_cox_conditional.crossval_conditional.crossval) == 'yes':
+                            --n_splits $plot.plot_cox_conditional.crossval_conditional.n_splits
+                        #end if
+                        --random_state 42
+                        --output_dir plots
+                        --format $plot.plot_cox_conditional.format
+                        --dpi $plot.plot_cox_conditional.dpi
+                #end if
+            #end if
+            #if str($plot.plot_scatter_conditional.plot_scatter) == 'yes':
+                && python '$__tool_directory__/flexynesis_plot.py'
+                    --plot_type scatter
                     --labels output/job.predicted_labels.tabular
-                    --method $plot.plot_embeddings_conditional.method
                     #if str($training_type.model) == 's_train':
-                        #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                            --target_value \$target_value
+                        #if str($target_variables) != 'None':
+                            --target_value \$targets
                         #end if
                     #end if
                     --output_dir plots
-                    --format $plot.plot_embeddings_conditional.format
-                    --dpi $plot.plot_embeddings_conditional.dpi
-        #end if
-        #if str($plot.plot_km_conditional.plot_km) == 'yes':
-            #if str($surv_event_var) == '' or str($surv_time_var) == '':
-                && echo "Survival event and time variables must be specified for Kaplan-Meier plots."
-                && exit 1
-            #else
-                && python $__tool_directory__/flexynesis_plot.py
-                    --plot_type kaplan_meier
-                    --labels output/job.predicted_labels.tabular
-                    --survival_data input/test/clin.csv
-                    --surv_event_var \$surv_event_var
-                    --surv_time_var \$surv_time_var
-                    --event_value $plot.plot_km_conditional.event_value
-                    --output_dir plots
-                    --format $plot.plot_km_conditional.format
-                    --dpi $plot.plot_km_conditional.dpi
+                    --format $plot.plot_scatter_conditional.format
+                    --dpi $plot.plot_scatter_conditional.dpi
             #end if
-        #end if
-        #if str($plot.plot_cox_conditional.plot_cox) == 'yes':
-            #if str($surv_event_var) == '' or str($surv_time_var) == '':
-                && echo "Survival event and time variables must be specified for cox plots."
-                && exit 1
-            #else
-                && python $__tool_directory__/flexynesis_plot.py
-                    --plot_type cox
-                    --model output/job.final_model.pth
-                    --clinical_train input/train/clin.csv
-                    --clinical_test input/test/clin.csv
-                    #if str($plot.plot_cox_conditional.omics_name) != '':
-                        #set $name = str($plot.plot_cox_conditional.omics_name.replace(" ", "_"))
-                        --omics_train input/train/${name}.csv
-                        --omics_test input/test/${name}.csv
-                    #else
-                        --omics_train input/train/main.csv
-                        --omics_test input/test/main.csv
+            #if str($plot.plot_concordance_conditional.plot_concordance) == 'yes':
+                && python '$__tool_directory__/flexynesis_plot.py'
+                    --plot_type concordance_heatmap
+                    --labels output/job.predicted_labels.tabular
+                    #if str($training_type.model) == 's_train':
+                        #if str($target_variables) != 'None':
+                            --target_value \$targets
+                        #end if
                     #end if
-                    --surv_time_var \$surv_time_var
-                    --surv_event_var \$surv_event_var
-                    #if str($plot.plot_cox_conditional.clinical_variables) != '':
-                        --clinical_variables $str($plot.plot_cox_conditional.clinical_variables)
-                    #end if
-                    --top_features $plot.plot_cox_conditional.top_features
-                    --event_value $plot.plot_cox_conditional.event_value
-                    #if str($plot.plot_cox_conditional.crossval_conditional.crossval) == 'yes':
-                        --crossval
-                    #end if
-                   #if str($plot.plot_cox_conditional.crossval_conditional.crossval) == 'yes':
-                        --n_splits $plot.plot_cox_conditional.crossval_conditional.n_splits
-                    #end if
-                    --random_state 42
                     --output_dir plots
-                    --format $plot.plot_cox_conditional.format
-                    --dpi $plot.plot_cox_conditional.dpi
+                    --format $plot.plot_concordance_conditional.format
+                    --dpi $plot.plot_concordance_conditional.dpi
             #end if
-        #end if
-        #if str($plot.plot_scatter_conditional.plot_scatter) == 'yes':
-            && python $__tool_directory__/flexynesis_plot.py
-                --plot_type scatter
-                --labels output/job.predicted_labels.tabular
-                #if str($training_type.model) == 's_train':
-                    #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                        --target_value \$target_value
-                    #end if
-                #end if
-                --output_dir plots
-                --format $plot.plot_scatter_conditional.format
-                --dpi $plot.plot_scatter_conditional.dpi
-        #end if
-        #if str($plot.plot_concordance_conditional.plot_concordance) == 'yes':
-            && python $__tool_directory__/flexynesis_plot.py
-                --plot_type concordance_heatmap
-                --labels output/job.predicted_labels.tabular
-                #if str($training_type.model) == 's_train':
-                    #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                        --target_value \$target_value
+            #if str($plot.plot_pr_curves_conditional.plot_pr_curves) == 'yes':
+                && python '$__tool_directory__/flexynesis_plot.py'
+                    --plot_type pr_curve
+                    --labels output/job.predicted_labels.tabular
+                    #if str($training_type.model) == 's_train':
+                        #if str($target_variables) != 'None':
+                            --target_value \$targets
+                        #end if
                     #end if
-                #end if
-                --output_dir plots
-                --format $plot.plot_concordance_conditional.format
-                --dpi $plot.plot_concordance_conditional.dpi
-        #end if
-        #if str($plot.plot_pr_curves_conditional.plot_pr_curves) == 'yes':
-            && python $__tool_directory__/flexynesis_plot.py
-                --plot_type pr_curve
-                --labels output/job.predicted_labels.tabular
-                #if str($training_type.model) == 's_train':
-                    #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                        --target_value \$target_value
+                    --output_dir plots
+                    --format $plot.plot_pr_curves_conditional.format
+                    --dpi $plot.plot_pr_curves_conditional.dpi
+            #end if
+            #if str($plot.plot_roc_curves_conditional.plot_roc_curves) == 'yes':
+                && python '$__tool_directory__/flexynesis_plot.py'
+                    --plot_type roc_curve
+                    --labels output/job.predicted_labels.tabular
+                    #if str($training_type.model) == 's_train':
+                        #if str($target_variables) != 'None':
+                            --target_value \$targets
+                        #end if
                     #end if
-                #end if
-                --output_dir plots
-                --format $plot.plot_pr_curves_conditional.format
-                --dpi $plot.plot_pr_curves_conditional.dpi
-        #end if
-        #if str($plot.plot_roc_curves_conditional.plot_roc_curves) == 'yes':
-            && python $__tool_directory__/flexynesis_plot.py
-                --plot_type roc_curve
-                --labels output/job.predicted_labels.tabular
-                #if str($training_type.model) == 's_train':
-                    #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                        --target_value \$target_value
+                    --output_dir plots
+                    --format $plot.plot_roc_curves_conditional.format
+                    --dpi $plot.plot_roc_curves_conditional.dpi
+            #end if
+            #if str($plot.plot_boxplot_conditional.plot_boxplot) == 'yes':
+                && python '$__tool_directory__/flexynesis_plot.py'
+                    --plot_type box_plot
+                    --labels output/job.predicted_labels.tabular
+                    #if str($training_type.model) == 's_train':
+                        #if str($target_variables) != 'None':
+                            --target_value \$targets
+                        #end if
                     #end if
-                #end if
-                --output_dir plots
-                --format $plot.plot_roc_curves_conditional.format
-                --dpi $plot.plot_roc_curves_conditional.dpi
-        #end if
-        #if str($plot.plot_boxplot_conditional.plot_boxplot) == 'yes':
-            && python $__tool_directory__/flexynesis_plot.py
-                --plot_type box_plot
-                --labels output/job.predicted_labels.tabular
-                #if str($training_type.model) == 's_train':
-                    #if len($targets) > 0 or (str($surv_event_var) != 'None' and str($surv_time_var) != 'None'):
-                        --target_value \$target_value
-                    #end if
-                #end if
-                --output_dir plots
-                --format $plot.plot_boxplot_conditional.format
-                --dpi $plot.plot_boxplot_conditional.dpi
+                    --output_dir plots
+                    --format $plot.plot_boxplot_conditional.format
+                    --dpi $plot.plot_boxplot_conditional.dpi
+            #end if
         #end if
     ]]></command>
     <inputs>
@@ -328,12 +346,119 @@
                     <when value="RandomSurvivalForest"/>
                     <when value="XGBoost"/>
                 </conditional>
-                <repeat name="targets" min="0" title="Target variables">
-                    <param argument="--target_variables" type="data_column" data_ref="train_clin" optional="false" label="Column name in the train clinical data to use for predictions, multiple targets are allowed"/>
-                </repeat>
+                <param argument="--target_variables" type="data_column" data_ref="train_clin" optional="true" multiple="true" label="Column name in the train clinical data to use for predictions, multiple targets are allowed"/>
                 <param argument="--surv_event_var" type="data_column" data_ref="train_clin" optional="true" label="Column name in the train clinical data to use as survival event"/>
                 <param argument="--surv_time_var" type="data_column" data_ref="train_clin" optional="true" label="Column name in the train clinical data to use as survival time"/>
                 <expand macro="advanced"/>
+                <section name="plot" title="Visualization">
+                    <conditional name="plot_embeddings_conditional">
+                        <param name="plot_embeddings" type="select" label="Generate embeddings plot?" help="Generate PCA or UMAP plot of the test dataset">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <param name="method" type="select" label="Transformation method">
+                                <option value="pca" selected="true">PCA</option>
+                                <option value="umap">UMAP</option>
+                            </param>
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_km_conditional">
+                        <param name="plot_km" type="select" label="Generate kaplan meier curves plot?" help="Generate KM curves plot of risk subtype based on predicted events probabilities">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_cox_conditional">
+                        <param name="plot_cox" type="select" label="Generate hazard ratio plot?" help="Performs Cox regression on data based on top features and selected clinical covariates.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <param name="omics_name" type="text" label="Omics layer to use for cox input" optional="true" help="If not specified, the first omics layer will be used.">
+                                <expand macro="sanitizer_printable"/>
+                            </param>
+                            <param argument="--clinical_variables" type="data_column" data_ref="train_clin" optional="true" multiple="true" label="Columns in the train clinical data to use as clinical covariates and include in the Cox model (e.g SEX, AGE, ...), multiple covariates are allowed"/>
+                            <param argument="--top_features" type="integer" min="1" value="20" label="Number of top important features to include in Cox model"/>
+                            <conditional name="crossval_conditional">
+                                <param name="crossval" type="select" label="Performs K-fold cross-validation?">
+                                    <option value="yes">Yes</option>
+                                    <option value="no" selected="true">No</option>
+                                </param>
+                                <when value="yes">
+                                    <param name="n_splits" type="integer" min="2" value="5" label="Number of folds for cross-validation"/>
+                                </when>
+                                <when value="no"/>
+                            </conditional>
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_scatter_conditional">
+                        <param name="plot_scatter" type="select" label="Generate scatter plot?" help="Generates a scatter plot of numeric true and predicted labels for all available targets.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_concordance_conditional">
+                        <param name="plot_concordance" type="select" label="Generate concordance heatmap plot?" help="Generates a plot showing the concordance between true and predicted labels for all targets.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_pr_curves_conditional">
+                        <param name="plot_pr_curves" type="select" label="Generate precision-recall curves plot?" help="Generates precision-recall curves for all available targets.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_roc_curves_conditional">
+                        <param name="plot_roc_curves" type="select" label="Generate ROC curves plot?" help="Generates ROC curves for all available targets.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                    <conditional name="plot_boxplot_conditional">
+                        <param name="plot_boxplot" type="select" label="Generate boxplot?" help="Generates a boxplot for all available targets.">
+                            <option value="yes">Yes</option>
+                            <option value="no" selected="true">No</option>
+                        </param>
+                        <when value="no">
+                        </when>
+                        <when value="yes">
+                            <expand macro="plots_common_param"/>
+                        </when>
+                    </conditional>
+                </section>
             </when>
             <when value="us_train">
                 <expand macro="main_inputs"/>
@@ -364,131 +489,14 @@
                 <expand macro="advanced"/>
             </when>
         </conditional>
-        <section name="plot" title="Visualization">
-            <conditional name="plot_embeddings_conditional">
-                <param name="plot_embeddings" type="select" label="Generate embeddings plot?" help="Generate PCA or UMAP plot of the test dataset">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <param name="method" type="select" label="Transformation method">
-                        <option value="pca" selected="true">PCA</option>
-                        <option value="umap">UMAP</option>
-                    </param>
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_km_conditional">
-                <param name="plot_km" type="select" label="Generate kaplan meier curves plot?" help="Generate KM curves plot of risk subtype based on predicted events probabilities">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <param name="event_value" type="text" label="Event value" optional="false" help="The value in the event column that indicates an event (e.g. death) has occurred.">
-                        <expand macro="sanitizer_printable"/>
-                    </param>
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_cox_conditional">
-                <param name="plot_cox" type="select" label="Generate hazard ratio plot?" help="Performs Cox regression on data based on top features and selected clinical covariates.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <param name="omics_name" type="text" label="Omics layer to use for cox input" optional="false" help="If not specified, the first omics layer will be used.">
-                        <expand macro="sanitizer_printable"/>
-                    </param>
-                    <param name="clinical_variables" type="text" label="Clinical covariates" optional="true" help="Comma-separated list of clinical covariates to include in the Cox model (e.g SEX, AGE, ...).">
-                        <expand macro="sanitizer_printable"/>
-                    </param>
-                    <param argument="--top_features" type="integer" min="1" value="20" label="Number of top important features to include in Cox model"/>
-                    <param name="event_value" type="text" label="Event value" optional="false" help="The value in the event column that indicates an event (e.g. death) has occurred.">
-                        <expand macro="sanitizer_printable"/>
-                    </param>
-                    <conditional name="crossval_conditional">
-                        <param name="crossval" type="select" label="Performs K-fold cross-validation?">
-                            <option value="yes">Yes</option>
-                            <option value="no" selected="true">No</option>
-                        </param>
-                        <when value="yes">
-                            <param name="n_splits" type="integer" min="2" value="5" label="Number of folds for cross-validation"/>
-                        </when>
-                        <when value="no"/>
-                    </conditional>
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_scatter_conditional">
-                <param name="plot_scatter" type="select" label="Generate scatter plot?" help="Generates a scatter plot of numeric true and predicted labels for all available targets.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_concordance_conditional">
-                <param name="plot_concordance" type="select" label="Generate concordance heatmap plot?" help="Generates a plot showing the concordance between true and predicted labels for all targets.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_pr_curves_conditional">
-                <param name="plot_pr_curves" type="select" label="Generate precision-recall curves plot?" help="Generates precision-recall curves for all available targets.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_roc_curves_conditional">
-                <param name="plot_roc_curves" type="select" label="Generate ROC curves plot?" help="Generates ROC curves for all available targets.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-            <conditional name="plot_boxplot_conditional">
-                <param name="plot_boxplot" type="select" label="Generate boxplot?" help="Generates a boxplot for all available targets.">
-                    <option value="yes">Yes</option>
-                    <option value="no" selected="true">No</option>
-                </param>
-                <when value="no">
-                </when>
-                <when value="yes">
-                    <expand macro="plots_common_param"/>
-                </when>
-            </conditional>
-        </section>
     </inputs>
     <outputs>
         <collection name="results" type="list" label="${tool.name} on ${on_string}: results">
             <discover_datasets pattern="(?P&lt;name&gt;.+)\.tabular$" format="tabular" directory="output"/>
         </collection>
-        <collection name="plots" type="list" label="${tool.name} on ${on_string}: embeddings plots">
+        <collection name="plots" type="list" label="${tool.name} on ${on_string}: plots">
             <discover_datasets pattern="__name_and_ext__" directory="plots"/>
-            <filter>plot['plot_embeddings_conditional']['plot_embeddings'] == 'yes' or plot['plot_km_conditional']['plot_km'] == 'yes' or plot['plot_cox_conditional']['plot_cox'] == 'yes' or plot['plot_scatter_conditional']['plot_scatter'] == 'yes' or plot['plot_concordance_conditional']['plot_concordance'] == 'yes' or plot['plot_pr_curves_conditional']['plot_pr_curves'] == 'yes' or plot['plot_roc_curves_conditional']['plot_roc_curves'] == 'yes' or plot['plot_boxplot_conditional']['plot_boxplot'] == 'yes'</filter>
+            <filter>training_type['model'] == 's_train' and (training_type['plot']['plot_embeddings_conditional']['plot_embeddings'] == 'yes' or training_type['plot']['plot_km_conditional']['plot_km'] == 'yes' or training_type['plot']['plot_cox_conditional']['plot_cox'] == 'yes' or training_type['plot']['plot_scatter_conditional']['plot_scatter'] == 'yes' or training_type['plot']['plot_concordance_conditional']['plot_concordance'] == 'yes' or training_type['plot']['plot_pr_curves_conditional']['plot_pr_curves'] == 'yes' or training_type['plot']['plot_roc_curves_conditional']['plot_roc_curves'] == 'yes' or training_type['plot']['plot_boxplot_conditional']['plot_boxplot'] == 'yes')</filter>
         </collection>
     </outputs>
     <tests>
@@ -510,9 +518,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -547,7 +553,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -580,9 +586,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -650,9 +654,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="4"/>
-                </repeat>
+                <param name="target_variables" value="4"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -687,7 +689,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -743,7 +745,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -788,17 +790,17 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.test_decoded.omics_foo">
+                <element name="job.test_decoded.foo">
                     <assert_contents>
                         <has_n_lines n="23"/>
                     </assert_contents>
                 </element>
-                <element name="job.train_decoded.omics_foo">
+                <element name="job.train_decoded.foo">
                     <assert_contents>
                         <has_n_lines n="23"/>
                     </assert_contents>
@@ -826,9 +828,7 @@
                     <param name="string_organism" value="9606"/>
                     <param name="string_node_name" value="gene_name"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -863,7 +863,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -919,7 +919,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_f_oo">
+                <element name="job.feature_logs.f_oo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -944,9 +944,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="XGBoost"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -979,9 +977,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                     <param name="feature_importance_method" value="IntegratedGradients"/>
@@ -1010,7 +1006,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -1048,21 +1044,19 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
+                <param name="target_variables" value="3"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
+                <section name="plot">
+                    <conditional name="plot_embeddings_conditional">
+                        <param name="plot_embeddings" value="yes"/>
+                        <param name="method" value="pca"/>
+                        <param name="format" value="jpg"/>
+                        <param name="dpi" value="300"/>
+                    </conditional>
+                </section>
             </conditional>
-            <section name="plot">
-                <conditional name="plot_embeddings_conditional">
-                    <param name="plot_embeddings" value="yes"/>
-                    <param name="method" value="pca"/>
-                    <param name="format" value="jpg"/>
-                    <param name="dpi" value="300"/>
-                </conditional>
-            </section>
             <output_collection name="results" type="list">
                 <element name="job.embeddings_test">
                     <assert_contents>
@@ -1093,7 +1087,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>
@@ -1137,7 +1131,6 @@
                 <section name="plot">
                     <conditional name="plot_km_conditional">
                         <param name="plot_km" value="yes"/>
-                        <param name="event_value" value="1:DECEASED"/>
                         <param name="format" value="jpg"/>
                         <param name="dpi" value="300"/>
                     </conditional>
@@ -1161,16 +1154,15 @@
                     <conditional name="plot_cox_conditional">
                         <param name="plot_cox" value="yes"/>
                         <param name="omics_name" value="bar"/>
-                        <param name="clinical_variables" value="Crizotinib,   Erlotinib"/>
+                        <param name="clinical_variables" value="2,3"/>
                         <param name="top_features" value="10"/>
-                        <param name="event_value" value="1:DECEASED"/>
                         <param name="format" value="jpg"/>
                         <param name="dpi" value="300"/>
                     </conditional>
                 </section>
             </expand>
             <output_collection name="plots" type="list">
-                <element name="job.final_model_cox_hazard_ratios">
+                <element name="job.feature_importance.IntegratedGradients_cox_hazard_ratios">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="972,737" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1216,24 +1208,17 @@
             <output_collection name="plots" type="list">
                 <element name="job.predicted_labels_concordance_Erlotinib">
                     <assert_contents>
-                        <has_image_center_of_mass center_of_mass="1547,1620" eps="30"/>
+                        <has_image_center_of_mass center_of_mass="1547,1590" eps="30"/>
                         <has_image_channels channels="3"/>
-                        <has_image_height height="3060" delta="50"/>
+                        <has_image_height height="3000" delta="50"/>
                         <has_image_width width="3192" delta="50"/>
                     </assert_contents>
                 </element>
-                <element name="job.predicted_labels_concordance_OS_STATUS">
-                    <assert_contents>
-                        <has_image_channels channels="3"/>
-                        <has_image_height height="2558" delta="50"/>
-                        <has_image_width width="2794" delta="50"/>
-                    </assert_contents>
-                </element>
             </output_collection>
         </test>
         <!-- test 15: pr curve plot -->
         <test expect_num_outputs="2">
-            <expand macro="common_test">
+            <expand macro="common_test_class">
                 <section name="plot">
                     <conditional name="plot_pr_curves_conditional">
                         <param name="plot_pr_curves" value="yes"/>
@@ -1243,7 +1228,7 @@
                 </section>
             </expand>
             <output_collection name="plots" type="list">
-                <element name="job.predicted_labels_pr_curves_OS_STATUS">
+                <element name="job.predicted_labels_pr_curves_class">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="975,732" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1255,7 +1240,7 @@
         </test>
         <!-- test 16: roc curve plot -->
         <test expect_num_outputs="2">
-            <expand macro="common_test">
+            <expand macro="common_test_class">
                 <section name="plot">
                     <conditional name="plot_roc_curves_conditional">
                         <param name="plot_roc_curves" value="yes"/>
@@ -1265,7 +1250,7 @@
                 </section>
             </expand>
             <output_collection name="plots" type="list">
-                <element name="job.predicted_labels_roc_curves_OS_STATUS">
+                <element name="job.predicted_labels_roc_curves_class">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="970,730" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1277,7 +1262,7 @@
         </test>
         <!-- test 17: boxplot plot -->
         <test expect_num_outputs="2">
-            <expand macro="common_test">
+            <expand macro="common_test_class">
             <section name="plot">
                 <conditional name="plot_boxplot_conditional">
                     <param name="plot_boxplot" value="yes"/>
@@ -1287,7 +1272,7 @@
             </section>
             </expand>
             <output_collection name="plots" type="list">
-                <element name="job.predicted_labels_box_plot_OS_STATUS_0_LIVING">
+                <element name="job.predicted_labels_box_plot_class_buz">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="1485,882" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1295,7 +1280,7 @@
                         <has_image_width width="2967" delta="20"/>
                     </assert_contents>
                 </element>
-                <element name="job.predicted_labels_box_plot_OS_STATUS_1_DECEASED">
+                <element name="job.predicted_labels_box_plot_class_qux">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="1485,882" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1312,9 +1297,8 @@
                     <conditional name="plot_cox_conditional">
                         <param name="plot_cox" value="yes"/>
                         <param name="omics_name" value="bar"/>
-                        <param name="clinical_variables" value="Crizotinib,   Erlotinib"/>
+                        <param name="clinical_variables" value="2,3"/>
                         <param name="top_features" value="10"/>
-                        <param name="event_value" value="1:DECEASED"/>
                         <conditional name="crossval_conditional">
                             <param name="crossval" value="yes"/>
                             <param name="n_splits" value="5"/>
@@ -1325,7 +1309,7 @@
                 </section>
             </expand>
             <output_collection name="plots" type="list">
-                <element name="job.final_model_cox_hazard_ratios">
+                <element name="job.feature_importance.IntegratedGradients_cox_hazard_ratios">
                     <assert_contents>
                         <has_image_center_of_mass center_of_mass="972,737" eps="20"/>
                         <has_image_channels channels="3"/>
@@ -1353,12 +1337,7 @@
                 <conditional name="model_class">
                     <param name="model_class" value="DirectPred"/>
                 </conditional>
-                <repeat name="targets">
-                    <param name="target_variables" value="3"/>
-                </repeat>
-                <repeat name="targets">
-                    <param name="target_variables" value="2"/>
-                </repeat>
+                <param name="target_variables" value="3,2"/>
                 <section name="advanced">
                     <param name="hpo_iter" value="1"/>
                 </section>
@@ -1400,7 +1379,7 @@
                         <has_n_lines n="25"/>
                     </assert_contents>
                 </element>
-                <element name="job.feature_logs.omics_foo">
+                <element name="job.feature_logs.foo">
                     <assert_contents>
                         <has_n_lines n="25"/>
                     </assert_contents>