Home

Awesome

<img src="/assets/logo.png" height="90">

GitHub license GitHub stars GitHub issues GitHub contributors DOI

IAMSAM (Image-based Analysis of Molecular signatures using the Segment-Anything Model) is a user-friendly web-based tool designed to analyze ST data. This repository contains the code and resources to utilize the functionalities of IAMSAM described in our paper.

Features

IAMSAM utilizes the Segment-Anything Model for H&E image segmentation, which allows for morphological guidance in selecting ROIs for users. IAMSAM offers users with two modes for running the SAM algorithm: everything-mode and prompt-mode.

After selecting ROIs, IAMSAM automatically performs downstream analysis including identification of differentially expressed genes, enrichment analysis, and cell type prediction within the selected regions.

Tutorial Video

Tutorial Video

You can try IAMSAM in our demo page. If you want to apply IAMSAM to your own data, please follow the instructions below.

Requirements

IAMSAM follows the dependency of Segment-anything, which means that it requires the installation of both PyTorch and TorchVision with CUDA support.

To use SAM, IAMSAM will download the ViT-H SAM model file (sam_vit_h_4b8939.pth) from here and then place it in the config folder.

Installation

This is the installation guide for the IAMSAM tool. Follow the steps below to install the tool:

git clone https://github.com/portrai-io/IAMSAM.git
conda create -n IAMSAM python=3.8
conda activate IAMSAM
pip install -r requirements.txt

Preprocess your data

We provide sample notebooks to preprocess Visium and Xenium data into h5ad format that can be effectively used in IAMSAM. You can choose any cell type deconvolution or mapping algorithm of your choice, but ensure that columns starting with the prefix 'celltype_' are added to .obs.

Usage

  1. Start the dash server using the following command:

    python app.py --port {port_to_use}
    
  2. Open your web browser and go to http://localhost:{port}.

  3. Place your ST data in data folder. Please refer to this guide

  4. Click the "Run SAM" button to do segmentation of H&E image.

  5. Click the "Run ST analysis" button to perform downstream analysis.

Demo Data

The data used in demo page.

Sample NameRepositoryDownload Link
Visium_FFPE_Human_Breast_Cancer10X Genomics DatasetLink
Visium_V1_Breast_Cancer_Block_A_section10X Genomics DatasetLink
Visium_Mouse_ColonGene Expression OmnibusGSM5213483
Xenium_V1_hColon_Cancer_Add_on_FFPE10X Genomics DatasetLink

These datasets were used to demonstrate the capabilities of IAMSAM in our paper. You can access and download the datasets using the provided links.

Citation

If you find IAMSAM helpful for your work, consider citing our paper

Contact

For any questions or inquiries, please contact us at contact@portrai.io.