View source: R/PlatypusDB_VGM_to_AIRR.R
PlatypusDB_VGM_to_AIRR | R Documentation |
Exports AIRR compatible tables supplemented with VDJ and GEX information from the Platypus VGM object and the cellranger output airr_rearrangements.tsv
PlatypusDB_VGM_to_AIRR( VGM, VDJ.features.to.append, GEX.features.to.append, airr.rearrangements, airr.integrate )
VGM |
Output object of the VDJ_GEX_matrix function generated with VDJ.combine = T, GEX.combine = T (to merge all samples) and integrate.VDJ.to.GEX = T (to integrate VDJ and GEX data) |
VDJ.features.to.append |
Character vector. Defaults to "none". Can be either "all" or column names of the VGM VDJ matrix (VGM[[1]]) to append to the AIRR compatible table. |
GEX.features.to.append |
Character vector. Defaults to "none". Can be either "all" or GEX metadata column names or Gene names of the VGM GEX object (VGM[[2]])(passed to Seurat::FetchData()) to append to the AIRR compatible table. For a list of available features run: names(VGM[[2]]@meta.data) and rownames(VGM[[2]]) |
airr.rearrangements |
Source of the airr_rearrangements.tsv file as generated by Cellranger. There are 3 available input options: 1. R list object from Platypus_DB_load_from_disk or Platypus_DB_fetch / 2. List with local paths to airr_rearrangements.tsv / 3. List of airr_rearrangements.tsv loaded in as R objects within the current R enviroment. ! Order of input list must be identical to that of sample_ids in the VGM ! If not provided or set to "none" CIGAR strings in output will be empty. |
airr.integrate |
Boolean. Defaults to TRUE, whether to integrate output AIRR tables |
A list of length of samples in VGM containing a AIRR-compatible dataframe for each sample if airr.integrate = F or a single dataframe if airr.integrate = T ! Cave the format: VGM object => 1 cell = 1 row; AIRR table 1 cell = as many rows as VDJ and VJ chains available for that cell. GEX cell-level information is attached to all rows containing a chain of that cell.
## Not run: #complete workflow below #usage with airr rearrangement tables from PlatypusDB_load_from_disk #or PlatypusDB_fetch list object airr.list.out <- PlatypusDB_VGM_to_AIRR(VGM = VGM , VDJ.features.to.append = c("VDJ_cdr3s_aa") , GEX.features.to.append = c("CTLA4", "TOX"), airr.rearrangements = Data.in) #usage with airr rearrangement tables from disk airr.list.out <- PlatypusDB_VGM_to_AIRR(VGM = VGM , VDJ.features.to.append = c("VDJ_cdr3s_aa") , GEX.features.to.append = c("CTLA4", "TOX"), airr.rearrangements =list("~/path_to/s1/airr.rearrangement.tsv" ,"~/path_to/s2/airr_rearrangement.tsv")) #usage with airr rearrangement tables from objects in R environment airr.list.out <- PlatypusDB_VGM_to_AIRR(VGM = VGM , VDJ.features.to.append = c("VDJ_cdr3s_aa") , GEX.features.to.append = c("CTLA4", "TOX"), airr.rearrangements = list(airr_rearrangements.s1, airr_rearrangements_2)) #Complete workflow #set paths of cellranger directories containing #also the airr_rearrangements.tsv file VDJ.out.directory.list <- list() VDJ.out.directory.list[[1]] <- c("~/cellrangerVDJ/s1") VDJ.out.directory.list[[2]] <- c("~/cellrangerVDJ/s2") GEX.out.directory.list <- list() GEX.out.directory.list[[1]] <- c("~/cellrangerGEX/s1") GEX.out.directory.list[[2]] <- c("~/cellrangerGEX/s2") #Run VGM with GEX and VDJ integration VGM <- VDJ_GEX_matrix(VDJ.out.directory.list = VDJ.out.directory.list, GEX.out.directory.list = GEX.out.directory.list, GEX.integrate = TRUE, VDJ.combine = TRUE, integrate.GEX.to.VDJ = TRUE , integrate.VDJ.to.GEX = TRUE, get.VDJ.stats = FALSE, trim.and.align = FALSE) #Generate AIRR compatible table supplemented by GEX information airr.list.out <- PlatypusDB_VGM_to_AIRR(VGM = VGM, VDJ.features.to.append = c("VDJ_sequence_nt_trimmed","VJ_sequence_nt_trimmed"), GEX.features.to.append = c("UMAP_1","UMAP_2","CTLA4", "TOX"), airr.rearrangements = c("~/cellrangerVDJ/s1/airr_rearrangement.tsv" ,"~/cellrangerVDJ/s2/airr_rearrangement.tsv")) #To save a dataframe as .tsv write.table(airr_dataframe, file = "supplemented_airr_rearrangements.tsv" , sep='\t', row.names = FALSE, quote=FALSE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.