Skip to main content

MergeSegmentations

Repository overview

This repository contains the file and scripts that support the study titled "Efficient integration and validation of deep learning-based nuclei segmentations in H&E slides from multiple models"

  1. Merging segmentations
  2. Recreating Figures in manuscript
  3. Linear mixed models for assessing variance explained in bulk-RNA gene expression data
  4. Pathway analysis for genes explained by high variance

All the data and files required to run the scripts are located in the data directory.

The study overview is illustrated here:

Study overview

Merging segmentations using our package

Usage:

pip install cellmerge==0.1.0
cellmerge -m <method1_predictions> -p <method2_predictions> -o outdir

Sample files for the -m and -p options are in the data directory under monusac and pannuke sub-directories.

The input to the scripts are prediction files from the monusac and pannuke models. This can be tweaked to take inputs from any similar models as long as the outputs follow a datastructure that is similar to the format described as follows:

The file is a pickle dump with underlying datastructure as a dictionary. Where each key corresponds to a unique nuclei id.

For example: { 'id1':{'box':[],'centroid':[],'contour':[], 'prob':[], 'type':[]},
'id2':{'box':[],'centroid':[],'contour':[], 'prob':[], 'type':[]}
}

The box describes the bounding box of the nuclei The centroid describes the centroid x,y coordinates of the nuclei The countour describes the boundary of the nuclei in coordinates The prob details the probability of the prediction of nuclei The type details the type of the nuclei, i.e epithelial etc.

The primary function of this code is the "merge_coordinates" function in the script that uses Annoy to merge the predictions.

The output is a ".dat" file which is a pickle file, which has all the combined/integrated/merged predictions in a datastructure described in the example above.

Script to recreate plots as demonstrated in manuscript

The Jupyter notebook titled paper_plots_final.ipynb has the analyses scripts that created the plots. Associated files to run this jupyter notebook have also been uploaded to the repository.

Script to build mixed linear models

The script titled pca_script.R that performs this analysis uses the variancePartition package in R to build the mixed models to assess the variance contributed by the individual models.

Pathway analysis script

The script titled pathway.R that performs this analysis uses the WebGestaltR package to perform the analysis.

Metadata

Release files for cellmerge 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cellmerge 0.1.1
File Size Uploaded
cellmerge-0.1.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cellmerge 0.1.1
File Interpreter ABI Platform
cellmerge-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / cellmerge-0.1.1.tar.gz

Download URL cellmerge-0.1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ae6ed938c19c891c87dd62f5bdef4c6d599bd809936e9a93734757ec3a64756a
BLAKE2b-256 checksum
How to use checksums
065e07da9e83588becc3cc05c35007b8688f9358af514f7e502e5bd404126fbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.9

Release files / cellmerge-0.1.1-py3-none-any.whl

Download URL cellmerge-0.1.1-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07b37231863bf06b1ab1d41e5f4c55f8ad057b507552eb5f76b91c3130754f2a
BLAKE2b-256 checksum
How to use checksums
d913ff40db29176d1176bbd98ff91fbd953f3229def5a8642952cc5dbddfb144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page