rescale: Function to rescale values based on quantiles

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function rescales values x based on quantiles specified by the user such that x' = (x - q1) / (q2 - q1) where q is the specified quantile, q1 = q / 2, q2 = 1 - q/2) and x' are the new rescaled values.

Usage

1
rescale(x, na.rm = FALSE, q = 0)

Arguments

x
na.rm

TRUE if missing values should be removed, FALSE otherwise.

q

Quantile (must lie in [0,1]).

Details

In order to rescale gene expressions, q = 0.05 yielded comparable scales in numerous breast cancer microarray datasets (data not shown).The rational behind this is that, in general, 'extreme cases' (e.g. low and high proliferation, high and low expression of ESR1, ...) are often present in microarray datasets, making the estimation of 'extreme' quantiles quite stable. This is specially true for genes exhibiting some multi-modality like ESR1 or ERBB2.

Value

Vector of rescaled values with two attributes q1 and q1 containing the values of the lower and the upper quantiles respectively.

Author(s)

Benjamin Haibe-Kains

See Also

scale

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## load VDX dataset
data(vdxs)
## load NKI dataset
data(nkis)
## example of rescaling for ESR1 expression
par(mfrow=c(2,2))
hist(data.vdxs[ ,"205225_at"], xlab="205225_at", breaks=20,
  main="ESR1 in VDX")
hist(data.nkis[ ,"NM_000125"], xlab="NM_000125", breaks=20,
  main="ESR1 in NKI")
hist((rescale(x=data.vdxs[ ,"205225_at"], q=0.05) - 0.5) * 2,
  xlab="205225_at", breaks=20, main="ESR1 in VDX\nrescaled")
hist((rescale(x=data.nkis[ ,"NM_000125"], q=0.05) - 0.5) * 2,
  xlab="NM_000125", breaks=20, main="ESR1 in NKI\nrescaled")

Example output

Loading required package: survcomp
Loading required package: survival
Loading required package: prodlim
Loading required package: mclust
Package 'mclust' version 5.3
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: limma
Loading required package: biomaRt
Loading required package: iC10
Loading required package: pamr
Loading required package: cluster
Loading required package: iC10TrainingData
Loading required package: AIMS
Loading required package: e1071
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following object is masked from 'package:limma':

    plotMA

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

genefu documentation built on Jan. 28, 2021, 2:01 a.m.