Repository 'recetox_aplcms_generate_feature_table'
hg clone https://toolshed.g2.bx.psu.edu/repos/recetox/recetox_aplcms_generate_feature_table

Changeset 1:e8962c8340f4 (2023-04-03)
Previous changeset 0:2810c956ec39 (2023-02-13) Next changeset 2:73d8537dcbd6 (2023-05-24)
Commit message:
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit 4254c6f6f05915ceab5af5d7040ac2c44a8364b4
modified:
macros.xml
recetox_aplcms_generate_feature_table.xml
utils.R
b
diff -r 2810c956ec39 -r e8962c8340f4 macros.xml
--- a/macros.xml Mon Feb 13 10:26:41 2023 +0000
+++ b/macros.xml Mon Apr 03 14:57:14 2023 +0000
[
b'@@ -1,5 +1,5 @@\n <macros>\r\n-    <token name="@TOOL_VERSION@">0.10.1</token>\r\n+    <token name="@TOOL_VERSION@">0.10.3</token>\r\n     <xml name="requirements">\r\n         <requirements>\r\n             <requirement type="package" version="@TOOL_VERSION@">r-recetox-aplcms</requirement>\r\n@@ -42,47 +42,55 @@\n     </xml>\r\n \r\n     <xml name="remove_noise_params">\r\n-        <param name="min_pres" type="float" value="0.5" label="min_pres"\r\n+        <param name="min_pres" type="float" value="0.5" label="Minimal signal presence [fraction of scans]"\r\n                help="The minimum proportion of presence in the time period for a series of signals grouped by m/z to be considered a peak." />\r\n-        <param name="min_run" type="float" value="12" label="min_run"\r\n+        <param name="min_run" type="float" value="12" label="Minimal elution time [unit corresponds to the retention time]"\r\n                help="The minimum length of elution time for a series of signals grouped by m/z to be considered a peak." />\r\n-        <param name="mz_tol" type="float" value="1e-05" label="mz_tol"\r\n-               help="The m/z tolerance level for the grouping of data points. This value is expressed as the fraction of the m/z value. This value, multiplied by the m/z value, becomes the cutoff level. The recommended value is the machine\'s nominal accuracy level. Divide the ppm value by 1e6. For FTMS, 1e-5 is recommended." />\r\n-        <param name="baseline_correct" type="float" value="0" label="baseline_correct"\r\n-               help="After grouping the observations, the highest intensity in each group is found. If the highest is lower than this value, the entire group will be deleted. The default value is NA, in which case the program uses a percentile of the height of the noise groups. If given a value, the value will be used as the threshold, and baseline.correct.noise.percentile will be ignored." />\r\n-        <param name="intensity_weighted" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="intensity_weighted"\r\n+        <param name="mz_tol" type="float" value="10" label="m/z tolerance [ppm]"\r\n+               help="The m/z tolerance level for the grouping of data points. This value is expressed as the fraction of the m/z value.\r\n+               This value, multiplied by the m/z value, becomes the cutoff level.\r\n+               The recommended value is the machine\'s nominal accuracy level (e.g. for FTMS, it is 10)." />\r\n+        <param name="baseline_correct" type="float" value="0" label="Baseline correction [unit of signal intensity]"\r\n+               help="After grouping the observations, the highest intensity in each group is found. If the highest is lower than this value, the entire group will be deleted." />\r\n+        <param name="intensity_weighted" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Weight intensity"\r\n                help="Whether to weight the local density by signal intensities in initial peak detection." />\r\n     </xml>\r\n \r\n     <xml name="generate_feature_table_params">\r\n-        <param name="sd_cut_min" type="float" value="0.01" label="sd_cut_min"\r\n-               help="The minimum standard deviation of a feature to be not eliminated." />\r\n-        <param name="sd_cut_max" type="float" value="500" label="sd_cut_max"\r\n-               help="The maximum standard deviation of a feature to be not eliminated." />\r\n-        <conditional name="shape">\r\n-            <param name="shape_model" type="select" display="radio" label="shape_model"\r\n-                   help="The mathematical model for the shape of a peak. There are two choices - bi-Gaussian and Gaussian. When the peaks are asymmetric, the bi-Gaussian is better.">\r\n-                <option value="Gaussian">Gaussian</option>\r\n-                <option value="bi-Gaussian" selected="true">bi-Gaussian</option>\r\n-            </param>\r\n-            <when value="bi-Gaussian">\r\n-                <param name="sigma_ratio_lim_min" type="float" va'..b'  <param name="mz_tol" type="float" value="10" label="m/z tolerance [ppm]"\r\n+               help="The m/z tolerance level for the grouping of data points. This value is expressed as the fraction of the m/z value.\r\n+               This value, multiplied by the m/z value, becomes the cutoff level.\r\n+               The recommended value is the machine\'s nominal accuracy level (e.g. for FTMS, it is 10)." />\r\n+        <param name="recover_mz_range" type="float" optional="true" label="Range for m/z recovery [ppm]"\r\n+\r\n+               help="The m/z around the feature m/z to search for observations. If not given, 1.5 times the m/z tolerance\r\n+               in the aligned object will be used." />\r\n+        <param name="recover_rt_range" type="float" optional="true" label="Range for rt recovery [unit of retention time]"\r\n                help="The retention time around the feature retention time to search for observations.\r\n-               The default value is NA, in which case 0.5 times the retention time tolerance in the aligned\r\n-                object will be used." />\r\n+               If not given, 0.5 times the retention time tolerance in the aligned object will be used." />\r\n         <param name="use_observed_range" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE"\r\n-               label="use_observed_range" help="If the value is true, the actual range of the observed locations of\r\n-               the feature in all the spectra will be used." />\r\n-        <param name="recover_min_count" type="integer" value="3" label="recover_min_count"\r\n+               label="Use observed rt range" help="Use the minimal and maximal rt values per feature." />\r\n+        <param name="recover_min_count" type="integer" value="3" label="Minimal count to recover"\r\n                help="The minimum number of raw data points to be considered as a true feature." />\r\n         <param name="intensity_weighted" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE"\r\n-               label="intensity_weighted" help="Whether to weight the local density by signal intensities in initial peak detection." />\r\n+               label="Weight intensity" help="Whether to weight the local density by signal intensities in initial peak detection." />\r\n     </xml>\r\n \r\n     <xml name="bandwidth_params">\r\n-        <param name="bandwidth" type="float" value="0.5" label="bandwidth"\r\n-               help="A value between zero and one. Multiplying this value to the length of the signal along\r\n-               the time axis helps determine the bandwidth in the kernel smoother used for peak identification." />\r\n-        <param name="min_bandwidth" type="float" optional="true" label="min_bandwidth"\r\n-               help="The minimum bandwidth to use in the kernel smoother." />\r\n-        <param name="max_bandwidth" type="float" optional="true" label="max_bandwidth"\r\n-               help="The maximum bandwidth to use in the kernel smoother." />\r\n+        <param name="bandwidth" type="float" value="0.5" label="Bandwidth factor" min="0" max="1"\r\n+               help="Parameter used to scale down the overall range of retention times (the bandwidth) assumed in the kernel smoother\r\n+               used for peak identification. The value is between zero and one. The minimal and maximal bandwidth can be limited by explicit values." />\r\n+        <param name="min_bandwidth" type="float" optional="true" label="Minimal bandwidth [unit corresponds to the retention time]"\r\n+               help="The lower limit on the resulting bandwidth. If not given, it is estimated based on the overall range of retention times in the profile." />\r\n+        <param name="max_bandwidth" type="float" optional="true" label="Maximal bandwidth [unit corresponds to the retention time]"\r\n+               help="The upper limit on the resulting bandwidth. If not given, it is estimated based on the overall range of retention times in the profile" />\r\n+\r\n     </xml>\r\n \r\n     <xml name="citations">\r\n'
b
diff -r 2810c956ec39 -r e8962c8340f4 recetox_aplcms_generate_feature_table.xml
--- a/recetox_aplcms_generate_feature_table.xml Mon Feb 13 10:26:41 2023 +0000
+++ b/recetox_aplcms_generate_feature_table.xml Mon Apr 03 14:57:14 2023 +0000
b
@@ -32,16 +32,20 @@
                  #else:
                  max_bandwidth = NA,
                  #end if
-                 sd_cut = c($sd_cut_min, $sd_cut_max),
-                 #if $shape.shape_model == "bi-Gaussian":
-                 sigma_ratio_lim = c($shape.sigma_ratio_lim_min, $shape.sigma_ratio_lim_max),
-                 #else:
-                 sigma_ratio_lim = NA,
+                 #if $advanced.sd_cut.sd_cut_bounds == "FALSE":
+                 sd_cut = c($advanced.sd_cut.sd_cut_min, $advanced.sd_cut.sd_cut_max),
+                 #else
+                 sd_cut = c(0, Inf),
                  #end if
-                 shape_model = "$shape.shape_model",
-                 peak_estim_method = "$peak_estim_method",
-                 component_eliminate = $component_eliminate,
-                 moment_power = $moment_power,
+                 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
              )
b
diff -r 2810c956ec39 -r e8962c8340f4 utils.R
--- a/utils.R Mon Feb 13 10:26:41 2023 +0000
+++ b/utils.R Mon Apr 03 14:57:14 2023 +0000
b
@@ -123,3 +123,13 @@
                      paste(sample_names, collapse = ", ")))
     }
 }
+
+determine_sigma_ratios <- function(sigma_ratio_lim_min = NA, sigma_ratio_lim_max = NA) {
+    if (is.na(sigma_ratio_lim_min)) {
+        sigma_ratio_lim_min <- 0
+    }
+    if (is.na(sigma_ratio_lim_max)) {
+        sigma_ratio_lim_max <- Inf
+    }
+    return(c(sigma_ratio_lim_min, sigma_ratio_lim_max))
+}