Learn R Programming

SpaCCr (version 0.1.0)

SpaCC_Methy: Performs Spatial Convex Clustering for methylation data

Description

Performs Spatial Convex Clustering for methylation data

Usage

SpaCC_Methy(X, Coordinates, gamma.seq, dist.cutoff = 20000, sig = 1/5000, weights = NULL, center = TRUE, scale = FALSE, nfolds = 5, nu = NULL, tol.base = 1e-04, tol.miss = 1e-04, max.iter.base = 5000, max.iter.miss = 500, frac = 0.1, parallel = FALSE, gam.rule = 2, thresh.mult = 1, thresh.value = NULL)

Arguments

X
A subject (n) by variable (p) matrix; the data
Coordinates
a vector listing genomic coordinates
gamma.seq
a vector of regularization parameters
dist.cutoff
maximum distance at which probes should be regularized
sig
positive scalar controling spatial weight decay
weights
a vector of spatial weights
center
should data be centered
scale
should data be scaled
nfolds
number of folds for cross validation
nu
parameter for augmented lagrangian
tol.base
tolerance level for base function
tol.miss
tolerance for missing function
max.iter.base
maximum number of iterations for base function
max.iter.miss
maximum number of iterations for missing function
frac
fration of fold to use for cross validation
parallel
should algorithm be run in parallel
gam.rule
cross validation rule
thresh.mult
multiplier for threshold value
thresh.value
value of threshold

Value

Labels a vector of cluster labels

Examples

Run this code
data("methy")
methy <- methy[1:20,1:10]
library(dplyr)
library(tidyr)
Coordinates <- methy$Genomic_Coordinate
methy %>%
 tbl_df() %>%
 select(-Chromosome,-Genomic_Coordinate) %>%
 gather(Subject,Value,-ProbeID) %>%
 spread(ProbeID,Value) -> X
SubjectLabels <- X$Subject
X <- X[,-1] %>% as.matrix()
verbose=TRUE
tol.base = 1e-4
tol.miss = 1e-4
max.iter.base=5000
max.iter.miss=500
ngam = 20
gamma.seq <- exp(seq(log(1e-1),log(1e1),length.out=ngam))
ClusterLabels <- SpaCC_Methy(X = X,Coordinates = Coordinates,gamma.seq = gamma.seq)

Run the code above in your browser using DataLab