VGM_integrate: Utility for VDJ GEX matrix to integrated VDJ and GEX objects...

View source: R/VGM_integrate.R

VGM_integrateR Documentation

Utility for VDJ GEX matrix to integrated VDJ and GEX objects after addition of data to either

Description

(Re)-intergrated VDJ and GEX of one or two separate VGM objects. This can be used as a simple "updating" utility function, if metadata has been added to the VDJ dataframe and is also needed in the GEX matrix or the reverse. Entries are integrated by barcode. If barcodes have been altered (barcode column in VDJ and cell names in GEX), the function will not yield results

Usage

VGM_integrate(VGM, columns.to.transfer, genes.to.VDJ, seurat.slot)

Arguments

VGM

Output object from the VDJ_GEX_matrix function (VDJ_GEX_matrix.output)

columns.to.transfer

Optional. Character Vector. Column names of either the VDJ matrix or GEX meta.data that should be transferred to the corresponding other matrix. if not provided all columns missing from one will be integrated into the other matrix

genes.to.VDJ

Character vector of gene names in GEX. In many cases it is useful to extract expression values for a gene to metadata. This is done via SeuratObject::FetchData(vars = genes,slot = seurat.slot) function. The VGM integrate takes gene ids, extracts these and adds them to the VDJ dataframe. If provided, no other columns are integrated between VDJ and GEX and columns.to.transfer is ignored.

seurat.slot

GEX object data slot to pull from. Can be 'counts', 'data', or 'scale.data'

Value

An output object from the VDJ_GEX_matrix function with added columns in VDJ or GEX

Examples


#Adding a new clonotyping method to VDJ
small_vgm[[1]] <- VDJ_clonotype(VDJ=Platypus::small_vgm[[1]],
clone.strategy="cdr3.nt",
hierarchical = "single.chains", global.clonotype = TRUE)

small_vgm <- VGM_integrate(
VGM = small_vgm,
columns.to.transfer = NULL) #transfer all new columns
#and update clonotype_id and clonotype_frequency column
#(as does VDJ_clonotype_v3 in VDJ)

small_vgm <- VGM_integrate(
VGM = small_vgm,
columns.to.transfer = c("global_clonotype_id_cdr3.nt"))
#transfer only selected columns

#Pull genes from GEX and add as metadata column to VDJ

small_vgm <- VGM_integrate(
small_vgm, genes.to.VDJ = c("CD19","CD24A"),seurat.slot = "counts")

Platypus documentation built on Aug. 15, 2022, 9:08 a.m.