Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

spearman.group

Grouping Based on Spearman Correlation Coefficients


Description

This function forms metabolite-sets based on pairwise Spearman correlation between different metabolites.

Usage

spearman.group(data, threshold)

Arguments

data

a matrix with each row being a metabolite and each column being a sample.

threshold

a threshold value for correlation coeffients.

Details

The input data is a matrix with each row denoting a metabolites. This function groups different rows of the data matrix together based on the Spearman correlation coefficients between two rows. It works in the following way.
First, each row in the data matrix is treated as a node. If the Spearman correlation coefficient between two nodes is larger than the threshold value, then an edge is added between this two nodes. Second, all nodes which are connected (not necessary to be pairwisely connected) form a group. At the end, a vector of group labels can be obtained. The length of this vector is the same as the number of rows in the data matrix. Different rows with the same group label are in the same group. The number of distinct values in this label-vector is the number of groups.

Value

A vector of group labels, of the same length as the number of rows in the data matrix.

References

Zhan, X., Patterson, A. D., & Ghosh, D. (2015). Kernel approaches for differential expression analysis of mass spectrometry-based metabolomics data. BMC Bioinformatics, 16(1), 77.

Examples

nr=20
	nc=10	
	temp= sample(c(0,1,2,3),size=nr*nc, replace = TRUE,prob=c(0.4,0.2,0.2,0.2))
	x=matrix(temp,nrow=nr,ncol=nc)
	spearman.group(x,0.5)

KMDA

Kernel-Based Metabolite Differential Analysis

v1.0
GNU General Public License
Authors
Xiang Zhan and Debashis Ghosh
Initial release
2015-03-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.