Previous changeset 7:582a8a42a93b (2018-01-29) Next changeset 9:1ced8b5dfa3e (2018-03-28) |
Commit message:
planemo upload for repository https://github.com/HegemanLab/w4mclassfilter_galaxy_wrapper/tree/master commit 7b824bc01884125dc8bb2e4c9ef70fb0a6d88db1 |
modified:
README test-data/rangefilter_dataMatrix.tsv w4mclassfilter.xml w4mclassfilter_wrapper.R |
b |
diff -r 582a8a42a93b -r d5cf23369d12 README --- a/README Mon Jan 29 21:20:07 2018 -0500 +++ b/README Sat Mar 03 22:58:14 2018 -0500 |
b |
@@ -1,7 +1,8 @@ Galaxy Wrapper for the w4mclassfilter R Package +<https://doi.org/10.5281/zenodo.1034793> -This is a planemo <http://planemo.readthedocs.io/en/latest/> -oriented galaxy-tool-wrapper <https://docs.galaxyproject.org/en/latest/dev/schema.htm> +This is a Galaxy tool-wrapper <https://docs.galaxyproject.org/en/latest/dev/schema.htm> to wrap the w4mclassfilter R package <https://github.com/HegemanLab/w4mclassfilter> for use with the Workflow4Metabolomics <http://workflow4metabolomics.org/> -flavor of Galaxy <https://galaxyproject.org/> +flavor of Galaxy <https://galaxyproject.org/>. +The tool is built with Planemo <http://planemo.readthedocs.io/en/latest/>. |
b |
diff -r 582a8a42a93b -r d5cf23369d12 test-data/rangefilter_dataMatrix.tsv --- a/test-data/rangefilter_dataMatrix.tsv Mon Jan 29 21:20:07 2018 -0500 +++ b/test-data/rangefilter_dataMatrix.tsv Sat Mar 03 22:58:14 2018 -0500 |
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 582a8a42a93b -r d5cf23369d12 w4mclassfilter.xml --- a/w4mclassfilter.xml Mon Jan 29 21:20:07 2018 -0500 +++ b/w4mclassfilter.xml Sat Mar 03 22:58:14 2018 -0500 |
b |
b'@@ -1,6 +1,7 @@\n-\xef\xbb\xbf<tool id="w4mclassfilter" name="Sample_Subset" version="0.98.7">\n- <!-- this file is utf-8, not ASCII, because it contains the character \xc3\xa9 -->\n- <description>Filter W4M data by sample class</description>\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@@ -23,8 +24,9 @@\n inclusive \'$inclusive\'\n wildcards \'$wildcards\'\n classnameColumn \'$classnameColumn\'\n- samplenameColumn \'$samplenameColumn\'\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@@ -34,12 +36,23 @@\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="samplenameColumn" label="Column that names the sample" type="text" value = "sampleMetadata" help="name of the column in the sample metadata file that has the name of the sample - defaults to \'sampleMetadata\'" />\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 \'classes\' input parameter - defaults to \'class\'" />\n- <param name="sampleclassNames" label="Names of sample classes" type="text" value = "" help="comma-separated names (or comma-less regular expressions to match names) of sample-classes to filter in or out; defaults to no names">\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="-" /> <!-- dash, hyphen -->\n+ <add value="." /> <!-- dot, period -->\n+ <add value="_" /> <!-- 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="{" /> <!-- l-cube, left-curly-bracket -->\n+ <add value="|" /> <!-- pipe -->\n+ <add value="}" /> <!-- r-cube, right-curly-bracket -->\n <add value="$" /> <!-- dollar, dollar-sign -->\n <add value="(" /> <!-- left-paren -->\n <add value=")" /> <!-- right-paren -->\n@@ -54,38 +67,43 @@\n <add value="\" /> <!-- whack, backslash -->\n <add value="]" /> <!-- r-squib, right-squre-bracket -->\n <add value="^" /> <!-- hat, caret -->\n- <add value="{" /> <!-- l-cube, left-curly-bracket -->\n- <add value="|" /> <!-- pipe -->\n- <add value="}" /> <!-- r-cube, right-curly-bracket -->\n+ <add value="_" /> <!-- underscore -->\n </valid>\n </sanitizer>\n </param>\n \n- '..b'w features\n \n-* First column of output variableMetadata (that has feature names) now is always named "variableMetadata".\n-* First column of output sampleMetadata now (that has sample names) is always named "sampleMetadata".\n+- First column of output variableMetadata (that has feature names) now is always named "variableMetadata".\n+- First column of output sampleMetadata now (that has sample names) now is always named "sampleMetadata".\n \n Internal modifications\n \n-* Now uses w4mclassfilter R package v0.98.7.\n+- Now uses w4mclassfilter R package v0.98.7.\n \n-CHANGES IN VERSION 0.98.6\n+Changes in version 0.98.6\n =========================\n \n New features\n \n-* Added support for filtering out features whose attributes fall outside specified ranges.\n+- Added support for filtering out features whose attributes fall outside specified ranges.\n For more detail, see "Variable-range filters" above.\n \n Internal modifications\n \n-* Now uses w4mclassfilter R package v0.98.6.\n-* Now sorts 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+- Now uses w4mclassfilter R package v0.98.6.\n+- Now sorts 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+- 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+- 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+- 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+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-* *dataMatrix* *is* modified by the tool, so it *does* appear as an output file\n-* *sampleMetadata* *is* modified by the tool, so it *does* appear as an output file\n-* *variableMetadata* *is* modified by the tool, so it *does* appear as an output file\n-\n-Internal modifications\n-\n-* N/A\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+ <!-- Giacomoni_2014 W4m 2.5 -->\n <citation type="doi">10.1093/bioinformatics/btu813</citation>\n- <!-- Guitton_2017 W4M 3.0 -->\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- <!-- Th_venot_2015 Urinary metabolome statistics -->\n+ <!-- Thevenot_2015 Urinary metabolome statistics -->\n <citation type="doi">10.1021/acs.jproteome.5b00354</citation>\n </citations>\n <!--\n' |
b |
diff -r 582a8a42a93b -r d5cf23369d12 w4mclassfilter_wrapper.R --- a/w4mclassfilter_wrapper.R Mon Jan 29 21:20:07 2018 -0500 +++ b/w4mclassfilter_wrapper.R Sat Mar 03 22:58:14 2018 -0500 |
[ |
@@ -82,6 +82,7 @@ # other parameters +transformation <- as.character(argVc["transformation"]) wildcards <- as.logical(argVc["wildcards"]) sampleclassNames <- as.character(argVc["sampleclassNames"]) sampleclassNames <- strsplit(x = sampleclassNames, split = ",", fixed = TRUE)[[1]] @@ -96,6 +97,42 @@ variable_range_filter <- as.character(argVc["variable_range_filter"]) variable_range_filter <- strsplit(x = variable_range_filter, split = ",", fixed = TRUE)[[1]] +## ----------------------------- +## Transformation and imputation +## ----------------------------- +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) + ) + 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 + w4m_filter_imputation +} + ##------------------------------ ## Computation ##------------------------------ @@ -113,6 +150,7 @@ , samplename_column = samplenameColumn , variable_range_filter = variable_range_filter , failure_action = my_print +, data_imputation = my_w4m_filter_imputation ) my_print("\nResult of '", modNamC, "' Galaxy module call to 'w4mclassfilter::w4m_filter_by_sample_class' R function: ", |