FitMixingWeight: Infer best pair of clusters from a double-incubated cell that...

View source: R/scChIX.R

FitMixingWeightR Documentation

Infer best pair of clusters from a double-incubated cell that maximizes the multinomial log-likelihood

Description

Infer best pair of clusters from a double-incubated cell that maximizes the multinomial log-likelihood

Usage

FitMixingWeight(
  cell.count.raw.merged,
  dat.impute.repress.lst,
  dat.impute.active,
  w.init,
  w.lower,
  w.upper,
  jmethod = "Brent"
)

Arguments

cell.count.raw.merged

vector of raw cell counts from a double-incubated cell.

dat.impute.repress.lst

Non-reference histone modification: list object containing cluster-specific probability weights across genomic bins. Each element in list is a probability vector across genomic bins for a cluster.

dat.impute.active

Reference histone modification: matrix object where rows are cluster names and columns are genomic bins. Each row is a probability vector across genomic bins.

w.init

initial guess for the mixing fraction between the two histone modifications. Mixing fraction is relative to the reference histone modification.

w.lower

lower bound for mixing weights, usually 0.

w.upper

lower bound for mixing weights, usually 1.

jmethod

method for optimizing w. Use "Brent" because it is a 1D problem given two clusters.

Value

optim output for best pair of clusters (one from an element in dat.impute.repress.lst, other from a row from dat.impute.active).

Examples

data(RawDblCountMatSubset)
cell.count.raw.merged.lst <- as.list(as.data.frame(as.matrix(count.mat.dbl.subset)))
act.repress.coord.lst <- lapply(cell.count.raw.merged.lst, function(cell.count.raw.merged){
  optim.out <- FitMixingWeight(cell.count.raw.merged = cell.count.raw.merged,
                               dat.impute.repress.lst = dat.impute.repress.lst,
                               dat.impute.active = dat.impute.active, w.init = 0.5, w.lower = wlower, w.upper = wupper, jmethod = "Brent")
  ll.mat <- GetLLMerged(optim.out$par, cell.count.raw.merged, dat.impute.repress.lst, dat.impute.active, return.mat = TRUE)
  return(list(ll.mat = ll.mat, w = optim.out$par))
})

jakeyeung/scChIX documentation built on May 7, 2023, 9:14 a.m.