Skip to content

Commit

Permalink
Use Bioconductor vignette standards (#112)
Browse files Browse the repository at this point in the history
* Use Bioconductor vignette standards

* Fix DESCRIPTION

* Linting indentation typo

* Run styler and fix lintr issues

* Apply suggestions from code review

Co-authored-by: Robrecht Cannoodt <[email protected]>

---------

Co-authored-by: Robrecht Cannoodt <[email protected]>
  • Loading branch information
LouiseDck and rcannood authored Sep 19, 2023
1 parent 2aa08da commit bffaf33
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Imports:
R6
Suggests:
anndata,
BiocStyle,
knitr,
reticulate,
rhdf5,
Expand Down
2 changes: 1 addition & 1 deletion R/write_h5ad.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' ncells <- 100
#' counts <- matrix(rpois(20000, 5), ncol = ncells)
#' logcounts <- log2(counts + 1)
#' #
#'
#' pca <- matrix(runif(ncells * 5), ncells)
#' tsne <- matrix(rnorm(ncells * 2), ncells)
#'
Expand Down
2 changes: 1 addition & 1 deletion man/write_h5ad.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 34 additions & 3 deletions vignettes/getting-started.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
---
title: "Getting Started"
output: rmarkdown::html_vignette
title: "Using anndataR to read and convert"
shorttitle: "Using anndataR"
author:
- name: Robrecht Cannoodt
- name: Luke Zappia
- name: Martin Morgan
- name: Louise Deconinck
package: anndataR
output: BiocStyle::html_document
vignette: >
%\VignetteIndexEntry{Getting Started}
%\VignetteIndexEntry{Using anndataR to read and convert}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand All @@ -14,10 +21,24 @@ knitr::opts_chunk$set(
)
```

# Introduction

This package allows users to work with `.h5ad` files, access various slots in the datasets and convert these files to `SingleCellExperiment` objects and `SeuratObject`s, and vice versa.

Check out `?anndataR` for a full list of the functions provided by this package.

# Installation

Install using:
```{r, eval = FALSE}
if (!require("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("anndataR")
```

# Usage

This package provides an abstract interface for `AnnData` objects. This abstract interface models its Python counterpart closely, and stores a data matrix `X` and annotations corresponding to observations (`obs`, `obsm`, `obsp`) and variables (`var`, `varm`, `varp`) and unstructured metadata `uns`.


Expand All @@ -30,6 +51,8 @@ This abstract interface is implemented by different backends. Currently, the fol
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.

## `HDF5AnnData` backend

Here is an example of how to read in an `.h5ad` file.

```{r setup}
Expand All @@ -49,6 +72,8 @@ obs <- adata$obs
var <- adata$var
```

## `InMemoryAnnData` backend

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

```{r inmemory_construct}
Expand Down Expand Up @@ -81,3 +106,9 @@ sce <- to_SingleCellExperiment(adata)
seurat <- to_Seurat(adata)
```

# Session info

```{r}
sessionInfo()
```

0 comments on commit bffaf33

Please sign in to comment.