Hi all,
I did integration and batch correction using scVI in python, UMAP didn't look great for batches so I used Harmony in R and integration came out well, by looking at umap in R and using scIB matrics. but then I exported harmony integrated object in Python for clustering and annotation where UMAP look horrible again, as all batches clustered separately and randomly. this is how I ran and saved my harmony object
seurat_obj_hvg_harmony <- RunHarmony(
object = seurat_obj_hvg,
group.by.vars = c("Batch")
)
seurat_obj_hvg_harmony <- RunUMAP(seurat_obj_hvg_harmony, reduction = "harmony", dims = 1:30)
DimPlot(seurat_obj_hvg_harmony, reduction = "umap", group.by = "Batch", pt.size = 0.5)
# Convert Seurat to SCE
sce <- as.SingleCellExperiment(seurat_obj_hvg_harmony)
# Save Seurat object as H5AD
writeH5AD(sce, "seurat_obj_harmony.h5ad")
and this is my Python script I am using to import Harmony object.
adata = sc.read_h5ad(data_dir + "seurat_obj_harmony.h5ad")
adata.obsm["X_UMAP"] = adata.obsm["X_UMAP"].to_numpy()
adata.obsm["HARMONY"] = adata.obsm["HARMONY"].to_numpy()
adata.obsm["UMAP"] = adata.obsm["UMAP"].to_numpy()
if 'UMAP' in adata.obsm:
adata.obsm['X_umap'] = adata.obsm['UMAP']
# Plot using precomputed UMAP
sc.pl.umap(adata, color='Batch')
I even tried to plot using X_UMAP too instead of UMAP. Am i making mistake in exporting or my data is not integrated and batch corrected at all? although scIB matrics shows otherwise.
First Umap is from python and second is from R
Many thanks
Use this tutorial for how to upload images: How to add images to a Biostars post
Only difference is instead of using an external image hosting provider focus on the icon highlighted by a box in second image. After clicking that icon, you can directly navigate to a copy of the image file on your local machine and upload (using
From Your Computer
).