reduce_rep: Reduce sample replicates

View source: R/reduce_rep.R

reduce_repR Documentation

Reduce sample replicates

Description

In an expression profile matrix such as RNA-seq count table, where columns and rows are samples and biological molecules respectively, reduce sample replicates according to sum of correlation coefficients (Pearson, Spearman, Kendall).

Usage

reduce_rep(dat, n = 3, sim.meth = "pearson")

Arguments

dat

Abundance matrix in form of data.frame or matrix, where columns and rows are samples and biological molecules respectively. For example, gene exression matrix generated in RNA-seq.

n

An integer, the max number of replicates to keep per sample (e.g. tissue type). Within each sample, pairwise correlations are calculated among all replicates, and the correlations between one replicate and other relicates are summed. The replicates with top n largest sums are retained in each sample.

sim.meth

One of pearson (default), kendall, or spearman, indicating which correlation coefficient method to use for calculating similarities between replicates.

Value

A matrix.

Author(s)

Jianhai Zhang jzhan067@ucr.edu
Dr. Thomas Girke thomas.girke@ucr.edu

Examples


# Random abundance matrix.
dat <- matrix(rnorm(100), nrow=10)
# Two samples, each has 5 replicates.
colnames(dat) <- c(rep('sampleA', 5), rep('sampleB', 5))
rownames(dat) <- paste0('gene', seq_len(nrow(dat)))
reduce_rep(dat)

jianhaizhang/spatialHeatmap documentation built on July 31, 2024, 2:59 a.m.