mdist: Metabolite Distance Metric

Description Usage Arguments Details Value References Examples

Description

This function calculates a distance metric between two metabolomic measurements. These measurements can be either scalers or vectors.

Usage

1
mdist(x, y)

Arguments

x

a numerical scalar or vector of metabolomic measurements.

y

a numerical scalar or vector of metabolomic measurements.

Details

If x and y are of different dimensions, function mdist returns a value of -1, which indicates the mdist(x,y) is not defined in this scenario. When x and y have the same dimension, suppose they have p components. If p=1, then x or y is the abundance level measurement of a single metabolite, which is a non-negative real number. If p>1, then x or y is measurements of a metebolite-set with multiple metabolites. In this case, let x_i be the ith component of x, which is non-negative and denotes the abundance level measurement of the ith metabolite in the metabolite-set. The distance between x and y is defined as:

mdist(x,y)= √ { ∑_i I[δ_{x_i} \neq δ_{y_i}]+ ∑_i (x_i-y_i)^2 },

where δ_{x_i}=0 if x_i=0, elsewise, δ_{x_i}=1, and I[\cdot] is the indicator function.

Value

This function returns a non-negative value if x and y are of the same dimension. Otherwise it returns -1.

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

1
2
3
4
5
	x=c(0,1,2)
	y=c(1,0,3)
	z=c(0,1,2,3)
	mdist(x,y)
	mdist(x,z)

Example output

[1] 2.236068
Error: dimensions do not match 
[1] -1

KMDA documentation built on May 2, 2019, 3:59 p.m.