normalize_correlation: Spatial quantile normalization (SpQN)

Description Usage Arguments Value Examples

View source: R/spqn.R

Description

This method was developed to remove a mean-correlation relationship in correlation matrices built from gene expression data. It can serve as pre-processing step prior to a co-expression analysis.

Usage

1
normalize_correlation(cor_mat, ave_exp, ngrp, size_grp, ref_grp)

Arguments

cor_mat

A (square and symmetrix) correlation matrix.

ave_exp

A vector of expression levels, same length as the number of rows of the correlation matrix in cor_mat. For other types of data, ave_exp can be the vector corresponding to the row/column of the correlation matrix, whose dependency with the distribution of correlations need to be removed.

ngrp

Number of bins in each row/column to be used to partition the correlation matrix, integer.

size_grp

Size of the outer bins to be used to appriximate the distribution of the inner bins, in order to smooth the normalization. Note that the product of size_grp and ngrp must be equal or larger than than the row/column number of cor_mat, and there is no smoothness in the normalization when they are equal.

ref_grp

Location of the reference bin on the diagonal, whose distribution will be used as target distribution in the normalization, an integer.

Value

A normalized correlation matrix.

Examples

1
2
3
4
5
6
if(require(spqnData)){
  data(gtex.4k)
  cor_ori <- cor(t(assay(gtex.4k)))
  ave_logrpkm <- rowData(gtex.4k)$ave_logrpkm
  normalize_correlation(cor_ori, ave_exp = ave_logrpkm,
                        ngrp=10, size_grp=15, ref_grp=9)}

hansenlab/spqn documentation built on April 25, 2020, 5:15 p.m.