view recetox_aplcms_generate_feature_table.xml @ 7:32b66fb6a6a0 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit 97249a1af94ac5c387e1ede274dec5364f71cde9
author recetox
date Wed, 11 Oct 2023 11:17:54 +0000
parents e7305ba0dd38
children
line wrap: on
line source

<tool id="recetox_aplcms_generate_feature_table" name="recetox-aplcms - generate feature table" version="@TOOL_VERSION@+galaxy3" profile="21.09">
    <description>generate feature table from noise-removed HRMS profile data</description>
    <macros>
        <import>macros.xml</import>
        <import>help.xml</import>
    </macros>
    <expand macro="annotation"/>
    <edam_operations>
        <edam_operation>operation_3215</edam_operation>
        <edam_operation>operation_3799</edam_operation>
    </edam_operations>
    <expand macro="refs"/>
    <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[
             profile <- load_data_from_parquet_file('$profile')
             sample_name <- load_sample_name(profile)

             if(is.na(sample_name)) {
                 message("The file does not contain sample name.")
             }

             feature_table <- prof.to.features(
                 profile = profile,
                 bandwidth = $bandwidth,
                 #if $min_bandwidth:
                 min_bandwidth = $min_bandwidth,
                 #else:
                 min_bandwidth = NA,
                 #end if
                 #if $max_bandwidth:
                 max_bandwidth = $max_bandwidth,
                 #else:
                 max_bandwidth = NA,
                 #end if
                 #if $advanced.sd_cut.sd_cut_bounds == "TRUE":
                 sd_cut = c($advanced.sd_cut.sd_cut_min, $advanced.sd_cut.sd_cut_max),
                 #else
                 sd_cut = c(0, Inf),
                 #end if
                 sigma_ratio_lim = determine_sigma_ratios($advanced.shape_model.sigma_ratio_lim_min, $advanced.shape_model.sigma_ratio_lim_max),
                 shape_model = "bi-Gaussian",
                 peak_estim_method = "$advanced.peak_estim.peak_estim_method",
                 component_eliminate = $advanced.component_eliminate,
                 #if $advanced.peak_estim.peak_estim_method == "moment":
                 moment_power = $advanced.peak_estim.moment_power,
                 #else
                 moment_power = 1,
                 #end if
                 BIC_factor = $BIC_factor,
                 do.plot = FALSE
             )

             feature_table <- save_sample_name(feature_table, sample_name)
             save_data_as_parquet_file(feature_table, '$output_file')
         ]]></configfile>
    </configfiles>

    <inputs>
        <param label="Input profile data" name="profile" type="data" format="parquet"
               help="Mass spectrometry profile data." />
        <expand macro="bandwidth_params"/>
        <expand macro="generate_feature_table_params"/>
    </inputs>

    <outputs>
        <data label="${($profile.element_identifier).rsplit('.',1)[0]}.parquet" name="output_file" format="parquet" />
    </outputs>

    <tests>
        <test expect_failure="true" />
        <test>
            <param name="profile" value="remove_noise_docker.parquet" />
            <output name="output_file" file="peak_table_galaxy.parquet" />
        </test>
    </tests>

    <help>
        <![CDATA[
            @GENERATE_FEATURE_TABLE_HELP@

            @GENERAL_HELP@
        ]]>
    </help>

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