Closed france-hub closed 3 years ago
It seems like you are in the right track. For the clonotype data iCellR just plots them on UMAP, tSNE or KNetL map. You can actually do it without iCellR, just get the UMAP dimensions (x and Y) and plot each clonotype separately using ggplot2, this is if you run into issues. Otherwise if the cell barcodes in your main data and vdj data slots match, iCellR should plot them for you. And yes, you can use the filtered vdj data.
Thank you, it worked!
Perfect!
Hi rezakj, thank you for your useful package!
I have two questions: 1) Can I run prep.vdj on filtered_contig_annotations.csv or it's better to have the all_contig_annotations.csv? 2) I have an issue with the clono.plot function. I'll summarize the code so that maybe you can help me to find the issue:
`#Convert Seurat to iCellR object my.data <- as.data.frame(as.matrix(sobj@assays$RNA@counts)) my.obj <- make.obj(my.data)
Add Seurat's data
myUMAP <- as.data.frame(sobj@reductions$umap@cell.embeddings) myPCA <- as.data.frame(sobj@reductions$pca@cell.embeddings) Clust <- as.data.frame(as.matrix(Idents(sobj))) colnames(Clust) <- "clusters" my.obj@main.data <- as.data.frame(sobj[["RNA"]]@data) my.obj@umap.data <- myUMAP my.obj@pca.data <- myPCA my.obj@best.clust <- Clust my.obj@metadata <- sobj@meta.data
Check the new object
slotNames(my.obj) my.obj
Read in contig annotated files
contig_batch1 <- paste(PrimaryDirectory, "data_VDJ/20018-01", sep ='/') contig_batch2 <- paste(PrimaryDirectory, "data_VDJ/20018-04", sep ='/') my.vdj.1 <- read.csv(paste(contig_batch1,"06/S06.csv", sep = "/")) my.vdj.2 <- read.csv(paste(contig_batch1,"07/S07.csv", sep = "/")) my.vdj.3 <- read.csv(paste(contig_batch2, "01/filtered_contig_annotations.csv", sep = "/")) my.vdj.4 <- read.csv(paste(contig_batch2, "02/filtered_contig_annotations.csv", sep = "/")) my.vdj.5 <- read.csv(paste(contig_batch2, "03/filtered_contig_annotations.csv", sep = "/")) my.vdj.6 <- read.csv(paste(contig_batch2, "04/filtered_contig_annotations.csv", sep = "/")) my.vdj.7 <- read.csv(paste(contig_batch2, "05/filtered_contig_annotations.csv", sep = "/")) my.vdj.8 <- read.csv(paste(contig_batch2, "06/filtered_contig_annotations.csv", sep = "/"))
Run prep.vdj
my.vdj.1 <- prep.vdj(vdj.data = my.vdj.1, cond.name = "CR_bas_229") my.vdj.2 <- prep.vdj(vdj.data = my.vdj.2, cond.name = "CR_post_229") my.vdj.3 <- prep.vdj(vdj.data = my.vdj.3, cond.name = "NR_bas_V09") my.vdj.4 <- prep.vdj(vdj.data = my.vdj.4, cond.name = "NR_post_V09") my.vdj.5 <- prep.vdj(vdj.data = my.vdj.5, cond.name = "NR_bas_219") my.vdj.6 <- prep.vdj(vdj.data = my.vdj.6, cond.name = "NR_post_219") my.vdj.7 <- prep.vdj(vdj.data = my.vdj.7, cond.name = "CR_bas_264") my.vdj.8 <- prep.vdj(vdj.data = my.vdj.8, cond.name = "CR_post_264")
Create vdj dataframe and add it to iCellR object my.vdj.data <- rbind(my.vdj.1, my.vdj.2, my.vdj.3, my.vdj.4, my.vdj.5, my.vdj.6, my.vdj.7, my.vdj.8) my.obj <- add.vdj(my.obj, vdj.data = my.vdj.data)
clonotype.frequency <- as.data.frame(sort(table(as.character(as.matrix((my.obj@vdj.data)[1]))),decreasing = TRUE))
head(clonotype.frequency) Var1 Freq 1 clonotype1 1577 2 clonotype2 870 3 clonotype3 611 4 clonotype4 516 5 clonotype7 370 6 clonotype6 361
clono.plot(my.obj, plot.data.type = "umap", clonotype.column = 1, barcode.column = 2, clono = "clonotype1", conds.to.plot = NULL, cell.transparency = 1, clust.dim = 2, interactive = F)
Error in
$<-.data.frame
(*tmp*
, "MyCol", value = "red") : replacement has 1 row, data has 0Thank you very much
Francesco