Skip to content

Commit

Permalink
Working draft vignette.
Browse files Browse the repository at this point in the history
  • Loading branch information
LouiseDck committed Sep 18, 2023
1 parent e3b1d4d commit 891e350
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions vignettes/getting-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,57 @@ This package provides an abstract interface for AnnData objects. This abstract i


This abstract interface is implemented by different backends. Currently, the following backends are implemented:

1. InMemoryAnnData

2. HDF5AnnData

The InMemoryAnnData backend allows you to construct an AnnData object in memory.
The HDF5AnnData backend allows you to read in an AnnData object from an `.h5ad` file.

Here is an example of how to read in an `.h5ad` file and access its contents.

```{r setup}
```{r setup, eval=FALSE}
library(anndataR)
file <- system.file("extdata", "example.h5ad", package = "anndataR")
adata <- read_h5ad(file, to = "InMemoryAnnData")
X <- adata$X
layers <- adata$layers
obs <- adata$obs
obsm <- adata$obsm
obsp <- adata$obsp
# obsm <- adata$obsm

Check warning on line 43 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=43,col=3,[commented_code_linter] Commented code should be removed.
# obsp <- adata$obsp

Check warning on line 44 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=44,col=3,[commented_code_linter] Commented code should be removed.
var <- adata$var
# varm <- adata$varm

Check warning on line 46 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=46,col=3,[commented_code_linter] Commented code should be removed.
# varp <- adata$varp

Check warning on line 47 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=47,col=3,[commented_code_linter] Commented code should be removed.
# uns <- adata$uns

Check warning on line 48 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=48,col=3,[commented_code_linter] Commented code should be removed.
```

The following example details how to make an InMemoryAnnData and access its contents.

```{r inmemory}
library(anndataR)
adata <- AnnData(
X = matrix(1:15, 3L, 5L),

Check warning on line 57 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=57,col=1,[indentation_linter] Indentation should be 2 spaces but is 1 spaces.
layers = list(
A = matrix(5:1, 3L, 5L),
B = matrix(letters[1:5], 3L, 5L)
),
obs = data.frame(cell = 1:3),
var = data.frame(gene = 1:5),
obs_names = LETTERS[1:3],
var_names = letters[1:5]
)
X <- adata$X
layers <- adata$layers
obs <- adata$obs
# obsm <- adata$obsm

Check warning on line 71 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=71,col=3,[commented_code_linter] Commented code should be removed.
# obsp <- adata$obsp

Check warning on line 72 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=72,col=3,[commented_code_linter] Commented code should be removed.
var <- adata$var
varm <- adata$varm
varp <- adata$varp
uns <- adata$uns
# varm <- adata$varm

Check warning on line 74 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=74,col=3,[commented_code_linter] Commented code should be removed.
# varp <- adata$varp

Check warning on line 75 in vignettes/getting-started.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=vignettes/getting-started.Rmd,line=75,col=3,[commented_code_linter] Commented code should be removed.
# uns <- adata$uns
```

You can convert the AnnData object to a SingleCellExperiment object or to a SeuratObject in the following way:
Expand Down

0 comments on commit 891e350

Please sign in to comment.