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

Can I integrate data with iCellR? #27

Closed Midsummer723 closed 3 years ago

Midsummer723 commented 3 years ago

I appreciate this great tools for analysis. Could I ask you that there is a integration function for multiple data or not. I have about 50 patients data (all are the 10x files) which I want to merge them into one object. I find the "Combined Principal Component Alignment (CPCA)". But how can I use for my data. Thank you very much.

rezakj commented 3 years ago

Yes, it is very easy. First read each patient data like this:

P1 <- load10x("filtered_gene_bc_matrices/hg19/")
P2 <- load10x("filtered_gene_bc_matrices/hg19/")
P3 <- load10x("filtered_gene_bc_matrices/hg19/")
...
P50 <- load10x("filtered_gene_bc_matrices/hg19/")

Then use the data.aggregation function to make them into one file while also labeling each patient/condition.

Example for 3 patients: my.data <- data.aggregation(samples = c("P1", "p2","P3"), condition.names = c("P1", "p2","P3"))

Then make an object:

my.obj <- make.obj(my.data)
my.obj

CPCA is for batch alignment, which you run instead of PCA step if you wish to do batch alignment.

Midsummer723 commented 3 years ago

Thank you for the quick reply. The CPCA can work for the batch effect,right? If it is, how can I use it to my data . Like the "my.obj <- iba(my.obj,dims = 1:30, k = 10,ba.method = "CPCA", method = "gene.model", gene.list = my.obj@gene.model)" change the gene.model to orig.ident (sorry , I use the seurat)? OR if not, how can I integrate the data to aviod the batch effect.

rezakj commented 3 years ago

Yes, you can replace my.obj@gene.model with orig.ident or any gene list. It is technically just a number of genes you want to use for this. It could be a list of top dispersed genes or top 1000-2000 expressed genes or combination of both or a set of genes you are interested in (eg. c(gene1,gene2,...)).

Midsummer723 commented 3 years ago

Thank you very much!