https://github.com/cellgeni/schard
reticulate-free single cell format conversion
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.2%) to scientific vocabulary
Repository
reticulate-free single cell format conversion
Basic Info
- Host: GitHub
- Owner: cellgeni
- License: gpl-3.0
- Language: R
- Default Branch: main
- Size: 51.8 KB
Statistics
- Stars: 80
- Watchers: 4
- Forks: 4
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
schard
This package allows one to load scanpy h5ad into R as list, SingleCellExperiment or Seurat object. For now it only loads X, obs, var, obsm (as reduced dimensions) if requested and images for visium data.
The package is based on rhdf5 for h5ad manipulation and is pure R (that is reticulate-free).
Installation
schard can be installed from github
R
devtools::install_github("cellgeni/schard")
Usage
Download some public h5ads from CZI cellxgene or one of Sanger atlases and load them to R: ```R download.file('https://datasets.cellxgene.cziscience.com/c5ac5c36-f60c-4680-8018-2d6cb65c0a37.h5ad','vis.heart.h5ad') download.file('https://datasets.cellxgene.cziscience.com/8cc521c8-c4ff-4cba-a07b-cae67a9dcba9.h5ad','sn.heart.h5ad') download.file('https://covid19.cog.sanger.ac.uk/baron16.processed.h5ad','ba16.h5ad')
load h5ad as Single Cell Experiment
ba16.sce = schard::h5ad2sce('ba16.h5ad')
load h5ad as Seurat
snhx = schard::h5ad2seurat('sn.heart.h5ad')
load all visium samples as single Seurat object
visx = schard::h5ad2seurat_spatial('vis.heart.h5ad')
or load as list of Seurat objects (per slide
visl = schard::h5ad2seurat_spatial('vis.heart.h5ad',simplify = FALSE)
or load raw counts
snhr = schard::h5ad2seurat('sn.heart.h5ad',use.raw = TRUE)
raw counts for visium
visr = schard::h5ad2seurat_spatial('vis.heart.h5ad',use.raw = TRUE)
check that it works
Seurat::SpatialPlot(visx,features = 'totalcounts') Seurat::SpatialPlot(visx,features = 'totalcounts',images = 'HCAHeartST11702009') Seurat::SpatialPlot(visl$HCAHeartST11702010,features = 'totalcounts') plot(colSums(visx),colSums(visr),pch=16) # raw counts are different from normolized ones Seurat::DimPlot(snhx,group.by = 'cellstate') # the name of reduction is 'Xumap' (autotranslated from scanpy to Seurat), somehow DimPlot manages to find it, but probably safier to specify it manually with reduction = 'Xumap' ```
There is no need to load whole object if you only need cell metadata: ```R obs = schard::h5ad2data.frame('sn.heart.h5ad','obs')
one can load umap in the same way.
not sure about the name? lets see into h5ad:
ls = rhdf5::h5ls('sn.heart.h5ad') ls[ls$group=='/obsm',] # so we have 'Xumap' here umap = t(schard::h5ad2Matrix('sn.heart.h5ad','/obsm/Xumap')) # I like it more transposed plot(umap[,1:2],pch=16,cex=0.4,col=factor(obs$cell_state)) ```
Alternatives
There are two known alternatives: 1. sceasy uses reticulate and thus depends on python environment. Proved to be unstable and hard to use. 2. SeuratDisk also uses rhdf5, but uses h5-based Seurat format as an intermediate that looks like overcomplication. Additionally, SeuratDisk seems to be almost not supported and it fails even on examples from its own tutorial.
Despite all problems of both packages above they have clear advantage over schard: they allow not only to read h5ad into R but also to write it.
Owner
- Name: Cellular Genetics Informatics
- Login: cellgeni
- Kind: organization
- Location: United Kingdom
- Website: https://www.sanger.ac.uk/science/groups/cellular-genetics-informatics
- Repositories: 19
- Profile: https://github.com/cellgeni
Wellcome Sanger Institute
GitHub Events
Total
- Issues event: 11
- Watch event: 86
- Issue comment event: 12
- Push event: 3
- Pull request event: 3
- Fork event: 8
- Create event: 1
Last Year
- Issues event: 11
- Watch event: 86
- Issue comment event: 12
- Push event: 3
- Pull request event: 3
- Fork event: 8
- Create event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 6
- Total pull requests: 1
- Average time to close issues: 4 months
- Average time to close pull requests: 18 days
- Total issue authors: 6
- Total pull request authors: 1
- Average comments per issue: 1.5
- Average comments per pull request: 4.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 6
- Pull requests: 1
- Average time to close issues: 4 months
- Average time to close pull requests: 18 days
- Issue authors: 6
- Pull request authors: 1
- Average comments per issue: 1.5
- Average comments per pull request: 4.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- shanggutianzhen (1)
- bijingnibaba (1)
- derrik-gratz (1)
- Flu09 (1)
- seekning (1)
- cystone (1)
- honghh2018 (1)
- huiyijiangling (1)
- Li-ZhiD (1)
- cosmiccapybara (1)
Pull Request Authors
- derrik-gratz (1)
- prete (1)
- jackchenry (1)
- slzhao (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- Matrix * imports
- Seurat * imports
- SingleCellExperiment * imports
- rhdf5 * imports
- rocker/r-base 4.3.1 build