generated from mrvollger/SmkTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add helper script for conversion to h5ad #1 and update README accordi…
…ngly
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# adapted from: https://mojaveazure.github.io/seurat-disk/articles/convert-anndata.html | ||
|
||
# libraries | ||
library("Seurat") | ||
library("SeuratDisk") | ||
|
||
# configs | ||
object_path <- file.path("path/to/Seurat/object.rds") | ||
results_path <- file.path("result/path") | ||
dir.create(results_path, recursive = TRUE) | ||
|
||
# load seurat object | ||
data <- readRDS(file = file.path(object_path)) | ||
|
||
# save as h5Seurat | ||
SaveH5Seurat(data, filename = file.path(results_path,"object.h5Seurat"), overwrite = TRUE) | ||
|
||
# convert to anndata for scanpy (https://mojaveazure.github.io/seurat-disk/reference/Convert.html) | ||
Convert(file.path(results_path,"object.h5Seurat"), assay = "SCT", dest = "h5ad", overwrite = TRUE) |