rezakj / iCellR

Single (i) Cell R package (iCellR) is an interactive R package to work with high-throughput single cell sequencing technologies (i.e scRNA-seq, scVDJ-seq, scATAC-seq, CITE-Seq and Spatial Transcriptomics (ST)).
121 stars 19 forks source link

converting old iCellR object to new object #21

Closed joybarrett08 closed 4 years ago

joybarrett08 commented 4 years ago

Hi!

I received the following error while trying to remove clusters in one of my objects:

Error in clust.rm(my.obj, clust.to.rm = 1): no slot of name "knetl.data" for this object of class "iCellR"

Given that Knetl is a new feature on iCellR, my older object its likely incompatible. Is there a way to convert my old object into a new iCellR object?

rezakj commented 4 years ago

Let's say your old iCellR object is called my.obj and you want to make a new object called my.obj.1.

1- After installing the latest version of iCellR, get the raw data from the old object and make a new object called my.obj.1. Here is how to do it:

my.data <- my.obj@raw.data
my.obj.1 <- make.obj(my.data)

2- Get the data slots you need from the old object (my.obj) and put them in the new one (my.obj.1). Here is how to do it:

my.obj.1@adt.raw <- my.obj@adt.raw
my.obj.1@adt.raw <- my.obj@adt.main
my.obj.1@vdj.data <- my.obj@vdj.data
my.obj.1@main.data <- my.obj@main.data
my.obj.1@imputed.data <- my.obj@imputed.data
my.obj.1@stats <- my.obj@stats
my.obj.1@umap.data <- my.obj@umap.data
my.obj.1@opt.pcs <- my.obj@opt.pcs
my.obj.1@clust.avg <- my.obj@clust.avg
my.obj.1@data.conditions <- my.obj@data.conditions
my.obj.1@diffusion.data <- my.obj@diffusion.data
my.obj.1@gene.data <- my.obj@gene.data
my.obj.1@pca.data <- my.obj@pca.data
my.obj.1@gene.model <- my.obj@gene.model
my.obj.1@cluster.data <- my.obj@cluster.data
my.obj.1@tsne.data <- my.obj@tsne.data
my.obj.1@tsne.data.3d <- my.obj@tsne.data.3d
my.obj.1@best.clust <- my.obj@best.clust

3- do the rest of the analyses you require in the new object and save it.

save(my.obj, file = "my.obj.Robj")