Skip to main content

Project generated with PyScaffold PyPI-Server Unit tests

SummarizedExperiment

This package provides containers to represent genomic experimental data as 2-dimensional matrices, follows Bioconductor's SummarizedExperiment. In these matrices, the rows typically denote features or genomic regions of interest, while columns represent samples or cells.

The package currently includes representations for both SummarizedExperiment and RangedSummarizedExperiment. A distinction lies in the fact RangedSummarizedExperiment object provides an additional slot to store genomic regions for each feature and is expected to be GenomicRanges (more here).

Install

To get started, Install the package from PyPI,

pip install summarizedexperiment

Usage

A SummarizedExperiment contains three key attributes,

  • assays: A dictionary of matrices with assay names as keys, e.g. counts, logcounts etc.
  • row_data: Feature information e.g. genes, transcripts, exons, etc.
  • column_data: Sample information about the columns of the matrices.

First lets mock feature and sample data:

from random import random
import pandas as pd
import numpy as np
from biocframe import BiocFrame

nrows = 200
ncols = 6
counts = np.random.rand(nrows, ncols)
row_data = BiocFrame(
    {
        "seqnames": [
            "chr1",
            "chr2",
            "chr2",
            "chr2",
            "chr1",
            "chr1",
            "chr3",
            "chr3",
            "chr3",
            "chr3",
        ]
        * 20,
        "starts": range(100, 300),
        "ends": range(110, 310),
        "strand": ["-", "+", "+", "*", "*", "+", "+", "+", "-", "-"] * 20,
        "score": range(0, 200),
        "GC": [random() for _ in range(10)] * 20,
    }
)

col_data = pd.DataFrame(
    {
        "treatment": ["ChIP", "Input"] * 3,
    }
)

To create a SummarizedExperiment,

from summarizedexperiment import SummarizedExperiment

tse = SummarizedExperiment(
    assays={"counts": counts}, row_data=row_data, column_data=col_data,
    metadata={"seq_platform": "Illumina NovaSeq 6000"},
)
## output
class: SummarizedExperiment
dimensions: (200, 6)
assays(1): ['counts']
row_data columns(6): ['seqnames', 'starts', 'ends', 'strand', 'score', 'GC']
row_names(0):
column_data columns(1): ['treatment']
column_names(0):
metadata(1): seq_platform

To create a RangedSummarizedExperiment

from summarizedexperiment import RangedSummarizedExperiment
from genomicranges import GenomicRanges

trse = RangedSummarizedExperiment(
    assays={"counts": counts}, row_data=row_data,
    row_ranges=GenomicRanges.from_pandas(row_data.to_pandas()), column_data=col_data
)
## output
class: RangedSummarizedExperiment
dimensions: (200, 6)
assays(1): ['counts']
row_data columns(6): ['seqnames', 'starts', 'ends', 'strand', 'score', 'GC']
row_names(0):
column_data columns(1): ['treatment']
column_names(0):
metadata(0):

For more examples, checkout the documentation.

Note

This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.

Download files

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

Source Distribution

summarizedexperiment-0.7.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

summarizedexperiment-0.7.0-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file summarizedexperiment-0.7.0.tar.gz.

File metadata

  • Download URL: summarizedexperiment-0.7.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for summarizedexperiment-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d0c0f4cf433000b9506811eea5ebb150e9d63847fac05a907f22dc2b1ee9f78c
MD5 f57777b89005fa9ef1cf95dc99622f93
BLAKE2b-256 2098b1b7782d1ad55ff56d083e57184079daa80ea513f29d5f5f7b471e6fecd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for summarizedexperiment-0.7.0.tar.gz:

Publisher: publish-pypi.yml on BiocPy/SummarizedExperiment

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file summarizedexperiment-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for summarizedexperiment-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42243ea88af41958d6ecc6c9d0e501f9744a42db0ce6e7565da4ad66e1c5addb
MD5 ae44ce757b3af0e5757f62d425905a77
BLAKE2b-256 240b0bd38298b0d7271977753628ca385c0a2b1d39ae31e3be9366d6153f52c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for summarizedexperiment-0.7.0-py3-none-any.whl:

Publisher: publish-pypi.yml on BiocPy/SummarizedExperiment

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page