Repository 'w4mclassfilter'
hg clone https://testtoolshed.g2.bx.psu.edu/repos/eschen42/w4mclassfilter

Changeset 13:b24ca78a425b (2018-09-03)
Previous changeset 12:518cc205f289 (2018-03-02) Next changeset 14:1d36ecf93e67 (2021-03-11)
Commit message:
planemo upload for repository https://github.com/HegemanLab/w4mclassfilter_galaxy_wrapper/tree/master commit 32cf96ed6c39a93eb9c6cf00494b128bd3c3febe
modified:
test-data/rangefilter_dataMatrix.tsv
w4mclassfilter.xml
w4mclassfilter_wrapper.R
b
diff -r 518cc205f289 -r b24ca78a425b test-data/rangefilter_dataMatrix.tsv
--- a/test-data/rangefilter_dataMatrix.tsv Fri Mar 02 08:29:53 2018 -0500
+++ b/test-data/rangefilter_dataMatrix.tsv Mon Sep 03 22:28:03 2018 -0400
b
@@ -1,6 +1,6 @@
  HU_017 HU_028 HU_034 HU_051 HU_060 HU_078 HU_091 HU_093 HU_099 HU_110 HU_130 HU_134 HU_138 HU_149 HU_152 HU_175 HU_178 HU_185 HU_208
-HMDB00191 560002 771533 575790 392284 888498 785428 645785 591569 960658 910201 639437 1092885 1409045 2292023 1246459 1945577 710519 773384 622898
-HMDB00208 747080 13420742 595872 1172376 7172632 3143654 4059767 1433702 5593888 5402629 2477288 3346077 4230072 7621236 8960828 10335722 7037373 1574738 2540044
-HMDB01032 2569205 26023086 1604999 430453 8103558 26222916 257139 675754 59906109 263055 31151730 18648127 14989438 1554658 20249262 5588731 871010 15920 44276
-HMDB01101.1 6877586 52217 3158 10789748 229568 4763576 3878773 976436 831937 608298 1605075 72021 442510 1107705 1464339 31250 2724553 72900 30689
-HMDB13189 2644620 727587 1661412 619181 136278 2755434 593863 837865 3526136 2003278 1608814 3446611 1941527 113937 3132404 2893445 2092753 1034666 841661
+HMDB00191 19.0950724540801 19.5573683394871 19.1351832076319 18.581538968171 19.7610090032025 19.5831195045026 19.3006944055142 19.1741869272827 19.8736633887651 19.7958256457729 19.2864427002132 20.0597101691826 20.4262862563728 21.1281900906526 20.2494039981067 20.8917666482316 19.438513703552 19.5608253922588 19.2486364146654
+HMDB00208 19.5109032146715 23.6779611010349 19.1846429313023 20.1610039089984 22.7740711828923 21.5840110083096 21.9529654992985 20.451313755289 22.4154199380002 22.3652301844309 21.2403301698498 21.6740392144135 22.0122507889717 22.8615935600174 23.0952006159265 23.3011358356974 22.746605551146 20.5866803867983 21.2764220576728
+HMDB01032 21.2928905785523 24.6332887213057 20.6141409677961 18.7154961966847 22.9501240553341 24.6443247870262 17.9721889132336 19.3661386209868 25.8361997953493 18.0050049466979 24.8928089492302 24.1525273990616 23.8374429574498 20.5681658146509 24.2713659930314 22.4140893053724 19.7323297568288 13.958552715431 15.4342372710269
+HMDB01101.1 22.7134708439962 15.6722319530667 11.6247954558602 23.3631578345615 17.8085620299575 22.183613575742 21.8871689158671 19.8971659609365 19.6661147561338 19.214418735272 20.6142092807528 16.1361300108053 18.7553505325418 20.079142288524 20.4818181509538 14.9315685693242 21.3775881248719 16.1536311941017 14.9054340159519
+HMDB13189 21.3346290086766 19.4727602406215 20.6639784491577 19.2400016764968 17.0561931543153 21.3938481405109 19.1797706242895 19.6763582845664 21.7496566885488 20.9339312108399 20.6175661105571 21.7167470481744 20.8887603396637 16.7978767996065 21.5788388647145 21.4643567902489 20.9969706149343 19.9807336965562 19.6828797432404
b
diff -r 518cc205f289 -r b24ca78a425b w4mclassfilter.xml
--- a/w4mclassfilter.xml Fri Mar 02 08:29:53 2018 -0500
+++ b/w4mclassfilter.xml Mon Sep 03 22:28:03 2018 -0400
[
b'@@ -1,461 +1,476 @@\n-<tool id="w4mclassfilter" name="W4m Data Subset" version="0.98.8">\n-  <description>Filter W4m data by values or metadata</description>\n-\n-  <!-- Here is the hyphenation standard that I *try* to apply consistently in my documentation: http://www.sandranoonan.com/dont-let-hyphenation-drive-crazy/ -->\n-\n-  <requirements>\n-    <!-- <requirement type="package" version="6.2">readline</requirement> -->\n-    <requirement type="package" version="3.4.1">r-base</requirement>\n-    <requirement type="package" version="1.1_4">r-batch</requirement>\n-    <requirement type="package" version="0.98.7">w4mclassfilter</requirement>\n-  </requirements>\n-\n-  <stdio>\n-    <exit_code range="1:" level="fatal" />\n-  </stdio>\n-\n-\n-  <command detect_errors="aggressive"><![CDATA[\n-  Rscript $__tool_directory__/w4mclassfilter_wrapper.R\n-  dataMatrix_in \'$dataMatrix_in\'\n-  sampleMetadata_in \'$sampleMetadata_in\'\n-  variableMetadata_in \'$variableMetadata_in\'\n-  sampleclassNames \'$sampleclassNames\'\n-  inclusive \'$inclusive\'\n-  wildcards \'$wildcards\'\n-  classnameColumn \'$classnameColumn\'\n-  samplenameColumn \'sampleMetadata\'\n-  variable_range_filter \'$variableRangeFilter\'\n-\ttransformation \'$transformation\'\n-  dataMatrix_out \'$dataMatrix_out\'\n-  sampleMetadata_out \'$sampleMetadata_out\'\n-  variableMetadata_out \'$variableMetadata_out\'\n-  ]]></command>\n-\n-  <inputs>\n-    <param name="dataMatrix_in" label="Data matrix file" type="data" format="tabular" help="variable x sample, decimal: \'.\', missing: NA, mode: numerical, separator: tab" />\n-    <param name="sampleMetadata_in" label="Sample metadata file" type="data" format="tabular" help="sample x metadata columns, separator: tab" />\n-    <param name="variableMetadata_in" label="Variable metadata file" type="data" format="tabular" help="variable x metadata columns, separator: tab" />\n-    <param name="classnameColumn" label="Column that names the sample-class" type="text" value = "class" help="name of the column in sample metadata that has the values to be tested against the \'Names of sample-classes\' input parameter - defaults to \'class\'">\n-      <sanitizer>\n-        <valid initial="string.letters">\n-          <add preset="string.digits"/>\n-          <add value="&#45;"  /> <!-- dash, hyphen -->\n-          <add value="&#46;"  /> <!-- dot, period -->\n-          <add value="&#95;"  /> <!-- underscore -->\n-        </valid>\n-      </sanitizer>\n-    </param>\n-    <param name="sampleclassNames" label="Names of sample-classes" type="text" value = "" help="comma-separated names (or regular expressions to match names) of sample-classes to filter in or out; defaults to no names">\n-      <sanitizer>\n-        <valid initial="string.letters">\n-          <add preset="string.digits"/>\n-          <add value="&#123;" /> <!-- l-cube, left-curly-bracket -->\n-          <add value="&#124;" /> <!-- pipe -->\n-          <add value="&#125;" /> <!-- r-cube, right-curly-bracket -->\n-          <add value="&#36;"  /> <!-- dollar, dollar-sign -->\n-          <add value="&#40;"  /> <!-- left-paren -->\n-          <add value="&#41;"  /> <!-- right-paren -->\n-          <add value="&#42;"  /> <!-- splat, asterisk -->\n-          <add value="&#43;"  /> <!-- plus -->\n-          <add value="&#44;"  /> <!-- comma -->\n-          <add value="&#46;"  /> <!-- dot, period -->\n-          <add value="&#58;"  /> <!-- colon -->\n-          <add value="&#59;"  /> <!-- semi, semicolon -->\n-          <add value="&#63;"  /> <!-- what, question mark -->\n-          <add value="&#91;"  /> <!-- l-squib, left-squre-bracket -->\n-          <add value="&#92;"  /> <!-- whack, backslash -->\n-          <add value="&#93;"  /> <!-- r-squib, right-squre-bracket -->\n-          <add value="&#94;"  /> <!-- hat, caret -->\n-          <add value="&#95;"  /> <!-- underscore -->\n-        </valid>\n-      </sanitizer>\n-    </param>\n-\n-    <param name="wildcards" label="Use \'wild cards\' or \'regular expressions\'" type="select" help="\'wild-cards\' (the default) - use \'*\' and \'?\' t'..b' sample names and feature names in output files because some statistical tools expect the same order in `dataMatrix` row and column names as in the corresponding metadata files.\n-\n-Changes in version 0.98.3\n-=========================\n-\n-Internal modifications\n-\n-- Improved input handling.\n-- Now uses w4mclassfilter R package v0.98.3, although that version has no functional implications for this tool.\n-- Improved reference-list.\n-\n-Changes in version 0.98.2\n-=========================\n-\n-New features\n-\n-- Added support for R-flavored regular expression pattern-matching when selecting names of sample-classes.\n-- Empty classes argument or zero-length class_column result in no samples filtered out.\n-\n-Internal modifications\n-\n-- Support and tests for new features.\n-\n-Changes in version 0.98.1\n-=========================\n-\n-First release - Wrap the w4mclassfilter R package that implements filtering of W4m data matrix, variable metadata, and sample metadata by class of sample.\n-\n-New features\n-\n-- Output *dataMatrix*       is input dataMatrix       as modified by the tool\n-- Output *sampleMetadata*   is input sampleMetadata   as modified by the tool\n-- Output *variableMetadata* is input variableMetadata as modified by the tool\n-\n-  ]]></help>\n-  <citations>\n-    <!-- Giacomoni_2014 W4m 2.5 -->\n-    <citation type="doi">10.1093/bioinformatics/btu813</citation>\n-    <!-- Guitton_2017 W4m 3.0 -->\n-    <citation type="doi">10.1016/j.biocel.2017.07.002</citation>\n-    <!-- Kuhl_2012 CAMERA -->\n-    <citation type="doi">10.1021/ac202450g</citation>\n-    <!-- Smith_2006 XCMS -->\n-    <citation type="doi">10.1021/ac051437y</citation>\n-    <!-- Thevenot_2015 Urinary metabolome statistics -->\n-    <citation type="doi">10.1021/acs.jproteome.5b00354</citation>\n-  </citations>\n-  <!--\n-     vim:noet:sw=2:ts=2\n++-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+\n+| Expected Output   | Download from URL                                                                                                                                 |\n++===================+===================================================================================================================================================+\n+| Data matrix       | https://raw.githubusercontent.com/HegemanLab/w4mclassfilter_galaxy_wrapper/master/tools/w4mclassfilter/test-data/rangefilter_dataMatrix.tsv       |\n++-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+\n+| Sample metadata   | https://raw.githubusercontent.com/HegemanLab/w4mclassfilter_galaxy_wrapper/master/tools/w4mclassfilter/test-data/rangefilter_sampleMetadata.tsv   |\n++-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+\n+| Variable metadata | https://raw.githubusercontent.com/HegemanLab/w4mclassfilter_galaxy_wrapper/master/tools/w4mclassfilter/test-data/rangefilter_variableMetadata.tsv |\n++-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+\n+    ]]></help>\n+    <citations>\n+        <!-- Giacomoni_2014 W4m 2.5 -->\n+        <citation type="doi">10.1093/bioinformatics/btu813</citation>\n+        <!-- Guitton_2017 W4m 3.0 -->\n+        <citation type="doi">10.1016/j.biocel.2017.07.002</citation>\n+        <!-- Kuhl_2012 CAMERA -->\n+        <citation type="doi">10.1021/ac202450g</citation>\n+        <!-- Smith_2006 XCMS -->\n+        <citation type="doi">10.1021/ac051437y</citation>\n+        <!-- Thevenot_2015 Urinary metabolome statistics -->\n+        <citation type="doi">10.1021/acs.jproteome.5b00354</citation>\n+    </citations>\n+    <!--\n+     vim:noet:sw=4:ts=4\n --> </tool>\n'
b
diff -r 518cc205f289 -r b24ca78a425b w4mclassfilter_wrapper.R
--- a/w4mclassfilter_wrapper.R Fri Mar 02 08:29:53 2018 -0500
+++ b/w4mclassfilter_wrapper.R Mon Sep 03 22:28:03 2018 -0400
[
@@ -102,18 +102,31 @@
 ## -----------------------------
 my_w4m_filter_imputation <- if (transformation == "log10") {
   function(m) {
+    if (!is.matrix(m))
+      stop("Cannot impute and transform data - the supplied data is not in matrix form")
+    if (nrow(m) == 0)
+      stop("Cannot impute and transform data - data matrix has no rows")
+    if (ncol(m) == 0)
+      stop("Cannot impute and transform data - data matrix has no columns")
     suppressWarnings(
       # suppress warnings here since non-positive values will produce NaN's that will be fixed in the next step
       m <- log10(m)
     )
-    # replace NaN values with zero
-    m[is.nan(m)] <- 0
-    # replace NA values with zero
-    m[is.na(m)] <- 0
-    # replace negative values with zero, if applicable (It should never be applicable!)
-    m[m<0] <- 0
-    # return matrix as the result
-    return (m)
+    return ( w4m_filter_imputation(m) )
+  }
+} else if (transformation == "log2") {
+  function(m) {
+    if (!is.matrix(m))
+      stop("Cannot impute and transform data - the supplied data is not in matrix form")
+    if (nrow(m) == 0)
+      stop("Cannot impute and transform data - data matrix has no rows")
+    if (ncol(m) == 0)
+      stop("Cannot impute and transform data - data matrix has no columns")
+    suppressWarnings(
+      # suppress warnings here since non-positive values will produce NaN's that will be fixed in the next step
+      m <- log2(m)
+    )
+    return ( w4m_filter_imputation(m) )
   }
 } else {
   # use the method from the w4mclassfilter class