Skip to main content

a collection of utilities for spatial-omics analysis

Project description

spatial-utils

a collection of utilities to support analysis with squidpy.

installation

easy installation

You can use our environment.yaml file to create an anaconda environment with spatial-utils, squidpy, and all other dependencies. To do so, first download the environment.yaml file from this repo. Then, open a terminal, navigate to the directory you have downloaded the environment.yaml file to and run the following command

conda env create -f environment.yaml

This creates an environment called spatial-analysis. If you would like to use the environment, you can activate the environment with the following:

conda activate spatial-analysis

development installation

Create an environment for working on your squidpy projects. If you are using anaconda, you can enter the following in your terminal:

conda create -n squidpy python=3.8

Activate your newly created squidpy environment. For anaconda you can enter:

conda activate squidpy

Navigate to the directory you would like to download the squidpy-utils to. For example, if you want to clone the repository to your Documents folder, you would enter:

cd ~/Documents

Clone the squidpy-utils repository

git clone https://github.com/kevinyamauchi/spatial-utils.git

Navigate to the spatial-utils directory

cd spatial-utils

Install spatial-utiils. If you would like to be able to add/edit functionality, install in editable mode:

pip install -e .

Otherwise, perform a standard installation:

pip install .

Usage

Loading a visium dataset

You can load a dataset that was processed with Kallisto into an AnnData object using the load_visium_kallisto function:

from spatial_utils import load_visium_kallisto

adata = load_visium_kallisto(
    counts_table,
    gene_names,
    barcodes,
    tissue_positions_list,
    scale_factors,
    hires_im,
    lowres_im,
    library_id,
    chemistry_name
)

The input arguments are explained below. To see an example of the function being used, please see the notebook at /examples/load_visium_from_kallisto.ipynb

Parameters
----------
counts_table : str
        The path to the counts table output from Kallisto.
        This file usually has the extension ".mtx".
gene_names : str
    The path to the file containing the gene names for the
    Kallisto counts table. This file usually ends with "genes.txt".
barcodes : str
    The path to the file containing the spot barcodes for the
    Kallisto counts table. This file usually ends with "barcodes.txt".
tissue_positions_list : str
    The path to the file containing the coordinates of each barcode
    that is output from the 10X space ranger pipeline.
    This file is usually called: "tissue_positions_list.csv".
scale_factors : str
    The path to the file output by the 10X space ranger pipeline
    containing the scale factors that map the hires and
    lowres image to the original image.
    This file is usually called: "scalefactors_json.json"
hires_im : str
    The path to the hires image that is output from the
    10X space ranger pipeline.
    This file is usually called: tissue_hires_image.png
lowres_im : str
    The path to the lowres image that is output from the
    10X space ranger pipeline.
    This file is usually called: tissue_lowres_image.png
library_id  : str
    The unique identifier for the library that was sequenced.
chemistry_name : str
    The name of the chemistry used to create the library.
    The default value is: "Spatial 3' v1"

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

spatial_utils-0.0.1.tar.gz (1.7 MB view hashes)

Uploaded Source

Built Distribution

spatial_utils-0.0.1-py3-none-any.whl (6.6 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