An open API service indexing awesome lists of open source software.

https://github.com/mvinyard/archr-h5ad

Parse ArchR arrow files to anndata h5ad
https://github.com/mvinyard/archr-h5ad

io r-to-python scatac-seq single-cell

Last synced: 4 months ago
JSON representation

Parse ArchR arrow files to anndata h5ad

Awesome Lists containing this project

README

          

# ArchR-h5ad

[![PyPI pyversions](https://img.shields.io/pypi/pyversions/ArchR-h5ad.svg)](https://pypi.python.org/pypi/ArchR-h5ad/)
[![PyPI version](https://badge.fury.io/py/ArchR-h5ad.svg)](https://badge.fury.io/py/ArchR-h5ad)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A lightweight python package to parse **[`.arrow`]()** files produced by [**ArchR**](https://www.archrproject.com) - to [**AnnData**](https://anndata.readthedocs.io/en/stable/).

## Installation

Install the last-released ([**`v0.0.12`**](https://pypi.org/project/ArchR-h5ad/0.0.12/)) distrubution from [PYPI](https://pypi.org/project/ArchR-h5ad/):

```BASH
pip install ArchR_h5ad
```

Alternatively, clone the repo to install the development version, locally:

```BASH
git clone https://github.com/mvinyard/ArchR-h5ad.git; cd ArchR_h5ad

pip install -e .
```

## A brief example

As an example, we will use the data from the ArchR [hematopoiesis tutorial](https://www.archrproject.com/articles/Articles/tutorial.html#creating-an-archrproject-1).

### Option 1. Directly read a `.arrow` file to adata
```python
import ArchR_h5ad

arrow_path = "/home/user/data/scATAC_CD34_BMMC_R1.arrow"

adata = ArchR_h5ad.read_arrow(arrow_path, use_matrix="GeneScoreMatrix")
```
adata-GeneScoreMatrix

Alternatively, one may use the **`"TileMatrix"`** generated by ArchR.

```python
adata = ArchR_h5ad.read_arrow(arrow_path, use_matrix="TileMatrix")
```
adata-TileMatrix

### Option 2. Instantiate the `Arrow` class.

```python
arrow = ArchR_h5ad.Arrow(arrow_path)
arrow.to_adata()
```
adata-GeneScoreMatrix-ArrowClass

```python
import numpy as np

np.array(arrow.__dir__())[
np.array([not i.startswith("__") for i in arrow.__dir__()])
].tolist()
```
adata-GeneScoreMatrix-ArrowClass-attributes