CellPhe: Toolkit for cell phenotyping from time-lapse videos
Project description
CellPhe
CellPhe provides functions to phenotype cells from time-lapse videos and accompanies the paper:
Wiggins, L., Lord, A., Murphy, K.L. et al.
The CellPhe toolkit for cell phenotyping using time-lapse imaging and pattern recognition.
Nat Commun 14, 1854 (2023).
https://doi.org/10.1038/s41467-023-37447-3
The Python package is a port of the original R implementation.
Installation
You can install the latest version of CellPhe from PyPi with:
pip install cellphe
Example
An example dataset to demonstrate CellPhe’s capabilities is hosted on Dryad in the archive example_data.zip
and comprises 3 parts:
- The time-lapse stills as TIFF images (
05062019_B3_3_imagedata
) - Existing pre-extracted features
(
05062019_B3_3_Phase-FullFeatureTable.csv
) - Region-of-interest (ROI) boundaries already demarked in ImageJ
format (
05062019_B3_3_Phase
)
These should be extracted into a suitable location before proceeding with the rest of the tutorial.
The first step is to prepare a dataframe containing metadata and any
pre-existing attributes. If PhaseFocus Livecyte or Trackmate software
has been used to generate the region-of-interest (ROI) files, then a
helper function is available to create the required metadata format:
copy_features
. The dataframe format comprises each row corresponding to
a cell tracked in a given frame, indexed by columns FrameID
and
CellID
which contain numerical identifiers (NB: FrameID
must be in
ascending chronological order). The only other required field is
ROI_filename
, which specifies the filename of the ROI file
corresponding to the frame-cell combination. Any features can be
provided in additional columns, copyFeatures
returns volume and
sphericity from PhaseFocus software.
The example below creates the metadata dataframe from a PhaseFocus experimental setup, only including cells that were tracked for at least 50 frames.
from cellphe.input import copy_features
min_frames = 50
input_feature_table = "05062019_B3_3_Phase-FullFeatureTable.csv"
feature_table = copy_features(input_feature_table, min_frames, source="Phase")
In addition to any pre-calculated features, the extract_features()
function generates 74 descriptive features for each cell on every frame
using the frame images and pre-generated cell boundaries, based on size,
shape, texture, and the local cell density. The output is a dataframe
comprising the FrameID
, CellID
, and ROI_filename
identifying
columns, the 74 features as columns, and any additional features that
may be present (such as from copy_features()
) in further columns. The
program expects frames to be named according to the scheme
<experiment name>-<frameid>.tif
, where <frameid>
is a 4 digit
zero-padded integer corresponding to the FrameID
column, and located
in the frame_folder
directory, while ROI files are named according to
the ROI_filename
column and located in the roi_folder
directory.
from cellphe.features import extract_features
roi_folder = "05062019_B3_3_Phase"
image_folder = "05062019_B3_3_imagedata"
new_features = extract_features(feature_table, roi_folder, image_folder, framerate=0.0028)
Variables are calculated from the time series for any pre-existing
features as well as the output of extract_features()
, providing both
summary statistics and indicators of time-series behaviour at different
levels of detail obtained via wavelet analysis. 15 summary scores are
calculated for each feature, in addition to the cell trajectory, thereby
resulting in a default output of 1081 features (15x72 + 1). These are
output in the form of a dataframe with the first column being the
CellID
used previously.
from cellphe.features import time_series_features
tsvariables = time_series_features(new_features)
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
Built Distribution
File details
Details for the file cellphe-0.0.2.tar.gz
.
File metadata
- Download URL: cellphe-0.0.2.tar.gz
- Upload date:
- Size: 95.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a69352b256c8ddb966c678c058e61b68e5b32f1610ab590c0fb97de1f4218d |
|
MD5 | 0adb717f768505b56c9f9a4be02f4dc0 |
|
BLAKE2b-256 | dfbb127e082bb8005547e6ae2f549836052200d99d711b437f7d27971482e5dd |
File details
Details for the file cellphe-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: cellphe-0.0.2-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec93b59c80be2db73e6551eb028d6606c8a6f68f01d5a18bbf975dd3ca5857d |
|
MD5 | f5429b522c3c95ea9fd5a288905eea7d |
|
BLAKE2b-256 | 94bd28451b9d389aa2f9b60c79f3a2e78967d3cb9541a89ef62ad68a5aa1a6c9 |