calcMedians: Calculate median difference values

Description Usage Arguments Details Value See Also Examples

View source: R/calcMedians.R

Description

Compares the median value of all beta values belonging to one batch with the median value of all beta values belonging to all other batches. Returns a matrix containing this median difference value for every gene in every batch, columns define the batch numbers, rows the gene names.

Usage

1
calcMedians(data, samples, BPPARAM=bpparam())

Arguments

data

a data.table with one column indicating the sample, one the features and a value column indicating the beta value

samples

data frame with two columns, the first column has to contain the sample numbers, the second column has to contain the corresponding batch number. Colnames have to be named as "sample_id" and "batch_id".

BPPARAM

An instance of the BiocParallelParam-class that determines how to parallelisation of the functions will be evaluated.

Details

calcMedians

Value

a matrix containing median comparison values for all genes in all batches, the column names define the batch numbers, row names are the same gene names as contained in the input matrix.

See Also

correctBatchEffect

Examples

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

## Calculate median comparison values in non-parallel mode
data(BEclearData)
ex.data <- ex.data[31:90,7:26]
ex.samples <- ex.samples[7:26,]

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")

medians <- calcMedians(data=data, samples=samples)

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