Closed RenhaoL closed 2 weeks ago
Try seurat v5. It worked for me.
You can download the data and create a Seurat object. Read the documentation of the stxBrain
function, which contains the code. For example, to use posterior1:
# Load the expression data
expr.url <- 'http://cf.10xgenomics.com/samples/spatial-exp/1.0.0/V1_Mouse_Brain_Sagittal_Posterior/V1_Mouse_Brain_Sagittal_Posterior_filtered_feature_bc_matrix.h5'
curl::curl_download(url = expr.url, destfile = basename(path = expr.url))
expr.data <- Seurat::Read10X_h5(filename = basename(path = expr.url))
posterior1 <- Seurat::CreateSeuratObject(counts = expr.data, project = 'posterior1', assay = 'Spatial')
posterior1$slice <- 1
posterior1$region <- 'posterior'
# Load the image data
img.url <- 'http://cf.10xgenomics.com/samples/spatial-exp/1.0.0/V1_Mouse_Brain_Sagittal_Posterior/V1_Mouse_Brain_Sagittal_Posterior_spatial.tar.gz'
curl::curl_download(url = img.url, destfile = basename(path = img.url))
untar(tarfile = basename(path = img.url))
img <- Seurat::Read10X_Image(image.dir = 'spatial')
Seurat::DefaultAssay(object = img) <- 'Spatial'
img <- img[colnames(x = posterior1)]
posterior1[['posterior1']] <- img
# Clean up downloaded files
unlink(x = c(basename(path = c(expr.url, img.url)), 'spatial'), recursive = TRUE)
It works for me no matter seurat v4 or v5.
Both method works for me. Seurat 5.1.0 worked if you used the first method. Thank you guys!!
Hi all, I am trying to follow the 10X Visium tutorial, and when I load the data from SeuratData, the
brain <- LoadData("stxBrain", type = "posterior1")
generated error:I am using
stxBrain.SeuratData_0.1.2
andSeuratData_0.2.2.9001
. Any suggestions on how to fix this? I think this is a version issue. Maybe the dataset got updated recently?Thanks in advance.