Function developed to apply t-test or ANOVA on a data frame.

Description

htest applies t-test or ANOVA to a data frame. For that, the first row of the input data must contain a label defining the experimental condition associated to each sample or replicate. Thus, the first column of the first row must receive the word Replicates and the remaining columns must receive the name of the condition associated to each sample. See data(exampleMetReport) for more details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
	htest(
		inputData, 
		signif.level = 0.05, 
		log.transform = TRUE, 
		save = TRUE, 
		folder, 
		StatTest, 
		output,
		adjust.pValue = TRUE,
		method = "bonferroni"
	)

Arguments

inputData

When inputData is missing, a dialog box will pop up allowing the user to click-and-point to the .csv file from which the data is to be read. It may also receive a character string pointing to a .csv file containing a data frame such as data(exampleMetReport), generated by MetReport. Alternatively, inputData takes an R vector containing the desired data frame.

signif.level

A numerical string indicating the p-value cut-off. Compounds presenting a p-value higher than specified through signif.level will not be reported.

log.transform

A logical parameter (TRUE or FALSE) indicating if the data should be log transformed before t-test or ANOVA. Log transformation is skipped if the input data contains any cell filled with negative value.

save

A logical vector (TRUE or FALSE) indicating if the resultant data frame should be saved in a .csv file. If save = TRUE, the .csv file will be saved in the path defined in the argument folder.

folder

A character string pointing to the folder where the results will be saved.

StatTest

A character string defining the statistical test to be performed (See details).

output

A character string indicating the name of the .csv file to be generated.

adjust.pValue

A logical vector indicating if p-values should be adjusted by the p.adjust.

method

A character string indicating the method used when applying p.adjust. See p.adjust.methods for possible methods. Default is 'bonferroni'.

Details

The argument StatTest may receive any of the following options for performing t-Test: "T-TEST", "T-test", "t-test", "t-TEST", "t", "T". The argument StatTest may receive any of the following options for performing ANOVA: "ANOVA", "Anova", "anova", "A", "a". If StatTest is missing, ANOVA is performed when more than 2 experimental conditions are under analysis and t-test is applied otherwise. A column containing the p-values resulting from the analysis is added to the data frame defined in inputData. As a result, htest produces a data frame consisting of only compounds statistically significantly different at the specified signif.level. If log.transform = TRUE (default), the t-test or ANOVA will be calculated using the log transformed data.

Value

htest produces a data frame containing only metabolites showing a p-value lower than the one specified through signif.level.

Note that the first line of the resulting data.frame is used to represent sample meta-data (for example replicates).

Author(s)

Raphael Aggio <ragg005@aucklanduni.ac.nz>

References

Aggio, R., Villas-Boas, S. G., & Ruggiero, K. (2011). Metab: an R package for high-throughput analysis of metabolomics data generated by GC-MS. Bioinformatics, 27(16), 2316-2318. doi: 10.1093/bioinformatics/btr379

See Also

MetReport, MetReportNames, normalizeByBiomass, normalizeByInternalStandard, removeFalsePositives, buildLib t.test p.adjust

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
### Load Metab ###	
	library(Metab)
### Load the inputData ###
	data(exampleMetReport)
### Perform t-test ####
	tTestResults <- htest(
		exampleMetReport, 
		signif.level = 0.05, 
		StatTest = "T", 
		save = FALSE
	)
### Show results ###
	print(tTestResults)
### Perform ANOVA ####
	AnovaResults <- htest(
		exampleMetReport, 
		signif.level = 0.05, 
		StatTest = "Anova", 
		save = FALSE
	)
### Show results ###
	print(AnovaResults)