calcSummary: Summarize median comparison and p-value calculation results

Description Usage Arguments Details Value See Also Examples

View source: R/calcSummary.R

Description

Summarizes the results of the median comparison function calcMedians and the p-value calculation function calcPvalues. Should be used with the matrices originating from these two functions.

Usage

1
calcSummary(medians, pvalues)

Arguments

medians

a matrix containing median difference values calculated by the calcMedians function. For further details look at the documentation of this function.

pvalues

a matrix containing p-values calculated by the calcPvalues function. For further details look at the documentation of this function.

Details

calcSummary

All genes with a median comparison value >= 0.05 and a p-value of <= 0.01 are summarized into a data.frame. These genes are assumed to contain a batch effect

Value

Null if there are no batch effects detected, else A data frame with the columns "gene" containing the gene name, "batch" containing the batch number from which the gene was found, "median" and "p-value" containing the calculated median difference values and the p-values, respectively.

See Also

calcMedians

calcPvalues

correctBatchEffect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Shortly running example. For a more realistic example that takes
## some more time, run the same procedure with the full BEclearData
## dataset.

## Whole procedure that has to be done to use this function.
data(BEclearData)
ex.data <- ex.data[31:90,7:26]
ex.samples <- ex.samples[7:26,]

# Calculates median difference values and p-values from the example data
library(data.table)
samples <- data.table(ex.samples)
data <- data.table(feature=rownames(ex.data), ex.data)
data <- melt(data = data, id.vars = "feature", variable.name = "sample", 
            value.name = "beta.value")
setkey(data, "feature", "sample")
med <- calcMedians(data=data, samples=samples)
pvals <- calcPvalues(data=data, samples=samples, adjusted=TRUE, 
method="fdr")

# Summarize p-values and median differences for batch affected genes 
sum <- calcSummary(medians=med, pvalues=pvals)

BEclear documentation built on Nov. 1, 2018, 4:29 a.m.