Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Bioconductor vignette standards #112

Merged
merged 6 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
```