Graph-based framework to manipulate and analyze cell lineages from cell tracking data
Project description
Pycellin
Pycellin is a graph-based Python framework to easily manipulate and extract information from cell tracking data, at the single-cell level. In pycellin, cell lineages are modeled intuitively by directed rooted trees. Graph nodes represent cells at a specific point in time and space, and graph edges represent the time and space displacement of the cells. Please note that while pycellin is built to support cell division events, it does not authorize cell merging events: a cell at a specific timepoint cannot have more than one parent.
Pycellin provides predefined features related to cell morphology, cell motion and tracking that can be automatically added to enrich lineages. More predefined features will be implemented in the future. The framework also facilitates the creation of new features defined by the user to accommodate the wide variety of experiments and biological questions.
Pycellin can read from and write to:
- TrackMate XMLs,
- Cell Tracking Challenge text files,
- trackpy DataFrames.
More tracking formats will progressively be supported.
While pycellin has been designed with bacteria / cell lineages in mind, it could be used with more diverse tracking data provided the few conditions below are enforced:
- the tracking data can be modeled by directed rooted trees, meaning no merging event
- time must flow homogeneously, i.e. all the edges of a lineage graph must represent the same elapsed time.
Installation
Pycellin supports Python 3.10 and above. It is tested with Python 3.10 and 3.13 on the latest versions of Ubuntu, Windows and MacOS. Please let me know if you encounter any compatibility issue with a different combination.
It is recommended to install pycellin in a conda or mamba environment.
-
Check that conda/mamba is already installed by typing either
condaormambain a terminal. If not, follow the installation instructions on Miniforge. -
Create a Python environment dedicated to pycellin:
conda create -n my_env_pycellin -
Activate the environment:
conda activate my_env_pycellin -
Install pycellin via PyPI:
pip install pycellinor if you want to install the optional test related dependencies use instead:
pip install pycellin[test] -
You're good to go!
Code Example
import pycellin
# Import data from an external tool, here TrackMate.
xml_path = "sample_data/Ecoli_growth_on_agar_pad.xml"
model = pycellin.load_TrackMate_XML(xml_path)
# Plot the cell lineages.
for lin in model.get_cell_lineages():
plot(lin)
# Compute and plot the cell cycle lineages.
model.add_cycle_data()
for clin in model.get_cycle_lineages():
plot(clin)
# Enrich your lineages with additional predefined features.
model.add_pycellin_features([
"cell_length",
"cell_width",
"cell_displacement",
"cell_speed",
"branch_mean_speed",
"relative_age",
"division_time",
"division_rate",
"cell_cycle_completeness",
])
model.update()
# Export the enriched data as dataframes.
cell_df = model.to_cell_dataframe()
link_df = model.to_link_dataframe()
cycle_df = model.to_cycle_dataframe()
lineage_df = model.to_lineage_dataframe()
Usage
Please note that the following notebooks are still a work in progress. There may be some mistakes in the code and some sections might move from one notebook to another.
| Notebook | Description | Level | State |
|---|---|---|---|
| Getting started | The basics of pycellin, through examples | Beginner | WIP |
| Managing features | How to add, compute and remove features from a model | Beginner | WIP |
| Working with TrackMate data | How pycellin can work with TrackMate, through an example | Beginner | WIP |
| Creating a model from scratch | How to manually create a pycellin model, including its lineages | Advanced | Stub |
| Custom features | How to create user-defined features and augment a model with them | Advanced | WIP |
Credits and references
- Laure Le Blanc for Escherichia coli growth on agar pad data (in sample_data directory)
- NetworkX for lineages modeling (Hagberg, Schult and Swart, 2008)
- TrackMate for the TrackMate data loader and exporter (Tinevez et al., 2017, Ershov et al., 2022)
- The Cell Tracking Challenge for the CTC data loader and exporter (Maška et al., 2023)
- trackpy for the trackpy data loader and exporter (Allan et al., 2024)
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycellin-0.4.0.tar.gz.
File metadata
- Download URL: pycellin-0.4.0.tar.gz
- Upload date:
- Size: 75.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebd8ca929f157ff701bb576cd4b3c815e8ab57c58457c868cde4f72962a8202e
|
|
| MD5 |
536e7bb4997fa6294982180d08318495
|
|
| BLAKE2b-256 |
5bac902be5ca4ab090f6556e6cec57a26f8c4ff3e782f7444a0699f1cd8278e1
|
Provenance
The following attestation bundles were made for pycellin-0.4.0.tar.gz:
Publisher:
deploy.yml on Image-Analysis-Hub/pycellin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycellin-0.4.0.tar.gz -
Subject digest:
ebd8ca929f157ff701bb576cd4b3c815e8ab57c58457c868cde4f72962a8202e - Sigstore transparency entry: 210559142
- Sigstore integration time:
-
Permalink:
Image-Analysis-Hub/pycellin@2c40829b85555731c623b038d19818b8c92ecf74 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Image-Analysis-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@2c40829b85555731c623b038d19818b8c92ecf74 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycellin-0.4.0-py3-none-any.whl.
File metadata
- Download URL: pycellin-0.4.0-py3-none-any.whl
- Upload date:
- Size: 83.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9c5934fd9b4f145e5c369c6a132d1e3e3c31071122a5d912ef75a034dcd4609
|
|
| MD5 |
8397f9fa3682d26e670333abd1b5191b
|
|
| BLAKE2b-256 |
c0421b74d4274f74a32773e126c3a1a957093f3ae453acd50f7fba1706950b38
|
Provenance
The following attestation bundles were made for pycellin-0.4.0-py3-none-any.whl:
Publisher:
deploy.yml on Image-Analysis-Hub/pycellin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycellin-0.4.0-py3-none-any.whl -
Subject digest:
e9c5934fd9b4f145e5c369c6a132d1e3e3c31071122a5d912ef75a034dcd4609 - Sigstore transparency entry: 210559144
- Sigstore integration time:
-
Permalink:
Image-Analysis-Hub/pycellin@2c40829b85555731c623b038d19818b8c92ecf74 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Image-Analysis-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@2c40829b85555731c623b038d19818b8c92ecf74 -
Trigger Event:
release
-
Statement type: