mvinyard / ArchR-h5ad

Parse ArchR arrow files to anndata h5ad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArchR-h5ad

PyPI pyversions PyPI version Code style: black

A lightweight python package to parse .arrow files produced by ArchR - to AnnData.

Installation

Install the last-released (v0.0.12) distrubution from PYPI:

pip install ArchR_h5ad

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

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.

Option 1. Directly read a .arrow file to adata

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.

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

adata-TileMatrix

Option 2. Instantiate the Arrow class.

arrow = ArchR_h5ad.Arrow(arrow_path)
arrow.to_adata()

adata-GeneScoreMatrix-ArrowClass

import numpy as np

np.array(arrow.__dir__())[
    np.array([not i.startswith("__") for i in arrow.__dir__()])
].tolist()

adata-GeneScoreMatrix-ArrowClass-attributes

About

Parse ArchR arrow files to anndata h5ad

License:MIT License


Languages

Language:Python 100.0%