affinityMatrix: Affinity matrix calculation

View source: R/affinityMatrix.R

affinityMatrixR Documentation

Affinity matrix calculation

Description

Computes affinity matrix from a generic distance matrix

Usage

affinityMatrix(Diff, K, sigma)

Arguments

Diff

Distance matrix

K

Number of nearest neighbors

sigma

Variance for local model

Value

Returns an affinity matrix that represents the neighborhood graph of the data points.

References

B Wang, A Mezlini, F Demir, M Fiume, T Zu, M Brudno, B Haibe-Kains, A Goldenberg (2014) Similarity Network Fusion: a fast and effective method to aggregate multiple data types on a genome wide scale. Nature Methods. Online. Jan 26, 2014
Using Association Signal Annotations to boost Similarity Network Fusion (2018), Peifeng Ruan, Ya Wang, Ronglai Shen, Shuang Wang.

Examples


#load data
data(data1)
data(data2)
data(weight1)
data(weight2)

#standard normalization of the datasets
data1 = standardNormalization(data1)
data2 = standardNormalization(data2)

# Calculate boosted distance matrices(here we calculate Euclidean Distance, 
Dist1 = dist2_w(as.matrix(data1),as.matrix(data1),weight1)
Dist2 = dist2_w(as.matrix(data2),as.matrix(data2),weight2)

# Next, construct similarity graphs
W1 = affinityMatrix(Dist1)
W2 = affinityMatrix(Dist2)


pfruan/abSNF documentation built on Sept. 16, 2022, 5:40 a.m.