Samples are assigned to a particular state if the fraction of cells in that state is significantly high. Separately, samples are also assigned to states according to state fractions that are particularly low. Significance is measured against the average state fractions of the population, and this in turn is computed by bootstrapping (from cells across all samples) with <n_iter> repeats.

assign_bulk_states(
  scores,
  groups,
  n.iter = 1000L,
  sample.size = 200,
  p = 0.001,
  min = NULL,
  diff = NULL,
  return.cells = FALSE,
  bootstraps = NULL
)

Arguments

scores

a dataframe of cell signature scores. Cells are rows and signatures are columns.

groups

list of samples (i.e. rowname subsets in scores) to assign to states.

n.iter

number of iterations. Default: 1000

sample.size

the sample size used in each iteration Default: 200

p

p-value Default: 0.001

min

minimum value required for a row to be assigned to a column. Default: NULL

diff

minimum difference in value to the 'next-best' row that is required for a row to be assigned to a column. Default: NULL

return.cells

logical value; return cell ids instead of sample ids? Default: FALSE

bootstraps

if provided, will be used instead of computing bootstrapped repeats. Should be a dataframe with the same rownames as colnames in <scores> and with as many columns as there are bootstrap repeats. Default: NULL

Value

a list of sample assignments to states. The list is organised by state, and nested for state-high and state-low samples.