Skip to main content

Save and load multi-assay experiments in the dolomite framework!

Project description

Project generated with PyScaffold PyPI-Server Unit tests

Save and load MultiAssayExperiments in Python

Introduction

The dolomite-mae package is the Python counterpart to the alabaster.mae R package, providing methods for saving/reading MultiAssayExperiment objects within the dolomite framework. All components of the MultiAssayExperiment - column_data, sample map and experiments - are saved to their respective file representations, which can be loaded in a new R/Python environment for cross-language analyses.

Quick start

Let's mock up a MultiAssayExperiment:

from multiassayexperiment import MultiAssayExperiment
from singlecellexperiment import SingleCellExperiment
from summarizedexperiment import SummarizedExperiment
import biocframe
import numpy

x = numpy.random.rand(1000, 200)
x2 = (numpy.random.rand(1000, 200) * 10).astype(numpy.int32)

sce = SingleCellExperiment(
     {"logcounts": x, "counts": x2},
     main_experiment_name="aaron's secret modality",
     row_data=biocframe.BiocFrame(
          {"foo": numpy.random.rand(1000), "bar": numpy.random.rand(1000)},
          row_names=["gene_sce_" + str(i) for i in range(1000)],
     ),
     column_data=biocframe.BiocFrame(
          {"whee": numpy.random.rand(200), "stuff": numpy.random.rand(200)},
          row_names=["cell_sce" + str(i) for i in range(200)],
     ),
)

se = SummarizedExperiment(
     {"counts": numpy.random.rand(100, 200)},
     row_data=biocframe.BiocFrame(
          {"foo": numpy.random.rand(100), "bar": numpy.random.rand(100)},
          row_names=["gene_se_" + str(i) for i in range(100)],
     ),
     column_data=biocframe.BiocFrame(
          {"whee": numpy.random.rand(200), "stuff": numpy.random.rand(200)},
          row_names=["cell_se" + str(i) for i in range(200)],
     ),
)

mae = MultiAssayExperiment(experiments={"jay_expt": sce, "aarons_expt": se})

Now we can save it:

from dolomite_base import save_object
import dolomite_se
import os
from tempfile import mkdtemp

path = os.path.join(mkdtemp(), "test")
save_object(se, path)

And load it again, e,g., in a new session:

from dolomite_base import read_object

roundtrip = read_object(path)

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

dolomite-mae-0.1.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

dolomite_mae-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file dolomite-mae-0.1.0.tar.gz.

File metadata

  • Download URL: dolomite-mae-0.1.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for dolomite-mae-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a34691d6836715ca330e4510a639ee7fcbc9babc528fadd5f6ea88fbe9527e85
MD5 e422ac6a562707213dcb979fbb97dd9d
BLAKE2b-256 34f64c9a8cc85c7149ad7210849749a60dd21189e8ac04b7d02ba18d713c0d56

See more details on using hashes here.

File details

Details for the file dolomite_mae-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dolomite_mae-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a6231f180e7d191e31d23d731b22677fa6e969fa31363d2271c13cb62180e7d
MD5 6d6da53bf97090a9c7fffcb0d80fd3a9
BLAKE2b-256 aec1112d2f07285e1dd0c26178649fd56cc8761aecc581c1016d189664dc4e17

See more details on using hashes here.

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