This source did not publish a separate summary. Review SKILL.md before using the skill.
SKILL.md
Version Compatibility
Reference examples tested with: scanpy 1.10+
Before using code patterns, verify installed versions match. If versions differ:
R: packageVersion('<pkg>') then ?function_name to verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
Similarity Network Fusion
"Stratify patients using multi-omics data" → Fuse omics-specific patient similarity networks into a unified network for subtype discovery and clustering.
R: SNFtool::SNF() to fuse networks, spectralClustering() for subtyping
Basic SNF Workflow
Goal: Fuse multiple omics-specific patient similarity networks into a single unified network.
Approach: Compute per-omics distance and affinity matrices, then iteratively fuse with SNF.
library(SNFtool)
# Load omics data (samples x features)
data1 <- as.matrix(read.csv('rnaseq.csv', row.names = 1))
data2 <- as.matrix(read.csv('methylation.csv', row.names = 1))
data3 <- as.matrix(read.csv('mirna.csv', row.names = 1))
# Ensure matching samples
common <- Reduce(intersect, list(rownames(data1), rownames(data2), rownames(data3)))
data1 <- data1[common, ]
data2 <- data2[common, ]
data3 <- data3[common, ]
# Compute distance matrices
dist1 <- dist2(as.matrix(data1), as.matrix(data1))
dist2 <- dist2(as.matrix(data2), as.matrix(data2))
dist3 <- dist2(as.matrix(data3), as.matrix(data3))
# Construct affinity matrices
# K = number of neighbors, alpha = hyperparameter
K <- 20
alpha <- 0.5
aff1 <- affinityMatrix(dist1, K, alpha)
aff2 <- affinityMatrix(dist2, K, alpha)
aff3 <- affinityMatrix(dist3, K, alpha)
# Fuse networks
# T = number of iterations
fused <- SNF(list(aff1, aff2, aff3), K = K, t = 20)
Cluster Patients
Goal: Identify patient subtypes from the fused similarity network using spectral clustering.
Approach: Estimate optimal cluster count from the fused graph, then apply spectral clustering.