extractTestingResults: Extract Results From Moderated t-tests

View source: R/extractTestingResults.R

extractTestingResultsR Documentation

Extract Results From Moderated t-tests

Description

This function allows convenient access to results produced using the functions moderTestXgrp or moderTest2grp. The user can define the threshold and which type of multiple testing correction should be used (as long as the multiple testing correction method cited was actually performed as part of testing).

Usage

extractTestingResults(
  stat,
  compNo = 1,
  statTy = "BH",
  thrsh = 0.05,
  FCthrs = 1.5,
  annotCol = c("Accession", "EntryName", "GeneName", "ProteinName"),
  nSign = 6,
  outTy = "slim",
  sep = NULL,
  addTy = NULL,
  sortBy = NULL,
  rowNames = TRUE,
  filename = NULL,
  fileTy = "csvUS",
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Arguments

stat

('MArrayLM'-object or list) designed for the output from moderTest2grp or moderTestXgrp

compNo

(integer) the comparison name/number/index to be used

statTy

(character) the multiple-testing correction type to be considered when looking for significant changes with threshold thrsh (depends on which have been run initially with moderTest2grp or moderTestXgrp)

thrsh

(numeric) the threshold to be applied on statTy for the result of the statistcal testing (after multiple testing correction)

FCthrs

(numeric) Fold-Change threshold given as Fold-change and NOT log2(FC), default at 1.5 (for filtering at M-value =0.585)

annotCol

(character) column-names from the annotation to be included

nSign

(integer) number of significant digits whe returning results

outTy

(character) additional groups of columns to add ("allMeans", "all" or "slim") in addition; if outTy="slim" only the FDR- and FC-columns directly concerned will be extracted/displayed, column-names will be trimmed to max 26 characters; if outTy="slim2" only the FDR- and FC-columns directly concerned will be extracted/displayed, FDR- and FC- columns will have generic names (without indicating the comparison), all text will be trimmed to max 38 characters; if outTy="slim3" like slim2 but without ProteinName

sep

(character of length=1 or NULL) custom choice for separator for column-names of pairwise comparisons, otherwise based on stat or (if outTy="slim3" or outTy="slim4") '_vs_' (or '__vs__' if '-' or '_' appear in groups)

addTy

this argument has been deprecated and replaced by outTy (content of addTy will be ignored)

sortBy

(character or logical) optional sorting of results according to argument compNo, may be name of mutiple-testing correction (eg 'BH', see also argument statTy), if sortBy=TRUE the first column of argument statTy will be used

rowNames

(character or logical) optional custom rownames, or if rowNames=FALSE no rownames

filename

(character) optional (path and) file-name for exporting results to csv-file

fileTy

(character) file-type to be used with argument filename, may be 'csvEur' or 'csvUS'

silent

(logical) suppress messages

debug

(logical) display additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

Details

One single given comparison has to be selected by the user via argument compNo, multiple options exist : 1) The use may give and index which refers to the i'th comparison stored in the object stat$setup 2) It may be more convenient to directy cite a given comparison (eg compNo=c("B-C") in the examples below). Such comparions may be 'inversed' to the ones orginally performed, the M-values will be adjusted accordingly (eg compNo=c("C-B")) 3) It is also possible to give a vector of 2 integers which will be uses as index to the levels of the initial group-assignment, beware that levels are sorted.

The number and type of columns returned can be modulated using the argument outTy. outTy='slim' gives the fewer columns, only FDR and FC of current comparison specified in argument compNo will be returned. With outTy='slim2' the column-names for statistical testing and log Fold-Change will be generic, all colnames will be trimmed to max 25 characters outTy='all' results in a rather exaustive collection of columns (including annotation data, if present), The option outTy='slim3' is like slim2 but without column ProteinName while default outTy='allMeans' gives a compromise for the number of columns returned.

Value

This function returns a data.frame or matrix (if no annotation added) with values (and annotation) conform to fiter criteria

See Also

testRobustToNAimputation, moderTestXgrp or moderTest2grp

Examples

grp <- factor(rep(LETTERS[4:2],c(2,3,3)))
set.seed(2017); t8 <- matrix(round(rnorm(208*8,10,0.4),2), ncol=8,
  dimnames=list(paste(letters[],rep(1:8,each=26),sep=""), paste(grp,c(1:2,1:3,1:3),sep="")))
t8[3:6,1:2] <- t8[3:6,1:2] +3                    # augment lines 3:6 (c-f) 
t8[5:8,c(1:2,6:8)] <- t8[5:8,c(1:2,6:8)] -1.5    # lower lines 
t8[6:7,3:5] <- t8[6:7,3:5] +2.2                  # augment lines 
## expect to find C/A in c,d,g, (h)
## expect to find C/D in c,d,e,f
## expect to find A/D in f,g,(h) 
library(wrMisc)     # for testing we'll use this package
test8 <- moderTestXgrp(t8, grp) 
extractTestingResults(test8)
extractTestingResults(test8, compNo=c("B-C"))

extractTestingResults(test8, outTy="all")
extractTestingResults(test8, outTy="slim")

wrProteo documentation built on July 24, 2026, 1:06 a.m.