Skip to main content

matrix market tar archive access utilities

Project description

ci-test

Introduction

mex_gene_archive is a minimal file format designed to meet the needs of archiving sparse gene matrices in a format compatible with the ENCODE 4 Data Coordination Center.

We had the requirement that a data type result needed to be a single file and unfortunately the common output format for alignment programs of the matrix market exchange use three files. One to store the coordinates and values of the non-zero sparse matrix elements, one for the row labels, and one for the column labels.

Usage

Reading an archive

The archive format is fairly simple and started with just archiving the key matrix market files from a STAR Solo.out directory, with a simple manifest.tsv file included to help tell different files apart.

Probably the more useful function is the one that will read an archive into an anndata structure with the gene features going across the columns and the cell barcode observations going down across the rows.

from mex_gene_archive.reader import read_mex_archive_as_anndata

adata = read_mex_archive_as_anndata("archive.tar.gz")

req = requests.get(
    "https://www.encodeproject.org/files/ENCFFexample/@@download/ENCFFexample.fastq.gz",
    stream=True)
adata = read_mex_archive_as_anndata(fileobj=req.raw)

The reader module can also convert archives to anndata directly from the command line

python -m mex_gene_archive.reader -o archive.h5ad archive.tar.gz

python -m mex_gene_archive.reader -o archive.h5ad \
  --url https://www.encodeproject.org/files/ENCFFexample/@@download/ENCFFexample.fastq.gz

Generating an STAR archive

Possibly you might want to generate an archive file currently only STAR is directly supported. See archive_star_solo for the full list of arguments.

from mex_gene_archive.starsolo import archive_star_solo

config = {
   "experiment_accession": "ENCSR724KET",
   "description": "snRNA on human adrenal gland.",
   "library_accession": "ENCLB002DZK",
}
archive_star_solo("experiment", config)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mex_gene_archive-0.2.3.tar.gz (28.3 kB view hashes)

Uploaded Source

Built Distribution

mex_gene_archive-0.2.3-py3-none-any.whl (29.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page