view recetox_aplcms_compute_clusters.xml @ 1:092bbb03a217 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit 4254c6f6f05915ceab5af5d7040ac2c44a8364b4
author recetox
date Mon, 03 Apr 2023 14:56:58 +0000
parents 82737757f3d5
children ce00e1d03c31
line wrap: on
line source

<tool id="recetox_aplcms_compute_clusters" name="recetox-aplcms - compute clusters" version="@TOOL_VERSION@+galaxy0">
    <description>compute clusters of mz and rt across samples and assign cluster IDs to individual features</description>
    <macros>
        <import>macros.xml</import>
        <import>help.xml</import>
    </macros>
    <expand macro="creator"/>
    <expand macro="requirements"/>

    <command detect_errors="aggressive"><![CDATA[
        Rscript -e 'source("${__tool_directory__}/utils.R")' -e 'source("${run_script}")'
    ]]></command>
    <configfiles>
         <configfile name="run_script"><![CDATA[
              #set filenames = str("', '").join([str($f) for $f in $files])
              feature_tables <- load_parquet_collection(c('$filenames'))
              sample_names <- unlist(lapply(feature_tables, load_sample_name))

              validate_sample_names(sample_names)

              ordering <- order(sample_names)
              feature_tables <- feature_tables[ordering]
              sample_names <- sample_names[ordering]

              #if $tolerances_input_method.input_method == "file"
              tolerances <- load_data_from_parquet_file('$input_tolerances')
              #end if

              clusters <- compute_clusters(
                  feature_tables = feature_tables,
                  #if $tolerances_input_method.input_method == "file"
                  mz_tol_relative = get_mz_tol(tolerances),
                  rt_tol_relative = get_rt_tol(tolerances),
                  #else
                  #if $tolerances_input_method.mz_tol_relative:
                  mz_tol_relative = $tolerances_input_method.mz_tol_relative,
                  #else:
                  mz_tol_relative = NA,
                  #end if
                  #if $tolerances_input_method.rt_tol_relative:
                  rt_tol_relative = $tolerances_input_method.rt_tol_relative,
                  #else:
                  rt_tol_relative = NA,
                  #end if
                  #end if
                  mz_max_diff = 10 * $mz_max_diff,
                  mz_tol_absolute = $mz_tol_absolute,
                  sample_names = sample_names,
                  do.plot = FALSE
              )

              save_parquet_collection(clusters, sample_names, "clustered")
              save_tolerances(clusters, '$tolerances')
         ]]></configfile>
    </configfiles>

    <inputs>
        <param name="files" type="data_collection" collection_type="list" format="parquet" label="Input data"
               help="List of tables containing features." />
        <expand macro="compute_clusters_params"/>
    </inputs>

    <outputs>
        <collection name="clustered_feature_tables" type="list"
                    label="${tool.name} feature_tables on ${on_string}">
            <discover_datasets pattern="__designation__" directory="clustered" format="parquet" />
        </collection>
        <data name="tolerances" format="parquet" label="${tool.name} on ${on_string} (updated tolerances)" />
    </outputs>

    <tests>

    </tests>

    <help>
        <![CDATA[
            @COMPUTE_CLUSTERS_HELP@

            @GENERAL_HELP@
        ]]>
    </help>

    <expand macro="citations"/>
</tool>