Mercurial > repos > eschen42 > w4mclassfilter
changeset 12:38f509903a0b draft
"planemo upload for repository https://github.com/HegemanLab/w4mclassfilter_galaxy_wrapper/tree/master commit b9712e554d16ed26f6c6d0c2e8cd74552b49f694"
author | eschen42 |
---|---|
date | Tue, 01 Oct 2019 16:57:58 -0400 |
parents | 9f5c0e23c205 |
children | c18040b6e8b9 |
files | test-data/expected_dataMatrix.tsv test-data/rangefilter_dataMatrix.tsv test-data/rangefilter_sampleMetadata.tsv w4mclassfilter.xml w4mclassfilter_wrapper.R |
diffstat | 5 files changed, 217 insertions(+), 125 deletions(-) [+] |
line wrap: on
line diff
--- a/test-data/expected_dataMatrix.tsv Mon Sep 03 22:34:35 2018 -0400 +++ b/test-data/expected_dataMatrix.tsv Tue Oct 01 16:57:58 2019 -0400 @@ -3,7 +3,7 @@ HMDB00208 747080 595872 3143654 4059767 1433702 5593888 2477288 3346077 4230072 HMDB00251 368600 94936 293988 352855 767894 268331 310918 1248919 577184 HMDB00299 250551 456162 808657 614370 250403 768004 504108 1014041 1362408 -HMDB00512 0 280560 556003 590779 209285 342532 569970 525240 246282 +HMDB00512 525240 280560 556003 590779 209285 342532 569970 525240 246282 HMDB00518 0 85944 129886 175800 13154 230242 440223 315368 10657 HMDB00715 1252089 905408 5140022 2658555 814523 2558923 4184204 3865723 3236644 HMDB01032 2569205 1604999 26222916 257139 675754 59906109 31151730 18648127 14989438
--- a/test-data/rangefilter_dataMatrix.tsv Mon Sep 03 22:34:35 2018 -0400 +++ b/test-data/rangefilter_dataMatrix.tsv Tue Oct 01 16:57:58 2019 -0400 @@ -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 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 + HU_017 HU_028 HU_034 HU_051 HU_060 HU_078 HU_091 HU_093 HU_099 HU_110 HU_130 HU_149 HU_152 HU_175 HU_178 HU_185 HU_208 +HMDB00191 19.0950724540801 19.5573683394871 19.1351832076319 18.581538968171 19.7610090032025 19.5831195045026 19.3006944055142 19.1741869272827 19.8736633887651 19.7958256457729 19.2864427002132 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 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 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 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 16.7978767996065 21.5788388647145 21.4643567902489 20.9969706149343 19.9807336965562 19.6828797432404
--- a/test-data/rangefilter_sampleMetadata.tsv Mon Sep 03 22:34:35 2018 -0400 +++ b/test-data/rangefilter_sampleMetadata.tsv Tue Oct 01 16:57:58 2019 -0400 @@ -10,8 +10,6 @@ HU_099 46 pos 23 21.3 M HU_110 53 pos 50 20.9 F HU_130 63 pos 33 26.06 M -HU_134 67 pos 48 22.89 M -HU_138 68 pos 42 21.88 M HU_149 72 pos 35 19.49 F HU_152 75 pos 26 17.58 F HU_175 87 pos 35 21.26 F
--- a/w4mclassfilter.xml Mon Sep 03 22:34:35 2018 -0400 +++ b/w4mclassfilter.xml Tue Oct 01 16:57:58 2019 -0400 @@ -1,27 +1,28 @@ -<tool id="w4mclassfilter" name="W4m Data Subset" version="0.98.11"> +<tool id="w4mclassfilter" name="W4m Data Subset" version="0.98.13"> <description>Filter W4m data by values or metadata</description> <!-- Here is the hyphenation standard that I *try* to apply consistently in my documentation: http://www.sandranoonan.com/dont-let-hyphenation-drive-crazy/ --> <requirements> - <!-- <requirement type="package" version="6.2">readline</requirement> --> - <requirement type="package" version="3.4.1">r-base</requirement> - <requirement type="package" version="1.1_4">r-batch</requirement> - <requirement type="package" version="0.98.8">w4mclassfilter</requirement> + <requirement type="package" version="3.6.1">r-base</requirement> + <requirement type="package" version="1.1_5">r-batch</requirement> + <requirement type="package" version="0.98.13">w4mclassfilter</requirement> </requirements> <command detect_errors="aggressive"><![CDATA[ + unset R_HOME; Rscript $__tool_directory__/w4mclassfilter_wrapper.R - dataMatrix_in '$dataMatrix_in' - sampleMetadata_in '$sampleMetadata_in' - variableMetadata_in '$variableMetadata_in' - sampleclassNames '$sampleclassNames' - inclusive '$inclusive' - wildcards '$wildcards' - classnameColumn '$classnameColumn' - samplenameColumn 'sampleMetadata' + dataMatrix_in '$dataMatrix_in' + sampleMetadata_in '$sampleMetadata_in' + variableMetadata_in '$variableMetadata_in' + sampleclassNames '$sampleclassNames' + inclusive '$inclusive' + wildcards '$wildcards' + classnameColumn '$classnameColumn' + samplenameColumn 'sampleMetadata' variable_range_filter '$variableRangeFilter' - transformation '$transformation' - dataMatrix_out '$dataMatrix_out' - sampleMetadata_out '$sampleMetadata_out' - variableMetadata_out '$variableMetadata_out' + transformation '$transformation' + imputation '$imputation' + dataMatrix_out '$dataMatrix_out' + sampleMetadata_out '$sampleMetadata_out' + variableMetadata_out '$variableMetadata_out' ]]></command> <inputs> <param name="dataMatrix_in" format="tabular" label="Data matrix file" type="data" @@ -95,6 +96,12 @@ <option value="log2">log2</option> <option value="log10">log10</option> </param> + <param name="imputation" label="Imputation of missing values" type="select" + help="'zero' (the default) - replace missing values with zero; 'center' - replace missing values with feature-median; 'none' - perform no imputation"> + <option value="zero" selected="true">zero</option> + <option value="center">center</option> + <option value="none">none</option> + </param> </inputs> <outputs> <data name="dataMatrix_out" format="tabular" label="${dataMatrix_in.name}.subset" ></data> @@ -110,16 +117,27 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="M"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> - <param name="variableRangeFilter" value="FEATMAX:6.30103:,mz:200:,rt::800"/> - <param name="transformation" value="log10"/> + <param name="inclusive" value="TRUE"/> + <param name="variableRangeFilter" value="FEATMAX:2e6:,mz:200:,rt::800"/> + <param name="transformation" value="none"/> <output name="dataMatrix_out"> <assert_contents> - <has_text text="5.87336711011293" /> + <has_text text="747080" /> + <not_has_text text="13420742" /> + <not_has_text text="47259" /> </assert_contents> </output> <output name="sampleMetadata_out"> <assert_contents> + <has_text text="HU_017" /> + <has_text text="HU_034" /> + <has_text text="HU_078" /> + <has_text text="HU_091" /> + <has_text text="HU_093" /> + <has_text text="HU_099" /> + <has_text text="HU_130" /> + <has_text text="HU_134" /> + <has_text text="HU_138" /> <not_has_text text="HU_028" /> <not_has_text text="HU_051" /> <not_has_text text="HU_060" /> @@ -131,94 +149,87 @@ <not_has_text text="HU_185" /> <not_has_text text="HU_204" /> <not_has_text text="HU_208" /> - <has_text text="HU_017" /> - <has_text text="HU_034" /> - <has_text text="HU_078" /> - <has_text text="HU_091" /> - <has_text text="HU_093" /> - <has_text text="HU_099" /> - <has_text text="HU_130" /> - <has_text text="HU_134" /> - <has_text text="HU_138" /> </assert_contents> </output> <output name="variableMetadata_out"> <assert_contents> + <has_text text="HMDB00208" /> + <has_text text="HMDB01032" /> + <has_text text="HMDB01101.1" /> + <has_text text="HMDB13189" /> <not_has_text text="HMDB00191" /> - <has_text text="HMDB00208" /> <not_has_text text="HMDB00251" /> <not_has_text text="HMDB00299" /> <not_has_text text="HMDB00512" /> <not_has_text text="HMDB00518" /> <not_has_text text="HMDB00715" /> <not_has_text text="HMDB00822" /> - <has_text text="HMDB01032" /> - <has_text text="HMDB01101.1" /> <not_has_text text="HMDB03193" /> <not_has_text text="HMDB04824" /> <not_has_text text="HMDB10348" /> - <has_text text="HMDB13189" /> <not_has_text text="HMDB59717" /> </assert_contents> </output> </test> <!-- test 2 --> - <test> + <test> <param name="dataMatrix_in" value="input_dataMatrix.tsv"/> <param name="sampleMetadata_in" value="input_sampleMetadata.tsv"/> <param name="variableMetadata_in" value="input_variableMetadata.tsv"/> - <param name="classnameColumn" value="sampleMetadata"/> <!-- test that hyphens in regular expressions work --> <param name="sampleclassNames" value="HU_[0-9][0-9][0-9]"/> + <param name="inclusive" value="TRUE"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> - <param name="variableRangeFilter" value="FEATMAX:20.93157:,mz:200:,rt::800"/> - <param name="transformation" value="log2"/> - <output name="dataMatrix_out"> + <param name="classnameColumn" value="sampleMetadata"/> + <!-- test that variableRangeFilter works with tranformation --> + <param name="variableRangeFilter" value="FEATMAX:6.30103:,mz:200:,rt::800"/> + <param name="transformation" value="log10"/> + <param name="imputation" value="zero"/> + <output name="dataMatrix_out" md5="5644d2ea01d072ee1d0c40e29e9d0089"> <assert_contents> - <has_text text="19.5109032146715" /> + <has_text text="5.8733671" /> </assert_contents> </output> <output name="sampleMetadata_out"> <assert_contents> + <has_text text="HU_017" /> <has_text text="HU_028" /> + <has_text text="HU_034" /> <has_text text="HU_051" /> <has_text text="HU_060" /> + <has_text text="HU_078" /> + <has_text text="HU_091" /> + <has_text text="HU_093" /> + <has_text text="HU_099" /> <has_text text="HU_110" /> + <has_text text="HU_130" /> + <has_text text="HU_134" /> + <has_text text="HU_138" /> <has_text text="HU_149" /> <has_text text="HU_152" /> <has_text text="HU_175" /> <has_text text="HU_178" /> <has_text text="HU_185" /> + <has_text text="HU_208" /> <not_has_text text="HU_204" /> - <has_text text="HU_208" /> - <has_text text="HU_017" /> - <has_text text="HU_034" /> - <has_text text="HU_078" /> - <has_text text="HU_091" /> - <has_text text="HU_093" /> - <has_text text="HU_099" /> - <has_text text="HU_130" /> - <has_text text="HU_134" /> - <has_text text="HU_138" /> </assert_contents> </output> <output name="variableMetadata_out"> <assert_contents> <has_text text="HMDB00191" /> <has_text text="HMDB00208" /> + <has_text text="HMDB01032" /> + <has_text text="HMDB01101.1" /> + <has_text text="HMDB13189" /> <not_has_text text="HMDB00251" /> <not_has_text text="HMDB00299" /> <not_has_text text="HMDB00512" /> <not_has_text text="HMDB00518" /> <not_has_text text="HMDB00715" /> <not_has_text text="HMDB00822" /> - <has_text text="HMDB01032" /> - <has_text text="HMDB01101.1" /> <not_has_text text="HMDB03193" /> <not_has_text text="HMDB04824" /> <not_has_text text="HMDB10348" /> - <has_text text="HMDB13189" /> <not_has_text text="HMDB59717" /> </assert_contents> </output> @@ -230,7 +241,7 @@ <param name="variableMetadata_in" value="input_variableMetadata.tsv"/> <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="M"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <param name="transformation" value="none"/> <output name="dataMatrix_out"> <assert_contents> @@ -281,7 +292,13 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="*"/> <param name="wildcards" value="TRUE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> + <param name="imputation" value="zero"/> + <output name="dataMatrix_out" md5="b2eac4946d3803a07606286b50451af4"> + <assert_contents> + <not_has_text text="NA" /> + </assert_contents> + </output> <output name="sampleMetadata_out"> <assert_contents> <not_has_text text="HU_204" /> @@ -315,7 +332,7 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="M"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <output name="sampleMetadata_out"> <assert_contents> <not_has_text text="HU_028" /> @@ -349,7 +366,7 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="M"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <output name="variableMetadata_out"> <assert_contents> <has_text text="HMDB03193" /> @@ -379,7 +396,7 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="M"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <output name="variableMetadata_out"> <assert_contents> <has_text text="HMDB03193" /> @@ -409,7 +426,7 @@ <param name="classnameColumn" value="gender"/> <param name="sampleclassNames" value="[Mm],[fF]"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <output name="sampleMetadata_out"> <assert_contents> <has_text text="HU_028" /> @@ -443,7 +460,7 @@ <param name="classnameColumn" value=""/> <param name="sampleclassNames" value="M"/> <param name="wildcards" value="FALSE"/> - <param name="inclusive" value="filter-in"/> + <param name="inclusive" value="TRUE"/> <output name="sampleMetadata_out"> <assert_contents> <has_text text="HU_028" /> @@ -469,6 +486,54 @@ </assert_contents> </output> </test> + <!-- test 10 - extends test4 with no imputation rather than zero imputation --> + <test> + <param name="dataMatrix_in" value="input_dataMatrix.tsv"/> + <param name="sampleMetadata_in" value="input_sampleMetadata.tsv"/> + <param name="variableMetadata_in" value="input_variableMetadata.tsv"/> + <param name="classnameColumn" value="gender"/> + <param name="sampleclassNames" value="*"/> + <param name="wildcards" value="TRUE"/> + <param name="inclusive" value="TRUE"/> + <param name="imputation" value="none"/> + <output name="dataMatrix_out" md5="cc9ab8bdb70b68b43b19b7327d285166"> + <assert_contents> + <not_has_text text="HU_204" /> + <has_text text="NA" /> + <has_text text="HU_028" /> + </assert_contents> + </output> + <output name="sampleMetadata_out"> + <assert_contents> + <not_has_text text="HU_204" /> + <has_text text="HU_028" /> + </assert_contents> + </output> + </test> + <!-- test 11 - extends test4 with center imputation rather than zero imputation --> + <test> + <param name="dataMatrix_in" value="input_dataMatrix.tsv"/> + <param name="sampleMetadata_in" value="input_sampleMetadata.tsv"/> + <param name="variableMetadata_in" value="input_variableMetadata.tsv"/> + <param name="classnameColumn" value="gender"/> + <param name="sampleclassNames" value="*"/> + <param name="wildcards" value="TRUE"/> + <param name="inclusive" value="TRUE"/> + <param name="imputation" value="center"/> + <output name="dataMatrix_out" md5="75a4802bb8887709e4d4dec8c2c3d3cf"> + <assert_contents> + <not_has_text text="HU_204" /> + <not_has_text text="NA" /> + <has_text text="HU_028" /> + </assert_contents> + </output> + <output name="sampleMetadata_out"> + <assert_contents> + <not_has_text text="HU_204" /> + <has_text text="HU_028" /> + </assert_contents> + </output> + </test> </tests> <help><![CDATA[ @@ -531,13 +596,13 @@ This tool also performs several operations to address several data issues that may impede downstream statistical analysis: -- Missing values in dataMatrix are imputed to zero. -- The values in the dataMatrix may be log-transformed if desired. - Samples that are missing from either sampleMetadata or dataMatrix are eliminated. - Features that are missing from either variableMetadata or dataMatrix are eliminated. - Features and samples that have zero variance are eliminated. - Samples and features are sorted alphabetically in rows and columns of dataMatrix and in rows of variableMetadata and sampleMetadata. - The names of the first columns of variableMetadata and sampleMetadata are set respectively to "variableMetadata" and "sampleMetadata". +- If desired, the values in the dataMatrix may be log-transformed. +- If desired, each missing value in dataMatrix is replaced with zero or the median value observed for the corresponding feature. This tool may be applied several times sequentially, which may be useful for: @@ -607,10 +672,15 @@ | Data-transformation (default = '``none``') - | '``none``' - do not transform data matrix values - | '``log2``' - take the log base 2 of the values in the data matrix - | '``log10``' - take the log base 10 of the values in the data matrix - | In both cases, negative and missing values are imputed to zero. + | '``none``' - Do not transform data matrix values. + | '``log2``' - Take the log base 2 of the values in the data matrix. + | '``log10``' - Take the log base 10 of the values in the data matrix. + | + +Data-imputation (default = '``zero``') + | '``none``' - Do not impute data matrix values. + | '``zero``' - Negative and missing values are imputed to zero. + | '``center``' - For each feature, negative and missing values are imputed to the median of other values. | @@ -708,14 +778,22 @@ - Note, however, that when the "maximum" is greater than the "minimum" for the FEATMAX range specification, then the specification is ignored. +---------------------------------- +Data transformation and imputation +---------------------------------- + +Data may optionally be log2- or log10-transformed. + +Negative intensity values are always substituted with zeros. + +Missing intensity data values may optionally be imputed. Missing values may be substituted with zeros (as may be appropriate for univariate analysis) or with the median for the feature (as may be appropriate for multivariate analysis). (Note that the median feature-intensity is computed for the samples *before* variable-range filters are applied.) + ----------------------------------------------------------------------------- ---------------- WORKING EXAMPLES ---------------- -.. class:: infomark - ----------- Input Files ----------- @@ -730,8 +808,6 @@ | https://raw.githubusercontent.com/HegemanLab/w4mclassfilter_galaxy_wrapper/master/tools/w4mclassfilter/test-data/input_variableMetadata.tsv | +------------------------------------------------------------------------------------------------------------------------------------------------------+ -.. class:: infomark - ------------------------------- Running Without Range-Filtering ------------------------------- @@ -740,19 +816,23 @@ **Input parameters** -+------------------------------------+-------------------------------+ -| Input Parameter | Value | -+====================================+===============================+ -| Names of sample-classes | M | -+------------------------------------+-------------------------------+ -| Include named classes | filter-in | -+------------------------------------+-------------------------------+ -| Column that names the sample-class | gender | -+------------------------------------+-------------------------------+ -| Variable range-filters | (Leave this field empty.) | -+------------------------------------+-------------------------------+ -| Data transforamtion | none | -+------------------------------------+-------------------------------+ ++---------------------------------------------+-------------------------------+ +| Input Parameter | Value | ++=============================================+===============================+ +| Column that names the sample-class | gender | ++---------------------------------------------+-------------------------------+ +| Names of sample-classes | M | ++---------------------------------------------+-------------------------------+ +| Use 'wild-cards' or 'regular expressions' | wild-cards | ++---------------------------------------------+-------------------------------+ +| Exclude/include named classes | filter-in | ++---------------------------------------------+-------------------------------+ +| Variable range-filters | (Leave this field empty.) | ++---------------------------------------------+-------------------------------+ +| Data transforamtion | none | ++---------------------------------------------+-------------------------------+ +| Missing-value imputation | center | ++---------------------------------------------+-------------------------------+ **Expected outputs** @@ -766,8 +846,6 @@ | Variable metadata | https://raw.githubusercontent.com/HegemanLab/w4mclassfilter_galaxy_wrapper/master/tools/w4mclassfilter/test-data/expected_variableMetadata.tsv | +-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ -.. class:: infomark - ---------------------------- Running With Range-Filtering ---------------------------- @@ -777,19 +855,23 @@ **Input parameters** -+------------------------------------+------------------------------------+ -| Input Parameter | Value | -+====================================+====================================+ -| Names of sample-classes | (Leave this field empty.) | -+------------------------------------+------------------------------------+ -| Include named classes | filter-out | -+------------------------------------+------------------------------------+ -| Column that names the sample-class | gender | -+------------------------------------+------------------------------------+ -| Variable range-filters | FEATMAX:20.93157:,mz:200:,rt::800 | -+------------------------------------+------------------------------------+ -| Data transforamtion | log2 | -+------------------------------------+------------------------------------+ ++---------------------------------------------+-----------------------------------+ +| Input Parameter | Value | ++=============================================+===================================+ +| Column that names the sample-class | sampleMetadata | ++---------------------------------------------+-----------------------------------+ +| Names of sample-classes | HU_13[48] | ++---------------------------------------------+-----------------------------------+ +| Use 'wild-cards' or 'regular expressions' | regular-expressions | ++---------------------------------------------+-----------------------------------+ +| Exclude/include named classes | filter-out | ++---------------------------------------------+-----------------------------------+ +| Variable range-filters | FEATMAX:20.93157:,mz:200:,rt::800 | ++---------------------------------------------+-----------------------------------+ +| Data transforamtion | log2 | ++---------------------------------------------+-----------------------------------+ +| Missing-value imputation | zero | ++---------------------------------------------+-----------------------------------+ **Expected outputs**
--- a/w4mclassfilter_wrapper.R Mon Sep 03 22:34:35 2018 -0400 +++ b/w4mclassfilter_wrapper.R Tue Oct 01 16:57:58 2019 -0400 @@ -23,8 +23,8 @@ suppressMessages(library(w4mclassfilter)) -if(packageVersion("w4mclassfilter") < "0.98.0") - stop("Please use 'w4mclassfilter' versions of 0.98.0 and above") +if(packageVersion("w4mclassfilter") < "0.98.12") + stop("Please use 'w4mclassfilter' versions of 0.98.12 and above") ## constants ##---------- @@ -83,6 +83,16 @@ # other parameters transformation <- as.character(argVc["transformation"]) +my_imputation_label <- as.character(argVc["imputation"]) +my_imputation_function <- if (my_imputation_label == "zero") { + w4m_filter_zero_imputation +} else if (my_imputation_label == "center") { + w4m_filter_median_imputation +} else if (my_imputation_label == "none") { + w4m_filter_no_imputation +} else { + stop(sprintf("Unknown value %s supplied for 'imputation' parameter. Expected one of {zero,center,none}.")) +} wildcards <- as.logical(argVc["wildcards"]) sampleclassNames <- as.character(argVc["sampleclassNames"]) sampleclassNames <- strsplit(x = sampleclassNames, split = ",", fixed = TRUE)[[1]] @@ -100,37 +110,39 @@ ## ----------------------------- ## Transformation and imputation ## ----------------------------- -my_w4m_filter_imputation <- if (transformation == "log10") { +my_transformation_and_imputation <- if (transformation == "log10") { function(m) { if (!is.matrix(m)) - stop("Cannot impute and transform data - the supplied data is not in matrix form") + stop("Cannot transform and impute data - the supplied data is not in matrix form") if (nrow(m) == 0) - stop("Cannot impute and transform data - data matrix has no rows") + stop("Cannot transform and impute data - data matrix has no rows") if (ncol(m) == 0) - stop("Cannot impute and transform data - data matrix has no columns") - suppressWarnings( + stop("Cannot transform and impute 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) ) + m[is.na(m)] <- NA + }) + return ( my_imputation_function(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") + stop("Cannot transform and impute data - the supplied data is not in matrix form") if (nrow(m) == 0) - stop("Cannot impute and transform data - data matrix has no rows") + stop("Cannot transform and impute data - data matrix has no rows") if (ncol(m) == 0) - stop("Cannot impute and transform data - data matrix has no columns") - suppressWarnings( + stop("Cannot transform and impute 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) ) + m[is.na(m)] <- NA + }) + return ( my_imputation_function(m) ) } } else { # use the method from the w4mclassfilter class - w4m_filter_imputation + my_imputation_function } ##------------------------------ @@ -150,7 +162,7 @@ , samplename_column = samplenameColumn , variable_range_filter = variable_range_filter , failure_action = my_print -, data_imputation = my_w4m_filter_imputation +, data_imputation = my_transformation_and_imputation ) my_print("\nResult of '", modNamC, "' Galaxy module call to 'w4mclassfilter::w4m_filter_by_sample_class' R function: ",