calc.het: Calculate Age-related Expression and Heterogeneity Changes

Description Usage Arguments Value Examples

View source: R/heterogeneity.R

Description

Calculate Age-related Expression and Heterogeneity Changes

Usage

1
2
3
4
calc.het(exprmat, age, age_in = "days", age_to = "pw-0.25",
  batch_corr = "NC", modex = "linear", tr_log2 = T,
  sc_features = T, covariates = NA, het_change_met = "spearman",
  padj_met = "fdr")

Arguments

exprmat

a numeric matrix with the expression values, where columns are the samples and rows are probesets, transcripts, or genes.

age

a numeric vector, where the names correspond to samples (the same as colnames of the given matrix).

age_in

type of the age vector, allowed values are days or years. defaults to 'days'

age_to

final format of age vector. allowed values are 'years', 'days', 'pw-N', and 'lg-N', where N is any number. 'pw' means power. e.g. pw-0.5 means sqrt(age), and 'lg' means log, e.g. lg-2 means log2(age).defaults to 'pw-0.25'

batch_corr

batch correction strategy. available values are i) NC: No Correction, ii) QN: Quantile Normalization, iii) LR: Linear regression (requires covariates), iv) SVA: surrogate variable analysis, v) LR+QN: Linear regression followed by quantile normalization, and vi) SVA+QN: SVA followed by quantile normalization. Defaults to 'NC'.

modex

expression change calculation method. 'linear' or 'loess', defaults to 'linear'

tr_log2

logical to set log2 transforming expression matrix. defaults to TRUE.

sc_features

logical to set whether to scale features. defaults to TRUE.

covariates

a list of covarietes where each element is a vector with sampleIDs as names

het_change_met

heterogeneity change calculation method. 'LR', for 'linear regression', or and correlation method accepted by cor.test() function.

padj_met

method for multiple test correction. value is passed to 'p.adjust' function. defaults to 'fdr'.

Value

a list object with summary results including expression level and heterogeneity changes, input values, intermediate values, and heterogeneity matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
sampnames = paste('sample',1:20,sep='')
myexp <- sapply( 1:20, function(i){ rnorm(n = 10000, mean = sample(1:3, 1), sd = sample(c(1, 3), 1)) })
rownames(myexp) = paste('gene', 1:10000, sep = '')
colnames(myexp) = sampnames
agevec <- sample(20:80,20)
names(agevec) = sampnames
het_result <- calc.het(myexp, agevec, age_in = 'years', tr_log2 = F)
head(het_result$sampleID)
het_result$input_expr[1:5,1:5] # expression values used as input
head(het_result$input_age) # input ages
head(het_result$usedAge) # ages used in calculations - transformation is applied using 'age_to' parameter
het_result$resid_mat[1:5,1:5] # heterogeneity values (residual matrix)
head(het_result$feature_result) # summary statistics

mdonertas/hetAge documentation built on Jan. 2, 2020, 12:53 a.m.