Closed KunFang93 closed 1 year ago
Hi @KunFang93, can you create a separate metadata column for the RNA and ATAC objects before mergin?
NTs.rna.seu$modality <- "RNA"
NTs.combined.seu$modality <- "ATAC"
NTs.coembed <- merge(x = NTs.rna.seu, y = NTs.combined.seu)
and then use this "modality" column in group.by
?
Thanks for your reply! I found the solution but forgot to update here. I thought the problem resulted from the name of the assay that NTs.imputation assigned to. The following codes works for me:
# SCT version Identify anchors
NTs.transfer.anchors.sct <- FindTransferAnchors(
reference = NTs.rna.seu,
query = NTs.combined.seu,
features = VariableFeatures(object = NTs.rna.seu),
reference.assay = "SCT", query.assay = "ACTIVITY",
reduction = 'cca',
normalization.method ='SCT'
)
NTs.rna.seu$celltype <- Idents(NTs.rna.seu)
NTs.predicted.labels.sct <- TransferData(
anchorset = NTs.transfer.anchors.sct,
refdata = NTs.rna.seu$celltype,
weight.reduction = NTs.combined.seu[['lsi']],
dims = 2:30
)
NTs.combined.seu <- AddMetaData(object = NTs.combined.seu, metadata = NTs.predicted.labels.sct)
# note that we restrict the imputation to variable genes from scRNA-seq, but could impute the
# full transcriptome if we wanted to
NTs.genes.use <- VariableFeatures(NTs.rna.seu)
NTs.refdata.sct <- LayerData(NTs.rna.seu, assay = "SCT", layer = "data")[NTs.genes.use, ]
# refdata (input) contains a scRNA-seq expression matrix for the scRNA-seq cells. imputation
# (output) will contain an imputed scRNA-seq matrix for each of the ATAC cells
NTs.imputation <- TransferData(anchorset = NTs.transfer.anchors.sct, refdata = NTs.refdata.sct,
weight.reduction = NTs.combined.seu[["lsi"]],
dims = 2:30)
NTs.combined.seu[["SCT"]] <- NTs.imputation
NTs.rna.seu <- RenameCells(object = NTs.rna.seu, add.cell.id = "RNA")
NTs.combined.seu <- RenameCells(object = NTs.combined.seu, add.cell.id = "ATAC")
NTs.combined.seu$celltype <- NTs.combined.seu$predicted.id
NTs.rna.seu$Libtype <- 'RNA'
NTs.combined.seu$Libtype <- 'ATAC'
NTs.coembed <- merge(x = NTs.rna.seu, y = NTs.combined.seu)
# Finally, we run PCA and UMAP on this combined object, to visualize the co-embedding of both
# datasets
NTs.coembed <- ScaleData(NTs.coembed, features = NTs.genes.use, do.scale = FALSE)
NTs.coembed <- RunPCA(NTs.coembed, features = NTs.genes.use, verbose = FALSE)
NTs.coembed <- RunUMAP(NTs.coembed, dims = 1:30)
DimPlot(NTs.coembed, group.by = c("Libtype","celltype"))
Hi,
I met a problem that Dimplot doesn't plot ATAC cells in the integration Seurat object. Here is my codes
And this the output plot![debug dimplot](https://github.com/satijalab/seurat/assets/15643651/5840ee12-f3dd-4721-8dc7-cc826b986c6d)
But there is 'ATAC' information in the orig.ident in metadata
And also when I tried to subset the ATAC cells, there is a error
I wondered how could I solve this problem? Thanks in advances!
Best, Kun