findReclassCells: findReclassCells

View source: R/MULTIseq.Classification.Suite.R

findReclassCells R Documentation

findReclassCells

Description

'findReclassCells' has four steps:
(1) Normalize MULTI-seq sample barcode UMI count matrix
(2) Define positive and background peaks for each barcode distribution PDF
(3) Perform a quantile sweep, tracking the number of thresholds each negative cell surpasses at each quantile (i.e., Classification Stability)
(4) Define potentially-relcassifiable cells as those surpassing a single threshold at >= 1 quantile.

Usage

 findReclassCells(barTable, neg.cells) 

Arguments

barTable

MULTI-seq sample barcode UMI count matrix, as generated by MULTIseq.align. Note: Do not include summary columns. Include all cellIDs, regardless of initial sample classification workflow results.

neg.cells

Vector of cell IDs that could not be initially classified.

Details

Requires the 'KernSmooth' R package.

Value

Dataframe containing the (1) classification stability and (2) potential reclassification group for every negative cell.

Author(s)

Chris McGinnis

References

Wand MP & Jones MC. Kernel Smoothing. Monographs on Statistics and Applied Probability. Chapman & Hall, 1995.

Examples

  ## Perform semi-supervised reclassification
  ind <- which(final.calls=="Negative")
  reclass.cells <- findReclassCells(barTable, names(final.calls)[ind])
  reclass.res <- rescueCells(barTable, final.calls, reclass.cells)

  ## Visualize k-means match rate x classification stability
  ggplot(reclass.res[-1, ], aes(x=ClassStability, y=MatchRate_mean)) +
    geom_point() +
    xlim(c(nrow(reclass.res)-1,1)) +
    ylim(c(0,1.05)) +
    geom_errorbar(aes(ymin=MatchRate_mean-MatchRate_sd, ymax=MatchRate_mean+MatchRate_sd), width =.1) +
    geom_hline(yintercept = reclass.res$MatchRate_mean[1], color="red") +
    geom_hline(yintercept = reclass.res$MatchRate_mean[1]+3*reclass.res$MatchRate_sd[1], color="red",lty=2) +
    geom_hline(yintercept = reclass.res$MatchRate_mean[1]-3*reclass.res$MatchRate_sd[1], color="red",lty=2)

  ## Finalize sample classification results
  final.calls.rescued <- final.calls
  to.rescue <- rownames(reclass.cells)[which(reclass.cells$ClassStability >= 16)]
  final.calls.rescued[to.rescue] <- reclass.cells[to.rescue,"Reclassification"]

chris-mcginnis-ucsf/MULTI-seq documentation built on Nov. 22, 2023, 8:24 p.m.