Skip to contents

repairBarcode considers cell barcodes in the Seurat object and alters the cell barcode given in a list of data frames/matrices to match the Seurat object. This facilitates merging the data frames into the Seurat object as additional metadata columns.

Usage

repairBarcode(
  data_list,
  SeuratObj,
  sample_names,
  seurat_sample_column = "sample_id"
)

Arguments

data_list

a list, each element either of class data.frame or matrix. Each element holds data from 1 library ('sample')

SeuratObj

Seurat object.

sample_names

a vector of sample names in the data. 'Sample' here refers to sequencing library.

seurat_sample_column

Column name in SeuratObj metadata where the sample name/ID information is stored.

Value

A list of data.frames/matrices with the cell barcodes repaired to match barcodes in the Seurat object.

Details

This function would work either for a list of data frames where the cell barcodes are given in a column (either named 'barcode' or 'CB'), or a list of matrices where the cell barcodes are assumed to be row names of each matrix. The function first establishes a mapping table between samples (given in seurat_sample_column in the Seurat object) and their sample-specific cell barcode prefix/suffix, and then repairs the barcodes given in the VDJ data frame to match the Seurat object.