Skip to main content

Stimwrap: a Python interface for STIM

Project description

PyPI

stimwrap - a python interface for STIM

stimwrap is a Python wrapper for the spatial transcriptomics library STIM. It provides an interface for extracting datasets and their attributes from n5 containers that are created by STIM.

stimwrap is created and maintained by Nikos Karaiskos.

Installation

To install the stimwrap try:

pip install stimwrap

or if you do not have sudo rights:

pip install --user stimwrap

Check if the library is successfully installed:

import stimwrap as sw

If installation fails due to conflicting dependencies, create a dedicated environment with python=3.7 and try again to install stimwrap as above.

Usage

The following assumes that the file container.n5 contains the datasets and their attributes as created by STIM:

pucks = sw.get_container('/path/to/container.n5')

Print the names of the datasets:

print(sw.get_dataset_names(pucks))

Focus on a specific puck and extract the relevant information:

puck_name = sw.get_datset_names(pucks)[0]
puck = sw.get_datset(pucks, puck_name)

Get the puck locations either directly from the puck:

locations = puck['locations']

or fetch them from the container:

locations = sw.get_item_from_dataset(pucks, puck_name, item='locations')

Fetch gene expression

It is possible to get the expression vector of a single gene:

hpca_vec = sw.get_gene_expression_from_dataset(pucks, puck_name, gene='Hpca')

or the whole gene expression matrix:

dge = sw.get_gene_expression_from_dataset(pucks, puck_name, gene='all')

Fetch dataset attributes

STIM stores the dataset attributes in the n5 container. These can be directly accessed with stimwrap:

sw.get_attribute_from_dataset(pucks, puck_name, attribute='geneList')

Available options also include: barcodeList and metadataList.

Fetch aligned locations

In the case where multiple consecutive sections are obtained and aligned with STIM, the aligned locations can be obtained with:

aligned_locations = sw.get_aligned_locations(pucks, puck_name,
                                                 transformation='model_sift')

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

stimwrap-0.1.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

stimwrap-0.1.7-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file stimwrap-0.1.7.tar.gz.

File metadata

  • Download URL: stimwrap-0.1.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for stimwrap-0.1.7.tar.gz
Algorithm Hash digest
SHA256 d5d8953be466bf3f45fa70b5bd583699aaef696ee55638d6a896a44018ad08e7
MD5 c42170a8d61928dc7a365a7516ebbbff
BLAKE2b-256 b12aa0d5473b99e6660dc639458915af28c9eb2c2190a208122c123bdc43dc46

See more details on using hashes here.

File details

Details for the file stimwrap-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: stimwrap-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for stimwrap-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 42e92005789f26ec93b1e6f6b020e4c6148fe672b374af858735df8b15157b14
MD5 95a8e66b1d30e9126476ab43f7c06d75
BLAKE2b-256 13fd5df333bd2b13ce7252870060df5659a857ebd049fe85f7a4852c0ad81610

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