Mercurial > repos > ethevenot > univariate
changeset 3:140290de7986 draft
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
author | ethevenot |
---|---|
date | Sun, 30 Oct 2016 14:17:09 -0400 |
parents | 09799fc16bc6 |
children | 3017385625f6 |
files | README.md build.xml runit/input/dataMatrix.tsv runit/input/sampleMetadata.tsv runit/input/variableMetadata.tsv runit/output/figure.pdf runit/output/information.txt runit/output/variableMetadata.tsv runit/univariate_runtests.R runit/univariate_tests.R test-data/dataMatrix.tsv test-data/output-variableMetadata.tsv test-data/sampleMetadata.tsv test-data/variableMetadata.tsv univariate_config.xml univariate_script.R univariate_wrapper.R |
diffstat | 17 files changed, 426 insertions(+), 258 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sat Aug 06 12:42:42 2016 -0400 +++ b/README.md Sun Oct 30 14:17:09 2016 -0400 @@ -7,8 +7,8 @@ ### Description -**Version:** 2.1.4 -**Date:** 2016-08-05 +**Version:** 2.2.0 +**Date:** 2016-10-30 **Author:** Marie Tremblay-Franco (INRA, MetaToul, MetaboHUB, W4M Core Development Team) and Etienne A. Thevenot (CEA, LIST, MetaboHUB, W4M Core Development Team) **Email:** [marie.tremblay-franco(at)toulouse.inra.fr](mailto:marie.tremblay-franco@toulouse.inra.fr); [etienne.thevenot(at)cea.fr](mailto:etienne.thevenot@cea.fr) **Citation:** Thevenot E.A., Roux A., Xu Y., Ezan E. and Junot C. (2015). Analysis of the human adult urinary metabolome variations with age, body mass index and gender by implementing a comprehensive workflow for univariate and OPLS statistical analyses. *Journal of Proteome Research*, **14**:3322-3335. [doi:10.1021/acs.jproteome.5b00354](http://dx.doi.org/10.1021/acs.jproteome.5b00354) @@ -50,11 +50,25 @@ ### News +###### CHANGES IN VERSION 2.2.0 + +MAJOR MODIFICATION + + * ANOVA and Kruskal-Wallis: The p-values of the post-hoc tests (i.e. from pairwise comparisons) are now further corrected for multiple testing over all variables (previously, only the p-value of the -first- omnibus test was corrected over all variables) + +MINOR MODIFICATION + + * All values in the 'dif', adjusted p-value, and 'sig' columns are now displayed (previously, the values were set to NA when the p-value of the omnibus test was not significant) + +NEW FEATURE + + * Graphic: a single pdf file containing the graphics of all significant tests is now produced as '_figure.pdf' output: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The corrected p-value is indicated in the title of each plot + ###### CHANGES IN VERSION 2.1.4 NEW FEATURE -Level names are now separated by '.' instead of '-' previously in the column names of the output variableMetadata table (e.g., 'jour_ttest_J3.J10_fdr' instead of 'jour_ttest_J3-J10_fdr' previously) + * Level names are now separated by '.' instead of '-' previously in the column names of the output variableMetadata table (e.g., 'jour_ttest_J3.J10_fdr' instead of 'jour_ttest_J3-J10_fdr' previously) INTERNAL MODIFICATION
--- a/build.xml Sat Aug 06 12:42:42 2016 -0400 +++ b/build.xml Sun Oct 30 14:17:09 2016 -0400 @@ -36,7 +36,7 @@ <arg value="--conda_prefix"/> <arg value="${conda.dir}"/> <arg value="--galaxy_branch"/> - <arg value="release_16.01"/> + <arg value="release_16.07"/> <arg value="--conda_dependency_resolution"/> <arg value="${tool.xml}"/> </exec>
--- a/runit/input/dataMatrix.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/input/dataMatrix.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -profile HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 -HMDB01032 2569204.92420381 6222035.77434915 17070707.9912636 1258838.24348419 13039543.0754619 1909391.77026598 3495.09386434063 2293521.90928998 128503.275117713 81872.5276382213 8103557.56578035 149574887.036181 1544036.41049333 7103429.53933206 14138796.50382 4970265.57952158 263054.73056162 1671332.30008058 88433.1944958815 23602331.2894815 18648126.5206986 1554657.98756878 34152.3646391152 209372.71275317 33187733.370626 202438.591636003 13581070.0886437 354170.810678102 9120781.48986975 43419175.4051586 -HMDB03072 3628416.30251025 65626.9834353751 112170.118946651 3261804.34422417 42228.2787747563 343254.201250707 1958217.69317664 11983270.0435677 5932111.41638028 5511385.83359531 9154521.47755199 2632133.21209418 9500411.14556502 6551644.51726592 7204319.80891836 1273412.04795188 3260583.81592376 8932005.5351622 8340827.52597275 9256460.69197759 11217839.169041 5919262.81433556 11790077.0657915 9567977.80797097 73717.5811684739 9991787.29074293 4208098.14739633 623970.649925847 10904221.2642849 2171793.93621067 -HMDB00792 429568.609438384 3887629.50527037 1330692.11658995 1367446.73023821 844197.447472453 2948090.71886592 1614157.90566884 3740009.19379795 3292251.66531919 2310688.79492013 4404239.59008605 3043289.12780863 825736.467181043 2523241.91730649 6030501.02648005 474901.604069803 2885792.42617652 2955990.64049134 1917716.3427982 1767962.67737699 5926203.40397675 1639065.69474684 346810.763557826 1054776.22313737 2390258.27543894 1831346.37315857 1026696.36904362 7079792.50047866 4368341.01359769 3495986.87280275 +dataMatrix s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 +v1 7.416640524 6.9916690517 7.3404441347 7.0128372669 7.1702617447 6.820858055 7.2648178466 6.9561684785 7.2966652122 7.2695129676 7.2695129676 6.7986507145 6.9749720403 6.7788745443 7.0791812822 7.3617278549 7.4281348102 6.967548023 7.2304489469 6.6608655728 6.9614211415 6.8959747875 7.1398791179 7.2201081142 7.1673173643 6.6857418281 7.1789769761 6.7788745443 6.7291648707 6.7466342768 6.8954226013 6.9454686344 +v2 7.4563660483 6.9014583759 7.3873898441 6.9599948859 7.2095150414 6.7007038037 7.3159703664 6.8876173566 7.3010300174 7.2966652122 7.3138672415 6.7275413384 6.9863238219 6.7435098431 7.1038037552 7.3838153839 7.4409090978 6.7737865181 7.2174839705 6.48995862 6.8494194752 6.8344207673 7.1238516736 7.212187631 7.2041200098 6.6910815806 7.2900346336 6.7427252098 6.7185017719 6.6180482014 6.8512584099 6.9329808726 +v3 6.8785218529 6.7839036507 6.9025468337 7.0086002143 6.9314579215 6.8129134235 6.8305887328 7.0374265378 6.8767950339 6.8457180799 6.7888751864 6.9929951426 7.0374265378 6.8215135939 7.0718820441 6.809559782 6.8122447637 6.7795965634 6.8129134235 6.9599948859 6.8014037786 6.7355989795 6.8075350957 6.9929951426 6.7686381752 6.9339932144 6.7611758884 6.9740509489 6.9768083831 6.7058637978 6.9790929462 6.7032914641 +v4 7.1303338007 7.1398791179 7.0899051467 7.110589744 6.9947569885 6.9978231244 7.0374265378 7.1003705796 6.9698816903 6.8048207468 6.8543061025 6.6655810848 6.705008045 6.7275413384 6.7442930614 6.9498777528 7.1583625223 7.2013971516 7.1673173643 6.9169800999 7.1003705796 7.0453230179 7.0606978781 7.1003705796 7.0492180614 6.7693773999 6.7774268949 6.9211661027 6.8561245047 6.9656720182 7.0086002143 6.9758911823 +v5 7.0530784819 6.99122612 7.0569048894 6.9698816903 6.8603380665 6.8375885014 6.9633155586 7.0170333811 7.0681858989 6.9633155586 6.95375974 6.7481881046 6.7686381752 6.8175654357 6.8394781102 7.0492180614 7.1038037552 7.0681858989 7.0755469979 6.7259117139 6.9339932144 6.8948697121 6.9464523141 7.0043214168 6.9009131223 6.6875290504 6.7634280684 6.7209858267 6.6454223676 6.7923917595 6.7902852344 6.8312297579 +v6 6.9876663096 7.0969100478 7.1072100036 7.0569048894 7.0000000434 6.9973864281 7.0644580267 7.0863598663 7.0043214168 6.9772662582 6.9434945654 6.9680157607 6.9556877984 7.1553360678 6.9454686344 6.9309490821 7.0086002143 7.0334237957 7.0086002143 6.9206450535 7.0043214168 6.9749720403 6.9489018098 6.9400182049 6.8750613213 6.9434945654 6.9057959343 6.9614211415 6.9518230838 6.9415114823 6.9304396457 6.9304396457
--- a/runit/input/sampleMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/input/sampleMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,31 +1,33 @@ -sample age ageGroup -HU_017 41 experienced -HU_021 34 junior -HU_027 37 experienced -HU_032 38 experienced -HU_041 28 junior -HU_048 39 experienced -HU_049 50 senior -HU_050 30 junior -HU_052 51 senior -HU_059 81 senior -HU_060 55 senior -HU_066 25 junior -HU_072 47 experienced -HU_077 27 junior -HU_090 46 experienced -HU_109 32 junior -HU_110 50 senior -HU_125 58 senior -HU_126 45 experienced -HU_131 42 experienced -HU_134 48 experienced -HU_149 35 experienced -HU_150 49 experienced -HU_173 55 senior -HU_179 33 junior -HU_180 53 senior -HU_182 43 experienced -HU_202 42 experienced -HU_204 31 junior -HU_209 17.5 junior +sampleMetadata quant qual +s1 56 A +s2 24 A +s3 35 A +s4 32 A +s5 54 A +s6 53 A +s7 30 A +s8 20 A +s9 41 B +s10 34 B +s11 44 B +s12 43 B +s13 52 B +s14 46 B +s15 51 B +s16 36 B +s17 31 C +s18 25 C +s19 40 C +s20 50 C +s21 22 C +s22 29 C +s23 49 C +s24 19 C +s25 55 D +s26 39 D +s27 45 D +s28 26 D +s29 23 D +s30 42 D +s31 33 D +s32 21 D
--- a/runit/input/variableMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/input/variableMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -variable name -HMDB01032 Dehydroepiandrosterone sulfate -HMDB03072 Quinic acid -HMDB00792 Sebacic acid +variableMetadata sample_mean +v1 12620948.56 +v2 12661823.42 +v3 7680621.526 +v4 9901182.687 +v5 8311866.237 +v6 9792909.819
--- a/runit/output/information.txt Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/output/information.txt Sun Oct 30 14:17:09 2016 -0400 @@ -1,9 +1,11 @@ -Start of the 'Univariate' Galaxy module call: Sat 06 Aug 2016 06:22:18 PM +Start of the 'Univariate' Galaxy module call: Sun 30 Oct 2016 07:06:06 PM Performing 'kruskal' -The following 1 variable (33%) was found significant at the 0.05 level: -HMDB01032 +The following 3 variables (50%) were found significant at the 0.05 level: +v4 +v5 +v6 -End of 'Univariate' Galaxy module call: 2016-08-06 18:22:18 +End of 'Univariate' Galaxy module call: 2016-10-30 19:06:07
--- a/runit/output/variableMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/output/variableMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -variableMetadata name ageGroup_kruskal_fdr ageGroup_kruskal_sig ageGroup_kruskal_junior.experienced_dif ageGroup_kruskal_senior.experienced_dif ageGroup_kruskal_senior.junior_dif ageGroup_kruskal_junior.experienced_pva ageGroup_kruskal_senior.experienced_pva ageGroup_kruskal_senior.junior_pva ageGroup_kruskal_junior.experienced_sig ageGroup_kruskal_senior.experienced_sig ageGroup_kruskal_senior.junior_sig -HMDB01032 Dehydroepiandrosterone sulfate 0.0117826825222329 1 7211389.71960377 -1703486.11807139 -8914875.83767516 0.204550960009346 0.123124593762726 0.00251932966039092 0 0 1 -HMDB03072 Quinic acid 0.461634758626427 0 -3747468.87812489 1512795.66143568 5260264.53956057 NA NA NA NA NA NA -HMDB00792 Sebacic acid 0.469555338459932 0 1404223.43306179 959174.915801485 -445048.517260305 NA NA NA NA NA NA +variableMetadata sample_mean qual_kruskal_fdr qual_kruskal_sig qual_kruskal_B.A_dif qual_kruskal_C.A_dif qual_kruskal_D.A_dif qual_kruskal_C.B_dif qual_kruskal_D.B_dif qual_kruskal_D.C_dif qual_kruskal_B.A_fdr qual_kruskal_C.A_fdr qual_kruskal_D.A_fdr qual_kruskal_C.B_fdr qual_kruskal_D.B_fdr qual_kruskal_D.C_fdr qual_kruskal_B.A_sig qual_kruskal_C.A_sig qual_kruskal_D.A_sig qual_kruskal_C.B_sig qual_kruskal_D.B_sig qual_kruskal_D.C_sig +v1 12620948.56 0.147579228303049 0 0.0827976191000008 -0.0378359353499995 -0.254400932999999 -0.12063355445 -0.3371985521 -0.21656499765 0.999945671392641 0.99999320349658 0.185342280966466 0.997174540126794 0.401201067449129 0.580170916884995 0 0 0 0 0 0 +v2 12661823.42 0.246364577097618 0 0.11547952005 -0.0981193892499999 -0.2877631538 -0.2135989093 -0.40324267385 -0.18964376455 0.999945671392641 0.99999320349658 0.291618067987092 0.997174540126794 0.401201067449129 0.890397531402986 0 0 0 0 0 0 +v3 7680621.526 0.293234285978368 0 -0.0292777863999998 -0.0806444136 -0.0392186484999995 -0.0513666272000002 -0.00994086209999967 0.0414257651000005 0.999945671392641 0.99999320349658 0.593281055056761 0.997174540126794 0.593281055056761 0.999155846185138 0 0 0 0 0 0 +v4 9901182.687 0.000819466212247517 1 -0.32058095905 0.00523271645000012 -0.1517188027 0.3258136755 0.16886215635 -0.15695151915 0.0133536911280914 0.99999320349658 0.185342280966466 0.00430289478770107 0.593281055056761 0.143731083414931 1 0 0 1 0 0 +v5 8311866.237 0.0115079177714078 1 -0.0839349800499996 -0.00516703969999988 -0.203697253750001 0.0787679403499997 -0.119762273700001 -0.198530214050001 0.999945671392641 0.99999320349658 0.0336157236420893 0.997174540126794 0.401201067449129 0.073221827596323 0 0 1 0 0 0 +v6 9792909.819 0.00429379409695042 1 -0.0988296785000005 -0.0710347295000009 -0.124705894050001 0.0277949489999996 -0.0258762155500003 -0.0536711645499999 0.535700151485478 0.99999320349658 0.00294595180681068 0.997174540126794 0.401201067449129 0.302648332248575 0 0 1 0 0 0
--- a/runit/univariate_runtests.R Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/univariate_runtests.R Sun Oct 30 14:17:09 2016 -0400 @@ -83,6 +83,7 @@ defaultArgLs[["variableMetadata_in"]] <- file.path(dirname(scriptPathC), testInDirC, "variableMetadata.tsv") defaultArgLs[["variableMetadata_out"]] <- file.path(dirname(scriptPathC), testOutDirC, "variableMetadata.tsv") + defaultArgLs[["figure"]] <- file.path(dirname(scriptPathC), testOutDirC, "figure.pdf") defaultArgLs[["information"]] <- file.path(dirname(scriptPathC), testOutDirC, "information.txt") defaultArgLs
--- a/runit/univariate_tests.R Sat Aug 06 12:42:42 2016 -0400 +++ b/runit/univariate_tests.R Sun Oct 30 14:17:09 2016 -0400 @@ -1,7 +1,24 @@ +test_input_anova <- function() { + + testDirC <- "input" + argLs <- list(facC = "qual", + tesC = "anova", + adjC = "fdr", + thrN = "0.05") + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEqualsNumeric(outLs[["varDF"]]["v6", "qual_anova_fdr"], 1.924156e-03, tolerance = 1e-6) + + checkEqualsNumeric(outLs[["varDF"]]["v4", "qual_anova_D.C_fdr"], 0.01102016, tolerance = 1e-6) + +} + test_input_kruskal <- function() { testDirC <- "input" - argLs <- list(facC = "ageGroup", + argLs <- list(facC = "qual", tesC = "kruskal", adjC = "fdr", thrN = "0.05") @@ -9,7 +26,9 @@ argLs <- c(defaultArgF(testDirC), argLs) outLs <- wrapperCallF(argLs) - checkEqualsNumeric(outLs[["varDF"]]["HMDB01032", "ageGroup_kruskal_senior.experienced_pva"], 0.1231246, tolerance = 1e-6) + checkEqualsNumeric(outLs[["varDF"]]["v4", "qual_kruskal_fdr"], 0.0008194662, tolerance = 1e-7) + + checkEqualsNumeric(outLs[["varDF"]]["v6", "qual_kruskal_D.A_fdr"], 0.002945952, tolerance = 1e-7) }
--- a/test-data/dataMatrix.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/test-data/dataMatrix.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -profile HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 -HMDB01032 2569204.92420381 6222035.77434915 17070707.9912636 1258838.24348419 13039543.0754619 1909391.77026598 3495.09386434063 2293521.90928998 128503.275117713 81872.5276382213 8103557.56578035 149574887.036181 1544036.41049333 7103429.53933206 14138796.50382 4970265.57952158 263054.73056162 1671332.30008058 88433.1944958815 23602331.2894815 18648126.5206986 1554657.98756878 34152.3646391152 209372.71275317 33187733.370626 202438.591636003 13581070.0886437 354170.810678102 9120781.48986975 43419175.4051586 -HMDB03072 3628416.30251025 65626.9834353751 112170.118946651 3261804.34422417 42228.2787747563 343254.201250707 1958217.69317664 11983270.0435677 5932111.41638028 5511385.83359531 9154521.47755199 2632133.21209418 9500411.14556502 6551644.51726592 7204319.80891836 1273412.04795188 3260583.81592376 8932005.5351622 8340827.52597275 9256460.69197759 11217839.169041 5919262.81433556 11790077.0657915 9567977.80797097 73717.5811684739 9991787.29074293 4208098.14739633 623970.649925847 10904221.2642849 2171793.93621067 -HMDB00792 429568.609438384 3887629.50527037 1330692.11658995 1367446.73023821 844197.447472453 2948090.71886592 1614157.90566884 3740009.19379795 3292251.66531919 2310688.79492013 4404239.59008605 3043289.12780863 825736.467181043 2523241.91730649 6030501.02648005 474901.604069803 2885792.42617652 2955990.64049134 1917716.3427982 1767962.67737699 5926203.40397675 1639065.69474684 346810.763557826 1054776.22313737 2390258.27543894 1831346.37315857 1026696.36904362 7079792.50047866 4368341.01359769 3495986.87280275 +dataMatrix s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 +v1 7.416640524 6.9916690517 7.3404441347 7.0128372669 7.1702617447 6.820858055 7.2648178466 6.9561684785 7.2966652122 7.2695129676 7.2695129676 6.7986507145 6.9749720403 6.7788745443 7.0791812822 7.3617278549 7.4281348102 6.967548023 7.2304489469 6.6608655728 6.9614211415 6.8959747875 7.1398791179 7.2201081142 7.1673173643 6.6857418281 7.1789769761 6.7788745443 6.7291648707 6.7466342768 6.8954226013 6.9454686344 +v2 7.4563660483 6.9014583759 7.3873898441 6.9599948859 7.2095150414 6.7007038037 7.3159703664 6.8876173566 7.3010300174 7.2966652122 7.3138672415 6.7275413384 6.9863238219 6.7435098431 7.1038037552 7.3838153839 7.4409090978 6.7737865181 7.2174839705 6.48995862 6.8494194752 6.8344207673 7.1238516736 7.212187631 7.2041200098 6.6910815806 7.2900346336 6.7427252098 6.7185017719 6.6180482014 6.8512584099 6.9329808726 +v3 6.8785218529 6.7839036507 6.9025468337 7.0086002143 6.9314579215 6.8129134235 6.8305887328 7.0374265378 6.8767950339 6.8457180799 6.7888751864 6.9929951426 7.0374265378 6.8215135939 7.0718820441 6.809559782 6.8122447637 6.7795965634 6.8129134235 6.9599948859 6.8014037786 6.7355989795 6.8075350957 6.9929951426 6.7686381752 6.9339932144 6.7611758884 6.9740509489 6.9768083831 6.7058637978 6.9790929462 6.7032914641 +v4 7.1303338007 7.1398791179 7.0899051467 7.110589744 6.9947569885 6.9978231244 7.0374265378 7.1003705796 6.9698816903 6.8048207468 6.8543061025 6.6655810848 6.705008045 6.7275413384 6.7442930614 6.9498777528 7.1583625223 7.2013971516 7.1673173643 6.9169800999 7.1003705796 7.0453230179 7.0606978781 7.1003705796 7.0492180614 6.7693773999 6.7774268949 6.9211661027 6.8561245047 6.9656720182 7.0086002143 6.9758911823 +v5 7.0530784819 6.99122612 7.0569048894 6.9698816903 6.8603380665 6.8375885014 6.9633155586 7.0170333811 7.0681858989 6.9633155586 6.95375974 6.7481881046 6.7686381752 6.8175654357 6.8394781102 7.0492180614 7.1038037552 7.0681858989 7.0755469979 6.7259117139 6.9339932144 6.8948697121 6.9464523141 7.0043214168 6.9009131223 6.6875290504 6.7634280684 6.7209858267 6.6454223676 6.7923917595 6.7902852344 6.8312297579 +v6 6.9876663096 7.0969100478 7.1072100036 7.0569048894 7.0000000434 6.9973864281 7.0644580267 7.0863598663 7.0043214168 6.9772662582 6.9434945654 6.9680157607 6.9556877984 7.1553360678 6.9454686344 6.9309490821 7.0086002143 7.0334237957 7.0086002143 6.9206450535 7.0043214168 6.9749720403 6.9489018098 6.9400182049 6.8750613213 6.9434945654 6.9057959343 6.9614211415 6.9518230838 6.9415114823 6.9304396457 6.9304396457
--- a/test-data/output-variableMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/test-data/output-variableMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -variableMetadata name ageGroup_kruskal_fdr ageGroup_kruskal_sig ageGroup_kruskal_junior.experienced_dif ageGroup_kruskal_senior.experienced_dif ageGroup_kruskal_senior.junior_dif ageGroup_kruskal_junior.experienced_pva ageGroup_kruskal_senior.experienced_pva ageGroup_kruskal_senior.junior_pva ageGroup_kruskal_junior.experienced_sig ageGroup_kruskal_senior.experienced_sig ageGroup_kruskal_senior.junior_sig -HMDB01032 Dehydroepiandrosterone sulfate 0.0117826825222329 1 7211389.71960377 -1703486.11807139 -8914875.83767516 0.204550960009346 0.123124593762726 0.00251932966039092 0 0 1 -HMDB03072 Quinic acid 0.461634758626427 0 -3747468.87812489 1512795.66143568 5260264.53956057 NA NA NA NA NA NA -HMDB00792 Sebacic acid 0.469555338459932 0 1404223.43306179 959174.915801485 -445048.517260305 NA NA NA NA NA NA +variableMetadata sample_mean qual_kruskal_fdr qual_kruskal_sig qual_kruskal_B.A_dif qual_kruskal_C.A_dif qual_kruskal_D.A_dif qual_kruskal_C.B_dif qual_kruskal_D.B_dif qual_kruskal_D.C_dif qual_kruskal_B.A_fdr qual_kruskal_C.A_fdr qual_kruskal_D.A_fdr qual_kruskal_C.B_fdr qual_kruskal_D.B_fdr qual_kruskal_D.C_fdr qual_kruskal_B.A_sig qual_kruskal_C.A_sig qual_kruskal_D.A_sig qual_kruskal_C.B_sig qual_kruskal_D.B_sig qual_kruskal_D.C_sig +v1 12620948.56 0.147579228303049 0 0.0827976191000008 -0.0378359353499995 -0.254400932999999 -0.12063355445 -0.3371985521 -0.21656499765 0.999945671392641 0.99999320349658 0.185342280966466 0.997174540126794 0.401201067449129 0.580170916884995 0 0 0 0 0 0 +v2 12661823.42 0.246364577097618 0 0.11547952005 -0.0981193892499999 -0.2877631538 -0.2135989093 -0.40324267385 -0.18964376455 0.999945671392641 0.99999320349658 0.291618067987092 0.997174540126794 0.401201067449129 0.890397531402986 0 0 0 0 0 0 +v3 7680621.526 0.293234285978368 0 -0.0292777863999998 -0.0806444136 -0.0392186484999995 -0.0513666272000002 -0.00994086209999967 0.0414257651000005 0.999945671392641 0.99999320349658 0.593281055056761 0.997174540126794 0.593281055056761 0.999155846185138 0 0 0 0 0 0 +v4 9901182.687 0.000819466212247517 1 -0.32058095905 0.00523271645000012 -0.1517188027 0.3258136755 0.16886215635 -0.15695151915 0.0133536911280914 0.99999320349658 0.185342280966466 0.00430289478770107 0.593281055056761 0.143731083414931 1 0 0 1 0 0 +v5 8311866.237 0.0115079177714078 1 -0.0839349800499996 -0.00516703969999988 -0.203697253750001 0.0787679403499997 -0.119762273700001 -0.198530214050001 0.999945671392641 0.99999320349658 0.0336157236420893 0.997174540126794 0.401201067449129 0.073221827596323 0 0 1 0 0 0 +v6 9792909.819 0.00429379409695042 1 -0.0988296785000005 -0.0710347295000009 -0.124705894050001 0.0277949489999996 -0.0258762155500003 -0.0536711645499999 0.535700151485478 0.99999320349658 0.00294595180681068 0.997174540126794 0.401201067449129 0.302648332248575 0 0 1 0 0 0
--- a/test-data/sampleMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/test-data/sampleMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,31 +1,33 @@ -sample age ageGroup -HU_017 41 experienced -HU_021 34 junior -HU_027 37 experienced -HU_032 38 experienced -HU_041 28 junior -HU_048 39 experienced -HU_049 50 senior -HU_050 30 junior -HU_052 51 senior -HU_059 81 senior -HU_060 55 senior -HU_066 25 junior -HU_072 47 experienced -HU_077 27 junior -HU_090 46 experienced -HU_109 32 junior -HU_110 50 senior -HU_125 58 senior -HU_126 45 experienced -HU_131 42 experienced -HU_134 48 experienced -HU_149 35 experienced -HU_150 49 experienced -HU_173 55 senior -HU_179 33 junior -HU_180 53 senior -HU_182 43 experienced -HU_202 42 experienced -HU_204 31 junior -HU_209 17.5 junior +sampleMetadata quant qual +s1 56 A +s2 24 A +s3 35 A +s4 32 A +s5 54 A +s6 53 A +s7 30 A +s8 20 A +s9 41 B +s10 34 B +s11 44 B +s12 43 B +s13 52 B +s14 46 B +s15 51 B +s16 36 B +s17 31 C +s18 25 C +s19 40 C +s20 50 C +s21 22 C +s22 29 C +s23 49 C +s24 19 C +s25 55 D +s26 39 D +s27 45 D +s28 26 D +s29 23 D +s30 42 D +s31 33 D +s32 21 D
--- a/test-data/variableMetadata.tsv Sat Aug 06 12:42:42 2016 -0400 +++ b/test-data/variableMetadata.tsv Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,7 @@ -variable name -HMDB01032 Dehydroepiandrosterone sulfate -HMDB03072 Quinic acid -HMDB00792 Sebacic acid +variableMetadata sample_mean +v1 12620948.56 +v2 12661823.42 +v3 7680621.526 +v4 9901182.687 +v5 8311866.237 +v6 9792909.819
--- a/univariate_config.xml Sat Aug 06 12:42:42 2016 -0400 +++ b/univariate_config.xml Sun Oct 30 14:17:09 2016 -0400 @@ -1,4 +1,4 @@ -<tool id="Univariate" name="Univariate" version="2.1.4"> +<tool id="Univariate" name="Univariate" version="2.2.0"> <description>Univariate statistics</description> <requirements> @@ -24,6 +24,7 @@ thrN "$thrN" variableMetadata_out "$variableMetadata_out" + figure "$figure" information "$information" ]]></command> <inputs> @@ -54,6 +55,7 @@ <outputs> <data name="variableMetadata_out" label="${tool.name}_${variableMetadata_in.name}" format="tabular" ></data> + <data name="figure" label="${tool.name}_figure.pdf" format="pdf"/> <data name="information" label="${tool.name}_information.txt" format="txt"/> </outputs> @@ -62,7 +64,7 @@ <param name="dataMatrix_in" value="dataMatrix.tsv"/> <param name="sampleMetadata_in" value="sampleMetadata.tsv"/> <param name="variableMetadata_in" value="variableMetadata.tsv"/> - <param name="facC" value="ageGroup"/> + <param name="facC" value="qual"/> <param name="tesC" value="kruskal"/> <param name="adjC" value="fdr"/> <param name="thrN" value="0.05"/> @@ -71,7 +73,7 @@ </tests> <help> - + .. class:: infomark | **Tool update: See the 'NEWS' section at the bottom of the page** @@ -188,12 +190,16 @@ variableMetadata_out.tabular | **variableMetadata** file identical to the file given as argument, except that (at least) three columns have been added: - | 1) [factor]_[test]_[class'a']-[class'b']_dif or [factor]_[test]_cor: difference of the means (ttest) or the medians (wilcoxon) between the two classes, or 'pearson' or 'spearman' correlations - | 2) [factor]_[test]_[class'a']-[class'b']_[method] or [factor]_[test]_[method]: adjusted p-values - | 3) [factor]_[test]_[class'a']-[class'b']_sig or [factor]_[test]_sig: significance (coded as '1' if below the threshold and '0' otherwise) - | In the case of 'anova' and 'kruskal', the columns 2) and 3) appear first to give the results from the ANOVA or Kruskal Wallis test, and, when these tests are significant, the results of the pairwise comparisons are reported in additional columns (otherwise NA in these columns): in the case of ANOVA, the Tukey HSD post-hoc analysis is used (for each comparison, the difference between means, p value, and significance are provided); in the case of Kruskal Wallis, the Nemenyi is performed (PMCMR package) (for each pairwise comparison, the difference between medians, p value and significance are provided) + | 1) [factor]_[test]_[class'a'].[class'b']_dif or [factor]_[test]_cor: difference of the means (ttest) or the medians (wilcoxon) between the two classes, or 'pearson' or 'spearman' correlations + | 2) [factor]_[test]_[class'a'].[class'b']_[method] or [factor]_[test]_[method]: adjusted p-values + | 3) [factor]_[test]_[class'a'].[class'b']_sig or [factor]_[test]_sig: significance (coded as '1' if below the threshold and '0' otherwise) + | In the case of 'anova' and 'kruskal', the columns 2) and 3) appear first to give the results from the ANOVA or Kruskal Wallis test, and then the results of the pairwise comparisons are reported in additional columns (otherwise NA in these columns): in the case of ANOVA, the Tukey HSD post-hoc analysis is used (for each comparison, the difference between means, p value, and significance are provided); in the case of Kruskal Wallis, the Nemenyi is performed (PMCMR package) (for each pairwise comparison, the difference between medians, p value and significance are provided); note that since version 2.2.0, the p-values of the post-hoc pairwise comparisons (ANOVA or Kruskal) are further corrected for multiple testing over all variables (as the p-value of the omnibus test in column 2) | +figure.pdf + | File containing the graphics of all significant tests: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The variable name and the corrected p-value is indicated in the title of each plot + | + information.txt | File with all messages and warnings generated during the computation | @@ -214,6 +220,22 @@ NEWS ---- +CHANGES IN VERSION 2.2.0 +======================== + +MAJOR MODIFICATION + +ANOVA and Kruskal-Wallis: The p-values of the post-hoc tests (i.e. from pairwise comparisons) are now further corrected for multiple testing over all variables (previously, only the p-value of the omnibus test was corrected over all variables) + +MINOR MODIFICATION + +All values in the 'dif', adjusted p-value, and 'sig' columns are now displayed (previously, the values were set to NA when the p-value of the omnibus test was not significant) + +NEW FEATURE + +Graphic: a single pdf file containing the graphics of all significant tests is now produced as '_figure.pdf' output: boxplots (respectively scatterplots with the regression line in red and the R2 value) are displayed when the factor of interest is qualitative (respectively quantitative). The corrected p-value is indicated in the title of each plot + + CHANGES IN VERSION 2.1.4 ======================== @@ -245,127 +267,32 @@ NEW FEATURE (corrected) p-value threshold can be set to any value between 0 and 1 - - -</help> - -<citations> - <citation type="bibtex">@Manual{, - title = {R: A Language and Environment for Statistical Computing}, - author = {{R Core Team}}, - organization = {R Foundation for Statistical Computing}, - address = {Vienna, Austria}, - year = {2016}, - url = {https://www.R-project.org/}, - }</citation> - <citation type="bibtex">@Article{Thevenot2015, - Title = {Analysis of the human adult urinary metabolome variations with age, body mass index and gender by implementing a comprehensive workflow for univariate and OPLS statistical analyses}, - Author = {Thevenot, Etienne A. and Roux, Aurelie and Xu, Ying and Ezan, Eric and Junot, Christophe}, - Journal = {Journal of Proteome Research}, - Year = {2015}, - Note = {PMID: 26088811}, - Number = {8}, - Pages = {3322-3335}, - Volume = {14}, - - Doi = {10.1021/acs.jproteome.5b00354}, - Url = {http://pubs.acs.org/doi/full/10.1021/acs.jproteome.5b00354} - }</citation> - <citation type="doi">10.1093/bioinformatics/btu813</citation> - </citations> - - - -Input files -=========== - -| **To generate the "dataMatrix", "sampleMetadata" and "variableMetadata" files:** -| **1) copy/paste the values below in three distinct .txt files** -| **2) use the "Get Data" / "Upload File" in the "Tools" (left) panel from the Galaxy / ABiMS page by choosing:** -| **a) File Format: 'tabular'** -| **b) Convert spaces to tabs: 'Yes'** -| - -**dataMatrix file**:: - - dataMatrix HU_017 HU_021 HU_027 HU_032 HU_041 HU_048 HU_049 HU_050 HU_052 HU_059 HU_060 HU_066 HU_072 HU_077 HU_090 HU_109 HU_110 HU_125 HU_126 HU_131 HU_134 HU_149 HU_150 HU_173 HU_179 HU_180 HU_182 HU_202 HU_204 HU_209 - HMDB01032 2569204.92420381 6222035.77434915 17070707.9912636 1258838.24348419 13039543.0754619 1909391.77026598 3495.09386434063 2293521.90928998 128503.275117713 81872.5276382213 8103557.56578035 149574887.036181 1544036.41049333 7103429.53933206 14138796.50382 4970265.57952158 263054.73056162 1671332.30008058 88433.1944958815 23602331.2894815 18648126.5206986 1554657.98756878 34152.3646391152 209372.71275317 33187733.370626 202438.591636003 13581070.0886437 354170.810678102 9120781.48986975 43419175.4051586 - HMDB03072 3628416.30251025 65626.9834353751 112170.118946651 3261804.34422417 42228.2787747563 343254.201250707 1958217.69317664 11983270.0435677 5932111.41638028 5511385.83359531 9154521.47755199 2632133.21209418 9500411.14556502 6551644.51726592 7204319.80891836 1273412.04795188 3260583.81592376 8932005.5351622 8340827.52597275 9256460.69197759 11217839.169041 5919262.81433556 11790077.0657915 9567977.80797097 73717.5811684739 9991787.29074293 4208098.14739633 623970.649925847 10904221.2642849 2171793.93621067 - HMDB00792 429568.609438384 3887629.50527037 1330692.11658995 1367446.73023821 844197.447472453 2948090.71886592 1614157.90566884 3740009.19379795 3292251.66531919 2310688.79492013 4404239.59008605 3043289.12780863 825736.467181043 2523241.91730649 6030501.02648005 474901.604069803 2885792.42617652 2955990.64049134 1917716.3427982 1767962.67737699 5926203.40397675 1639065.69474684 346810.763557826 1054776.22313737 2390258.27543894 1831346.37315857 1026696.36904362 7079792.50047866 4368341.01359769 3495986.87280275 - - -**sampleMetadata file**:: - - sampleMetadata age ageGrp - HU_017 41 experienced - HU_021 34 junior - HU_027 37 experienced - HU_032 38 experienced - HU_041 28 junior - HU_048 39 experienced - HU_049 50 senior - HU_050 30 junior - HU_052 51 senior - HU_059 81 senior - HU_060 55 senior - HU_066 25 junior - HU_072 47 experienced - HU_077 27 junior - HU_090 46 experienced - HU_109 32 junior - HU_110 50 senior - HU_125 58 senior - HU_126 45 experienced - HU_131 42 experienced - HU_134 48 experienced - HU_149 35 experienced - HU_150 49 experienced - HU_173 55 senior - HU_179 33 junior - HU_180 53 senior - HU_182 43 experienced - HU_202 42 experienced - HU_204 31 junior - HU_209 17.5 junior - - -**variableMetadata file**:: - - variableMetadata name - HMDB01032 Dehydroepiandrosterone sulfate - HMDB03072 Quinic acid - HMDB00792 Sebacic acid - - -Parameters -========== - -**Factor of interest:** "ageGroup" - -**Test:** "Kruskal-Wallis rank test (qualitative, > 2 levels)" - -**Method for multiple testing correction:** "fdr" - -**(Corrected) p-value significance threshold:** 0.05 - - -Output files -============ - -+------------------------------+------------+ -| File | Format | -+==============================+============+ -| 1) dataMatrix | tabular | -+------------------------------+------------+ -| 2) sampleMetadata | tabular | -+------------------------------+------------+ -| 3) variableMetadata | tabular | -+------------------------------+------------+ -| 4) information | text | -+------------------------------+------------+ - - ---------------------------------------------------- - - + + </help> + + <citations> + <citation type="bibtex">@Manual{, + title = {R: A Language and Environment for Statistical Computing}, + author = {{R Core Team}}, + organization = {R Foundation for Statistical Computing}, + address = {Vienna, Austria}, + year = {2016}, + url = {https://www.R-project.org/}, + }</citation> + <citation type="bibtex">@Article{Thevenot2015, + Title = {Analysis of the human adult urinary metabolome variations with age, body mass index and gender by implementing a comprehensive workflow for univariate and OPLS statistical analyses}, + Author = {Thevenot, Etienne A. and Roux, Aurelie and Xu, Ying and Ezan, Eric and Junot, Christophe}, + Journal = {Journal of Proteome Research}, + Year = {2015}, + Note = {PMID: 26088811}, + Number = {8}, + Pages = {3322-3335}, + Volume = {14}, + + Doi = {10.1021/acs.jproteome.5b00354}, + Url = {http://pubs.acs.org/doi/full/10.1021/acs.jproteome.5b00354} + }</citation> + <citation type="doi">10.1093/bioinformatics/btu813</citation> + </citations> + </tool>
--- a/univariate_script.R Sat Aug 06 12:42:42 2016 -0400 +++ b/univariate_script.R Sun Oct 30 14:17:09 2016 -0400 @@ -4,16 +4,18 @@ facC, tesC = c("ttest", "wilcoxon", "anova", "kruskal", "pearson", "spearman")[1], adjC = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none")[7], - thrN = 0.05) { + thrN = 0.05, + pdfC) { ## Option - ##--------------- strAsFacL <- options()$stringsAsFactors options(stingsAsFactors = FALSE) options(warn = -1) + ## Getting the response (either a factor or a numeric) + if(mode(samDF[, facC]) == "character") { facFcVn <- factor(samDF[, facC]) facLevVc <- levels(facFcVn) @@ -24,8 +26,10 @@ varPfxC <- paste0(make.names(facC), "_", tesC, "_") + if(tesC %in% c("ttest", "wilcoxon", "pearson", "spearman")) { + switch(tesC, ttest = { staF <- function(y) diff(tapply(y, facFcVn, function(x) mean(x, na.rm = TRUE))) @@ -46,61 +50,168 @@ staVn <- apply(datMN, 2, staF) - fdrVn <- p.adjust(apply(datMN, + adjVn <- p.adjust(apply(datMN, 2, tesF), method = adjC) - sigVn <- as.numeric(fdrVn < thrN) + sigVn <- as.numeric(adjVn < thrN) if(tesC %in% c("ttest", "wilcoxon")) varPfxC <- paste0(varPfxC, paste(rev(facLevVc), collapse = "."), "_") varDF[, paste0(varPfxC, ifelse(tesC %in% c("ttest", "wilcoxon"), "dif", "cor"))] <- staVn - varDF[, paste0(varPfxC, adjC)] <- fdrVn + varDF[, paste0(varPfxC, adjC)] <- adjVn varDF[, paste0(varPfxC, "sig")] <- sigVn + ## graphic + + pdf(pdfC, onefile = TRUE) + + varVi <- which(sigVn > 0) + + if(tesC %in% c("ttest", "wilcoxon")) { + + facVc <- as.character(facFcVn) + names(facVc) <- rownames(samDF) + + for(varI in varVi) { + + varC <- rownames(varDF)[varI] + + boxF(facFcVn, + datMN[, varI], + paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")"), + facVc) + + } + + } else { ## pearson or spearman + + for(varI in varVi) { + + varC <- rownames(varDF)[varI] + + mod <- lm(datMN[, varI] ~ facFcVn) + + plot(facFcVn, datMN[, varI], + xlab = facC, + ylab = "", + pch = 18, + main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ", R2 = ", signif(summary(mod)$r.squared, 2), ")")) + + abline(mod, col = "red") + + } + + } + + dev.off() + + } else if(tesC == "anova") { + ## getting the names of the pairwise comparisons 'class1Vclass2' prwVc <- rownames(TukeyHSD(aov(datMN[, 1] ~ facFcVn))[["facFcVn"]]) prwVc <- gsub("-", ".", prwVc, fixed = TRUE) ## 2016-08-05: '-' character in dataframe column names seems not to be converted to "." by write.table on ubuntu R-3.3.1 + ## omnibus and post-hoc tests + aovMN <- t(apply(datMN, 2, function(varVn) { aovMod <- aov(varVn ~ facFcVn) pvaN <- summary(aovMod)[[1]][1, "Pr(>F)"] hsdMN <- TukeyHSD(aovMod)[["facFcVn"]] - c(pvaN, c(hsdMN[, c("diff", "p adj")]), as.numeric(hsdMN[, "p adj"] < thrN)) + c(pvaN, c(hsdMN[, c("diff", "p adj")])) })) - aovMN[, 1] <- p.adjust(aovMN[, 1], method = adjC) - sigVn <- as.numeric(aovMN[, 1] < thrN) - aovMN <- cbind(aovMN[, 1], sigVn, aovMN[, 2:ncol(aovMN)]) - ## aovMN[which(aovMN[, 2] < 1), (3 + length(prwVc)):ncol(aovMN)] <- NA - colnames(aovMN) <- paste0(varPfxC, - c(adjC, - "sig", - paste0(prwVc, "_dif"), - paste0(prwVc, "_pva"), - paste0(prwVc, "_sig"))) - aovMN[which(aovMN[, paste0(varPfxC, "sig")] < 1), paste0(varPfxC, c(paste0(prwVc, "_pva"), paste0(prwVc, "_sig")))] <- NA + difVi <- 1:length(prwVc) + 1 + + ## difference of the means for each pairwise comparison + + difMN <- aovMN[, difVi] + colnames(difMN) <- paste0(varPfxC, prwVc, "_dif") + + ## correction for multiple testing + + aovMN <- aovMN[, -difVi, drop = FALSE] + aovMN <- apply(aovMN, 2, function(pvaVn) p.adjust(pvaVn, method = adjC)) + + ## significance coding (0 = not significant, 1 = significant) + + adjVn <- aovMN[, 1] + sigVn <- as.numeric(adjVn < thrN) + + aovMN <- aovMN[, -1, drop = FALSE] + colnames(aovMN) <- paste0(varPfxC, prwVc, "_", adjC) + + aovSigMN <- aovMN < thrN + mode(aovSigMN) <- "numeric" + colnames(aovSigMN) <- paste0(varPfxC, prwVc, "_sig") + + ## final aggregated table + + resMN <- cbind(adjVn, sigVn, difMN, aovMN, aovSigMN) + colnames(resMN)[1:2] <- paste0(varPfxC, c(adjC, "sig")) + + varDF <- cbind.data.frame(varDF, as.data.frame(resMN)) + + ## graphic - varDF <- cbind.data.frame(varDF, as.data.frame(aovMN)) + pdf(pdfC, onefile = TRUE) + + for(varI in 1:nrow(varDF)) { + + if(sum(aovSigMN[varI, ]) > 0) { + + varC <- rownames(varDF)[varI] + boxplot(datMN[, varI] ~ facFcVn, + main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")")) + + for(prwI in 1:length(prwVc)) { + + if(aovSigMN[varI, paste0(varPfxC, prwVc[prwI], "_sig")] == 1) { + + claVc <- unlist(strsplit(prwVc[prwI], ".", fixed = TRUE)) + aovClaVl <- facFcVn %in% claVc + aovFc <- facFcVn[aovClaVl, drop = TRUE] + aovVc <- as.character(aovFc) + names(aovVc) <- rownames(samDF)[aovClaVl] + boxF(aovFc, + datMN[aovClaVl, varI], + paste0(varC, " (", adjC, " = ", signif(aovMN[varI, paste0(varPfxC, prwVc[prwI], "_", adjC)], 2), ")"), + aovVc) + + } + + } + + } + + } + + dev.off() + + } else if(tesC == "kruskal") { + - ## getting the names of the pairwise comparisons 'class1Vclass2' + ## getting the names of the pairwise comparisons 'class1.class2' + nemMN <- posthoc.kruskal.nemenyi.test(datMN[, 1], facFcVn, "Tukey")[["p.value"]] nemVl <- c(lower.tri(nemMN, diag = TRUE)) nemClaMC <- cbind(rownames(nemMN)[c(row(nemMN))][nemVl], colnames(nemMN)[c(col(nemMN))][nemVl]) nemNamVc <- paste0(nemClaMC[, 1], ".", nemClaMC[, 2]) - nemNamVc <- paste0(varPfxC, nemNamVc) + pfxNemVc <- paste0(varPfxC, nemNamVc) + + ## omnibus and post-hoc tests nemMN <- t(apply(datMN, 2, function(varVn) { @@ -109,17 +220,24 @@ c(pvaN, c(varNemMN)) })) - pvaVn <- nemMN[, 1] - fdrVn <- p.adjust(pvaVn, method = adjC) - sigVn <- as.numeric(fdrVn < thrN) + + ## correction for multiple testing + + nemMN <- apply(nemMN, 2, + function(pvaVn) p.adjust(pvaVn, method = adjC)) + adjVn <- nemMN[, 1] + sigVn <- as.numeric(adjVn < thrN) nemMN <- nemMN[, c(FALSE, nemVl)] - colnames(nemMN) <- paste0(nemNamVc, "_pva") + colnames(nemMN) <- paste0(pfxNemVc, "_", adjC) + + ## significance coding (0 = not significant, 1 = significant) + nemSigMN <- nemMN < thrN mode(nemSigMN) <- "numeric" - colnames(nemSigMN) <- paste0(nemNamVc, "_sig") - nemMN[sigVn < 1, ] <- NA - nemSigMN[sigVn < 1, ] <- NA + colnames(nemSigMN) <- paste0(pfxNemVc, "_sig") + ## difference of the medians for each pairwise comparison + difMN <- sapply(1:nrow(nemClaMC), function(prwI) { prwVc <- nemClaMC[prwI, ] prwVi <- which(facFcVn %in% prwVc) @@ -128,13 +246,52 @@ }) colnames(difMN) <- gsub("_sig", "_dif", colnames(nemSigMN)) - nemMN <- cbind(fdrVn, sigVn, difMN, nemMN, nemSigMN) - colnames(nemMN)[1:2] <- paste0(varPfxC, c(adjC, "sig")) + ## final aggregated table + + resMN <- cbind(adjVn, sigVn, difMN, nemMN, nemSigMN) + colnames(resMN)[1:2] <- paste0(varPfxC, c(adjC, "sig")) + + varDF <- cbind.data.frame(varDF, as.data.frame(resMN)) + + ## graphic + + pdf(pdfC, onefile = TRUE) + + for(varI in 1:nrow(varDF)) { + + if(sum(nemSigMN[varI, ]) > 0) { + + varC <- rownames(varDF)[varI] - varDF <- cbind.data.frame(varDF, as.data.frame(nemMN)) + boxplot(datMN[, varI] ~ facFcVn, + main = paste0(varC, " (", adjC, " = ", signif(adjVn[varI], 2), ")")) + + for(nemI in 1:length(nemNamVc)) { + + if(nemSigMN[varI, paste0(varPfxC, nemNamVc[nemI], "_sig")] == 1) { + + nemClaVc <- nemClaMC[nemI, ] + nemClaVl <- facFcVn %in% nemClaVc + nemFc <- facFcVn[nemClaVl, drop = TRUE] + nemVc <- as.character(nemFc) + names(nemVc) <- rownames(samDF)[nemClaVl] + boxF(nemFc, + datMN[nemClaVl, varI], + paste0(varC, " (", adjC, " = ", signif(nemMN[varI, paste0(varPfxC, nemNamVc[nemI], "_", adjC)], 2), ")"), + nemVc) + + } + + } + + } + + } + dev.off() + } - + names(sigVn) <- rownames(varDF) sigSumN <- sum(sigVn, na.rm = TRUE) if(sigSumN) { @@ -148,3 +305,28 @@ return(varDF) } + + +boxF <- function(xFc, + yVn, + maiC, + xVc) { + + boxLs <- boxplot(yVn ~ xFc, + main = maiC) + + outVn <- boxLs[["out"]] + + if(length(outVn)) { + + for(outI in 1:length(outVn)) { + levI <- which(levels(xFc) == xVc[names(outVn)[outI]]) + text(levI, + outVn[outI], + labels = names(outVn)[outI], + pos = ifelse(levI == 2, 2, 4)) + } + + } + +}
--- a/univariate_wrapper.R Sat Aug 06 12:42:42 2016 -0400 +++ b/univariate_wrapper.R Sun Oct 30 14:17:09 2016 -0400 @@ -119,7 +119,8 @@ facC = argVc["facC"], tesC = tesC, adjC = argVc["adjC"], - thrN = as.numeric(argVc["thrN"])) + thrN = as.numeric(argVc["thrN"]), + pdfC = argVc["figure"]) ##------------------------------