seurat icon indicating copy to clipboard operation
seurat copied to clipboard

IntegrateData with merged seurat objects + SCTv2

Open greensii opened this issue 1 year ago • 3 comments

Hi, I have 8 samples - 5 are essentially biological replicates from one condition (control), 3 are bio reps from another (drought). I've run SCTv2 (using the seurat development version) on each of the 8 samples individually, then merged the 5 control samples into one seurat object, and merged the 3 drought samples into another.

Now I would like to integrate the two resulting seurat objects. However, the following code runs all the way through until the last step - IntegrateData.

VariableFeatures(sobj.ctrl[["SCT"]]) <- rownames(sobj.ctrl[["SCT"]]@scale.data)
VariableFeatures(sobj.drought[["SCT"]]) <- rownames(sobj.drought[["SCT"]]@scale.data) SOlist <- list( ctrl = RunPCA(sobj.ctrl,npcs = 30, verbose = FALSE), drought = RunPCA(sobj.drought,npcs = 30, verbose = FALSE) ) features <- SelectIntegrationFeatures(object.list = SOlist, nfeatures = 2000) SOlist <- PrepSCTIntegration(object.list = SOlist, anchor.features = features) anchors <- FindIntegrationAnchors(object.list = SOlist, normalization.method = "SCT", anchor.features = features) sobj <- IntegrateData(anchorset = anchors, normalization.method = "SCT")

Error message:

Integrating data

Error in model.list[[which(reference.model)]]: recursive indexing failed at level 2

Is this an issue with the fact that each seurat object i'm trying to integrate contains multiple SCT models?

greensii avatar Jul 12 '22 19:07 greensii

If I understand it correctly, you do not want to integrate the control and drought datasets - is that correct? For now I would recommend integrating all of them together. I need to check if I can reproduce this issue at our end. You can use the workflow in this vignette

saketkc avatar Jul 15 '22 19:07 saketkc

Hi Saket -- I think I am in similar situation. I think @greensii does want to integrate the control merged object (which he merged 5 different control replicates) with the drought merged object (which he merged 3 different dought replicates). You suggest it is better to simply integrate these 8 objects all together instead of first merging then integrating the 2 merged objects?

denvercal1234GitHub avatar Jul 17 '22 09:07 denvercal1234GitHub

If I understand it correctly, you do not want to integrate the control and drought datasets - is that correct? For now I would recommend integrating all of them together. I need to check if I can reproduce this issue at our end. You can use the workflow in this vignette

@denvercal1234GitHub is correct. i do want to integrate two seurat objects together, each of which consists of multiple merged replicate samples.

greensii avatar Jul 19 '22 15:07 greensii

In this case, you could merge => Run SCT => Integrate, assuming the sequencing depths are comparable across the merged samples. If that is not the case, you could caculate the minimum of the median UMI and pass it as the scale_factor argument to SCTransform(scale_factor=<min of median UMI>) so that the corrected counts are counted using the same sequencing depth across samples. Also, with scale_factor, the PrepSCTFindMarkers step is redundant.

saketkc avatar Aug 26 '22 17:08 saketkc