Skip to content

Commit

Permalink
add helper script for conversion to h5ad #1 and update README accordi…
Browse files Browse the repository at this point in the history
…ngly
  • Loading branch information
sreichl committed Nov 14, 2024
1 parent 743200a commit 78d9af4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ Beyond this the workflow was tested on multimodal scCRISPR-seq data sets with >3
- [Snakemake Workflow Catalog Entry](https://snakemake.github.io/snakemake-workflow-catalog?usage=epigen/scrnaseq_processing_seurat)

# 📚 Resources
- Helper scripts
- [Converting Parse Bioscience scRNA-seq data to (expected) 10x Genomics/MTX format](./helpers/parse_to_10x_conversion.R)
- [Converting Seurat object to scanpy compatible anndata object in `h5ad` format](./helpers/Seurat_to_h5ad_conversion.R)
- Data Resources for scRNA-seq data in compatible MTX format
- [10X Genomics Datasets](https://www.10xgenomics.com/datasets)
- [CELLxGENE](https://cellxgene.cziscience.com/)
Expand Down
19 changes: 19 additions & 0 deletions helpers/Seurat_to_h5ad_conversion.R
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)

0 comments on commit 78d9af4

Please sign in to comment.