Skip to main content

A Python distribution of iCARE, a tool for individualized Coherent Absolute Risk Estimation.

Project description

Py-iCARE

Py-iCARE is a Python distribution of iCARE, a tool for individualized Coherent Absolute Risk Estimation. iCARE allows users to build, validate, and apply absolute risk models. Absolute risk quantifies the chance of an event occurring. For example, the likelihood that a healthy individual, of a given age and a risk factor profile, will develop the disease of interest over a specified time interval.

The original iCARE was written in R and its archived version (1.26.0) is available via Bioconductor at: https://www.bioconductor.org/packages/release/bioc/html/iCARE.html.

Motivation

The main motivation of porting iCARE from R to Python was to enable its use as a WebAssembly module (via Pyodide) for the proliferation of portable and privacy-preserving web applications that can build, validate, and apply absolute risk models. Python also enables researchers to leverage its rapidly evolving data science ecosystem— including TensorFlow, PyTorch, statsmodels, and scikit-learn— to explore novel absolute risk models that can incorporate evidence from wider sources of data.

Installation

This repository contains a Python package. It can be installed via PyPI as shown below. It is also compiled into WebAssembly via Pyodide. The wrapper JavaScript library, as ES6 modules, is also distributed in this repository at GitHub Pages. It can be accessed by any JavaScript runtime environment, including Node.js, web browsers, and Quarto notebooks in RStudio (to interface with R, Julia, and/or Python). Specifically, the steps to access it via JavaScript and R are also shown below.

If you want to access iCARE from a Python runtime environment, you can install it via PyPI:

pip install pyicare

iCARE is supported on Python 3.12 and above.

Usage

Once installed, Py-iCARE can be imported into your Python scripts as follows:

import icare

Py-iCARE is a library with three main methods:

  1. compute_absolute_risk(): a method to build and apply absolute risk models. Based on the type of risk factors present in the model and what information is available, there can be three broad variations in using this method:
    1. Special SNP-only absolute risk model: this variation shows you how to specify a SNP-based absolute risk model without the need to provide a reference dataset to represent the risk factor distribution of the underlying population. Open In Colab
    2. Covariate-only absolute risk model: this option shows you how to specify a risk model with any type of covariates (including classical questionnaire-based risk factors and/or SNPs) so long as a reference dataset is available to represent the distribution of all the covariates in the underlying population. Open In Colab
    3. Combined SNP and covariate absolute risk model: this option shows you how to specify a risk model that contains both SNPs and other type of covariates, such that, you have the reference dataset to represent the distribution of the covariates in the underlying population but you do not have the reference dataset to represent the SNP distribution. Open In Colab
  2. compute_absolute_risk_split_interval(): a method to build and apply absolute risk models that relaxes the proportional hazard assumption, to some extent, by allowing you to specify different model parameters that vary before and after a cut-point in time. Open In Colab
  3. validate_absolute_risk_model(): a method to validate absolute risk models on an independent cohort study data or a case-control study nested within a cohort. Open In Colab

The Jupyter notebooks for all the use-cases described above is available at the demo directory of this repository.

iCARE for the web

Wasm-iCARE is a distribution of Py-iCARE for web applications(applications running on web browser, Node.js, RStudio's Quarto, etc.). Applications where portability and privacy is critical can make use of Wasm-iCARE. Wasm-iCARE is available at: https://github.com/jeyabbalas/wasm-icare.

License

Py-iCARE is open-source licensed under the MIT License.

References

  1. Balasubramanian JB, Choudhury PP, Mukhopadhyay S, Ahearn T, Chatterjee N, García-Closas M, Almeida JS. Wasm-iCARE: a portable and privacy-preserving web module to build, validate, and apply absolute risk models. JAMIA open. 2024 Apr 8;7(2).

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

pyicare-1.2.0.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

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

pyicare-1.2.0-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file pyicare-1.2.0.tar.gz.

File metadata

  • Download URL: pyicare-1.2.0.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyicare-1.2.0.tar.gz
Algorithm Hash digest
SHA256 919950142773b0936339ab4ed5fb061935ecfba64d2b839aba98bfa1fd5aa8e4
MD5 21c872c5f44408d053d6c9477e5b04cf
BLAKE2b-256 962e9c848f5c6857f6203e9e0185f770ef61f6be2b9e0974cfc921f9b458f42f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyicare-1.2.0.tar.gz:

Publisher: release.yml on jeyabbalas/py-icare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyicare-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyicare-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyicare-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f4cbc8e8b5cc578bb9145841becbfdc5dee078a9b25ae063b488f1a0da9c6bb
MD5 b36300cc3c9ccc09b98c8d31a54c3675
BLAKE2b-256 07810baa835a2ea83e077eefef203bd9acdb29fc3f5e5ef79f4d19b1f01f2b0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyicare-1.2.0-py3-none-any.whl:

Publisher: release.yml on jeyabbalas/py-icare

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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