Skip to contents

One depth column (d|<region>: the window z, capped at +/- cap, NA -> 0) and one signed allelic column (a|<region>) per eligible region of the given classes. Allelic z = (nA - n / 2) / sqrt(n / 4 * (1 + (n - 1) * rho)) on the oriented votes, capped at +/- cap, 0 below min_n molecules; the sign keeps which haplotype is in excess, so subclones that are imbalanced on opposite haplotypes separate (e.g. two subclones with a loss of different chr21 homologues). Input whose orient is not in keep_orient (unoriented block-phased none, or clone = oriented by known groups such as spatial regions, which would leak the grouping into discovery) is first re-oriented by the all-cell leave-one-out pseudobulk (orient_blocks, NULL groups) when votes, atoms, regions and cells are given.

Usage

clone_feature_matrix(
  feat_long,
  classes = c("arm", "20Mb"),
  rho,
  cap = 6,
  min_n = 5,
  votes = NULL,
  atoms = NULL,
  regions = NULL,
  cells = NULL,
  keep_orient = c("anchored", "pseudobulk")
)

Arguments

feat_long

features long table (cell_features() long)

classes

region classes used

rho

beta-binomial overdispersion of the molecule votes

cap

cap of |z|

min_n

minimal molecules for an allelic value

votes, atoms, regions, cells

optional: orient unoriented input (cells = names in vote index order)

keep_orient

orient labels used as given (chromosome-wide anchored phase, all-cell pseudobulk)

Value

numeric matrix cells x features (rownames = cells)