Skip to main content

Histomic Atlases of Variation Of Cancers (HAVOC) is a versatile tool that helps map histomic heterogeneity across H&E-stained digital slide images to help guide regional deployment of molecular resources to the most relevant/biodiverse tumor niches

Project description

Histomic Atlases of Variation Of Cancers (HAVOC)

HAVOC is a versatile tool that maps histomic heterogeneity across H&E-stained digital slide images to help guide regional deployment of molecular resources to the most relevant/biodiverse tumor niches

Cloud usage

Explore HAVOC on https://www.codido.co to run on the cloud

Version Notes

  • Current: Uses a foundation-model feature extractor (Prov-GigaPath) with 2x2 grid pooling to allow tiles larger than 256x256 (20x). This is recommended for all new applications.

  • Legacy: VGG19-based implementation used in the original paper. Please visit the paper branch for more info (No longer updated).

Installation

Note: HAVOC requires the torch, torchvision, and timm packages, which are not installed automatically. Please install the appropriate PyTorch build (CPU or GPU) before installing HAVOC.

Note: System-level OpenSlide must be installed manually from: https://openslide.org/download/

Use the package manager pip to install havoc-clustering.

pip install havoc-clustering-v2

Usage

from huggingface_hub import login
from havoc_clustering_v2.havoc import HAVOC, HAVOCConfig
from havoc_clustering_v2.general_utility.slide import Slide

# Required to perform initial download of the feature extractor (prov-gigapath) from Huggingface.
login(token=hf_token)

# To run HAVOC, it requires:
# 1. a Slide object
s = Slide(slide_path)

# 2. a HAVOCConfig object
# Below are the default config values
config = HAVOCConfig(
    out_dir='./', # root save dir. results will be stored per slide in `root_save_dir`\<slide_name>\`
    k_vals=[7, 8, 9],
    # save the tiles belonging to each color cluster within the havoc map for a given k
    # ie [7,9] would save the colored tiles belonging to k=7 and k=9
    # NOTE: this should be a subset of k_vals
    save_tiles_k_vals=[], 

    tile_size=512, # at 20x magnification. minimum tile size of 256 required

    min_tissue_amt=0.5, # blank filtering
    
    # for each k value, make a tsne and/or dendrogram and/or pearson coefficient clustermap
    extra_metrics=['tsne', 'dendrogram', 'corr_clustmap']
)
    

havoc = HAVOC(config)
havoc.run(s)

Result output

  • Colortiled maps
  • CSV file of cluster info + DLFVs (cluster_info_df.csv)
  • Optionally:
    • Original slide thumbnail
    • TSNEs
    • Dendrograms
    • Correlation clustermap

Multi-slide correlation map

By running HAVOC on multiple slides, you may want to combine all the generated correlation clustermaps into a mega clustermap.

  1. Create a folder containing each slide's cluster_info_df.csv file
from havoc_clustering_v2.correlation_of_dlfv_groups import create_correlation_clustermap_multi_slide

create_correlation_clustermap_multi_slide(folder_of_csvs, target_k=9)

NOTE: the target_k should be a k-value you ran HAVOC with

Citation

Please refer to the paper "HAVOC: Small-scale histomic mapping of cancer biodiversity across large tissue distances using deep neural networks" (DOI: 10.1126/sciadv.adg1894)

License

GNU General Public License v3 (GPLv3)

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

havoc_clustering_v2-0.0.6.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

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

havoc_clustering_v2-0.0.6-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file havoc_clustering_v2-0.0.6.tar.gz.

File metadata

  • Download URL: havoc_clustering_v2-0.0.6.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for havoc_clustering_v2-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a02ac1ef62982daf7ee42dc16b529f68ea8808d44d6527d4339c1b2baa2b8533
MD5 096c9267dacc599834a1fa2e99f6fa99
BLAKE2b-256 09e4d1cd4e63af009810bcdb5f248c2b267e804f514c8c4458a3d58b26519357

See more details on using hashes here.

File details

Details for the file havoc_clustering_v2-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for havoc_clustering_v2-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 92d1a1d440e98aa7e9c1e5e43a8236923d1752b7c8762d9e30ac4711681987f1
MD5 b4dde5135c23e6a9ee644495e3c93081
BLAKE2b-256 0c01ca1b8840ef468eadbd5d57a6f100c7145b392435a5011ffec44b8a63d9cb

See more details on using hashes here.

Supported by

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