Skip to main content

Merge nuclei segmentations from multiple models

Project description

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.

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

cellmerge-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

cellmerge-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file cellmerge-0.1.1.tar.gz.

File metadata

  • Download URL: cellmerge-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.9

File hashes

Hashes for cellmerge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ae6ed938c19c891c87dd62f5bdef4c6d599bd809936e9a93734757ec3a64756a
MD5 54f51cd17f39e27b072ccc6001bffe7c
BLAKE2b-256 065e07da9e83588becc3cc05c35007b8688f9358af514f7e502e5bd404126fbd

See more details on using hashes here.

File details

Details for the file cellmerge-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cellmerge-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.9

File hashes

Hashes for cellmerge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07b37231863bf06b1ab1d41e5f4c55f8ad057b507552eb5f76b91c3130754f2a
MD5 be2dd6de8d20530a5084f898cace3585
BLAKE2b-256 d913ff40db29176d1176bbd98ff91fbd953f3229def5a8642952cc5dbddfb144

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