prot.signif: Assess significance of q-values and sort by significance

View source: R/prot_signif.R

prot.signifR Documentation

Assess significance of q-values and sort by significance

Description

Given matrix with at least a column containing q-values and (optionally) a column containing p-values, or a list of such matrices, and a significance level, this function adds a column "signif" to the matrix/matrices containing 0 if the q-value is insignificant and 1 if the q-value is significant at the given level. Moreover, if a column conataining p-values is given, this function sorts the values in the matrix/matrices from small to large p-values, with NA values at the bottom. If no column with p-values is given, sorting will be done on the q-values, which might be less accurate.

Usage

prot.signif(coefmatlist, level = 0.05, qcol = "qval", pcol = "pval")

Arguments

coefmatlist

Either a matrix containing a column termed "pval" and a column termed "qval", or a list of such matrices.

level

The significance level at which the q-value needs to be controlled. Defaults to 5%.

qcol

A character string or numeric index indicating the column containing the q-values. Defaults to "qval".

pcol

Optional. A character string or numeric index indicating the column containing the p-values. Sorting on p-values is more accurate than sorting on q-values. If you don't have a column containing p-values or would want to sort only on q-values, set pcol to NULL. Defaults to "pval".

Value

Depending on the input, either a matrix or a list of matrices with an extra numeric column termed "qval", containing corrected p-values.

Examples

#Create a contrast matrix L for investigating whether all 10 pairwise contrasts between conditions conc6A, conc6B, conc6D and conc6E differ from zero:
L <- makeContrast(contrasts=c("conc6B-conc6A","conc6C-conc6A","conc6D-conc6A","conc6E-conc6A","conc6C-conc6B","conc6D-conc6B","conc6E-conc6B","conc6D-conc6C","conc6E-conc6C","conc6E-conc6D"),
levels=c("conc6A","conc6B","conc6C","conc6D","conc6E"))
#Load the protLM object protmodel:
protmodel <- data(modelRR, package="MSqRob")
#Test the contrast L:
protvalues <- test.protLMcontrast(protmodel,L)
#Adjust the p-values by Benjamini-Hochberg FDR:
protvalues <- prot.p.adjust(protvalues)
#Assess the significance of the q-values:
protvalues <- prot.signif(protvalues)

statOmics/MSqRob documentation built on Dec. 8, 2022, 6 a.m.