Container to represent data from genomic experiments
Project description
SummarizedExperiment
Container to represent genomic experiments, follows Bioconductor's SummarizedExperiment.
Install
Package is published to PyPI,
pip install summarizedexperiment
Usage
Currently supports SummarizedExperiment
& RangedSummarizedExperiment
classes
First create necessary 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/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for SummarizedExperiment-0.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 633bf8f9df82dd02e76c66bbd53c91f37ff6526f6a216fc41f88540efee0f8ff |
|
MD5 | 2cd86f9e6559c018c29001fd2d12bc61 |
|
BLAKE2b-256 | 23d5047a222522f8d3bdfb7e9390ce1236346c027a914e91994b0e07e29c3740 |
Close
Hashes for SummarizedExperiment-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf070a1721533f9e7b76fbfcff5620df2f7386caa218e108e52982ec85ac988e |
|
MD5 | 992184812f12bd6461e9398724167b14 |
|
BLAKE2b-256 | d82e58f8b87e3daa5ff80bb793531c445c8294f39055aa20fad40ae0edb1e03e |