-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh5ad_to_rds.r
27 lines (19 loc) · 1018 Bytes
/
h5ad_to_rds.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
options(repos = c(CRAN = "https://cran.rstudio.com/"))
#install.packages("remotes")
#remotes::install_github("PMBio/MuDataSeurat")
library("Seurat")
library('MuDataSeurat')
h5ad <- ReadH5AD("/work/rwth1209/dana_projects/R/scDesign3/our_data_MERFISH/MERFISH_kidney_object.h5ad")
# step 1: Slim down a Seurat object. So you get raw counts, lognorm counts
# seu = DietSeurat(
# h5ad,
# counts = TRUE, # so, raw counts save to adata.layers['counts']
# data = TRUE, # so, log1p counts save to adata.X when scale.data = False, else adata.layers['data']
# scale.data = FALSE, # if only scaled highly variable gene, the export to h5ad would fail. set to false
# features = rownames(h5ad), # export all genes, not just top highly variable genes
# assays = "RNA",
# dimreducs = c("pca","umap"),
# #graphs = c("RNA_nn", "RNA_snn"), # to RNA_nn -> distances, RNA_snn -> connectivities
# misc = TRUE
# )
saveRDS(h5ad, "/work/rwth1209/dana_projects/R/scDesign3/our_data_MERFISH/MERFISH_kidney_object.rds")