GetLLMerged: Calculate log-likelihood for all pairs of clusters

View source: R/scChIX.R

GetLLMergedR Documentation

Calculate log-likelihood for all pairs of clusters

Description

Calculate log-likelihood for all pairs of clusters

Usage

GetLLMerged(
  w,
  cell.count.raw.merged,
  dat.impute.repress.lst,
  dat.impute.active,
  return.mat = FALSE
)

Arguments

w

mixing fraction of the two histone modifications, relative to a reference histone modification (usually dat.impute.active)

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.

return.mat

if TRUE, returns full log-likelihood matrix for all possible pairs. If False, returns the negative of the maximum likelihood value.

Value

if return.mat=TRUE, returns full log-likelihood matrix for all possible pairs. If False, returns the negative of the maximum likelihood value.

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.