Assign simulated immune repertoire sequences (BCR or TCR) simulated by Echidna to transcriptome and location in a spatial image in function of cell type.

Spatial_VDJ_assignment(
  GEX_matrix,
  vgm,
  vgm_VDJ,
  celltype,
  simulated_VDJ,
  method = c("random", "density", "germline")
)

Arguments

GEX_matrix

Dataframe containing barcode, imagecol and imagerow from bcs_merge.

vgm

Output of VDJ_GEX_matrix function with already the simulated VDJ data.

vgm_VDJ

Dataframe from VDJ_GEX_matrix output (vgm[[1]]).

celltype

Character designating the cell type that we want to study either "B" or "T".

simulated_VDJ

Large list, output of Echidna simulate_repertoire function. Only needed if we use simulated data.

method

Character to chose the assignment method of BCR or TCR to transcriptomic information, it can be "random", "density" or "germline".

Value

A dataframe corresponding to the VDJ (VGM[[1]]) with GEX_barcode and x, y coordinates column (allowing to localise each BCR or TCR on the spatial image).

Examples

if (FALSE) {
#1)Assignment random to GEX
random_BCR_assignment <- Spatial_VDJ_assignment(GEX_matrix = GEX_matrix,
vgm = vgm_with_simulated_VDJ,
vgm_VDJ = vgm_with_simulated_VDJ$VDJ, celltype = "B",
simulated_VDJ = simulated_B_cells_VDJ, method = "random")

#2)Assignment density-based
density_BCR_assignment<-Spatial_VDJ_assignment(GEX_matrix = GEX_matrix,
vgm = vgm_with_simulated_VDJ,
vgm_VDJ = vgm_with_simulated_VDJ$VDJ, celltype = "B",
simulated_VDJ = simulated_B_cells_VDJ, method = "density")

#3)Assignment germline-based
germline_BCR_assignment<-Spatial_VDJ_assignment(GEX_matrix = GEX_matrix,
vgm = vgm_with_simulated_VDJ,
vgm_VDJ = vgm_with_simulated_VDJ$VDJ, celltype = "B",
simulated_VDJ = simulated_B_cells_VDJ, method = "germline")
}