Skip to content

Commit

Permalink
Add more notebooks and plots for pub (#21)
Browse files Browse the repository at this point in the history
* Create 2_Motility_Analysis_Pools.ipynb

* Update 1_Compute-Summary-Motility-Metrics.ipynb

add units to table and reformat a few cells.

* Update 2_Motility_Analysis_Pools.ipynb

subset of metrics for bivariate distributions

* fix legend

* fix legend

* Create 3_Scale-to-Pools.ipynb

* Create 4_PCA.ipynb

* update notebook formatting

* reduce subset of metrics

* rename notebooks

* update input directories for published dataset

* refactor: substrate --> vessel

* calculate angular change as a rolling average

* Create S1_Quality-Control.ipynb

* remove unused import

* Update S1_Quality-Control.ipynb

* change table style in docs

* Update 1_Compute-Summary-Motility-Metrics.ipynb

- add documentation
- move experimental parameters to ../data/experimental_parameters.json
- remove superfluous plot

* motility metrics for cc124 instead of cc1373

* Create experimental_parameters.json

* Create 2_Quality-Control.ipynb

* Delete 2_Analyze-Motility-in-Pools.ipynb

* Delete 3_Compare-Pools-vs-Wells.ipynb

* Delete 4_Perform-PCA.ipynb

* Delete S1_Quality-Control.ipynb

* linting: remove unused imports

* Rename notebooks

- rename notebook 2 based off Keith's suggestion from code review on #18
- surprising (to me at least) that switching upper case to lower case does not get flagged as a change so adding a `_` to make the switch to lower case for notebook 1
- also add placeholder doi link for pub

* finish notebook name changes (for now)

* Update README.md

* Update README.md

* start using arcadia-pycolor

* Update dev.yml

* refactor: "substrate" --> "vessel_type"

* minor change to plot layout

add `plt.tight_layout()` which throws a `UserWarning` for some reason, so suppress that warning

* add `annotate_statistical_significance`

Add function for measuring and annotating results of a stats test to a plot. Includes a function for mapping P values to number of asterisks for the annotation.

* Create 3_motility-analysis-in-pools.ipynb

* add `inner_kws` arg to violinplot

* Delete plotting_pools.py

functions no longer used

* Update 3_motility-analysis-in-pools.ipynb

* Update 3_motility-analysis-in-pools.ipynb

* Create 4_compare-motility-in-pools-vs-wells.ipynb

Add notebook for comparing pools vs wells. Used for Figure 7 in the pub.

* add plots to results

* Update 3_motility-analysis-in-pools.ipynb

* try to fix linting issue

* LINTTTTTT

* Update 3_motility-analysis-in-pools.ipynb

Bit of clean up in light of Dave's feedback on the pub. Removed what would have been Fig 6 (redundant) and updated documentation to match other notebooks.

* Update 3_motility-analysis-in-pools.ipynb

Correct ylabel and take stabs at linting issue

* move stats testing and annotations to separate module

* Update 4_compare-motility-in-pools-vs-wells.ipynb

Make use of functionality in `stats_testing` to clean up notebook

* Update 3_motility-analysis-in-pools.ipynb

Make use of functionality in `stats_testing` to clean up notebook

* Update 3_motility-analysis-in-pools.ipynb

caught linting issue before it caught me!

* update plots for pub figures

* Update 2_temporal-variation-in-motility-metrics.ipynb

Remove axis grid lines.

* Update 2_temporal-variation-in-motility-metrics.ipynb

Remove superfluous catch warnings.

* Update figure-4.svg

remove grid lines

* Improvements from code review on #21

Add more documentation to notebooks 3 and 4.
Combine finding annotation coordinates for both orientations based on Keith's refactoring.
Miscellaneous refactoring and cleanup of `stats_testing.py`.

* remove unused warnings import
  • Loading branch information
lanery authored Jul 31, 2024
1 parent 298033c commit 124aab5
Show file tree
Hide file tree
Showing 15 changed files with 15,073 additions and 127 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# 2024-unicellular-tracking

[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/projects/miniconda/en/latest/)
[![run with conda](https://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/projects/miniconda/en/latest/)
[![Arcadia Pub](https://img.shields.io/badge/Arcadia-Pub-596F74.svg?logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjcuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNp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geDE9IjI5LjciIHkxPSIyMi4yIiB4Mj0iMjkuNyIgeTI9IjMwLjkiLz4KPC9nPgo8L3N2Zz4K)](https://doi.org/10.57844/arcadia-2d61-fb05)


## Purpose

Detect and track unicellular organisms for scaling up high-throughput motility assay development.

## Installation and Setup

This repository uses conda to manage software environments and installations.
This repository uses conda to manage software environments and installations. If you do not already have conda installed, you can find operating system-specific instructions for installing miniconda [here](https://docs.anaconda.com/miniconda/). After installing conda, navigate to a directory where you would like to clone the repository to, and run the following commands to create the pipeline run environment.

```{bash}
git clone https://github.com/Arcadia-Science/2024-unicellular-tracking.git
conda env create -n unicellular-tracking --file envs/dev.yml
conda activate unicellular-tracking
pip install -e .
```

If the installation was successful, the below command will return the name of the package, `chlamytracker`.
```{bash}
conda env create -n tracking --file envs/dev.yml
conda activate tracking
python -c "import chlamytracker;print(chlamytracker.__name__)"
```

## Overview
Expand Down Expand Up @@ -53,7 +62,7 @@ python track_cells_in_wells.py /path/to/directory/of/nd2/files/ --glob "WellB*.n
For more information on glob patterns check out the official Python [documentation](https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob) for the pathlib library. The default glob pattern is "*.nd2".

### Cell tracking
There are two scripts for executing cell tracking on a batch of timelapse microscopy data. Which script to run depends on the substrate used in the experiment: either agar microchamber pools or 384 (or 1536) well plates. Regardless of the substrate, however, the expected input is more or less the same: a ~20 sec timelapse of brightfield microscopy data stored as a nd2 file in which there are clearly unicellular organisms swimming around. There are no constraints on the duration, dimensions, frame rate, or pixel size of the timelapse, but the code has thus far predominantly been tested on 20 sec timelapses with dimensions around (400, 1200, 1200) T, Y, X acquired at 20-50 frames per second. Most cell tracking has been performed on different species and strains of Chlamydomonas, hence the default of 6 µm for the `min_cell_diameter_um` parameter. This parameter should be increased or decreased based on the size of the organism recorded.
There are two scripts for executing cell tracking on a batch of time-lapse microscopy data. Which script to run depends on the type of vessel used in the experiment: either agar microchamber pools or 384 (or 1536) well plates. Regardless of the vessel type, however, the expected input is more or less the same: a ~20 sec timelapse of brightfield microscopy data stored as a nd2 file in which there are clearly unicellular organisms swimming around. There are no constraints on the duration, dimensions, frame rate, or pixel size of the timelapse, but the code has thus far predominantly been tested on 20 sec timelapses with dimensions around (400, 1200, 1200) T, Y, X acquired at 20-30 frames per second. Most cell tracking has been performed on different species and strains of Chlamydomonas, hence the default of 6 µm for the `min_cell_diameter_um` parameter. This parameter should be increased or decreased based on the size of the organism recorded.

Both scripts will perform segmentation and cell tracking on the timelapse. The segmentation is effectively just background subtraction and intensity thresholding; cell tracking is done using [btrack](https://btrack.readthedocs.io/en/latest/index.html). The output for each nd2 file is a tiff file of the segmented timelapse and a csv file of the motility data that contains every cell detected in the segmentation.

Expand All @@ -73,7 +82,7 @@ Notes


### Making movies of tracked cells
To provide some sort of visual confirmation that the segmentation and cell tracking was done successfully, there are also scripts for adding animations of cell trajectories to the tracked cells using the napari plugin [napari-animation](https://github.com/napari/napari-animation). Here too the choice for which script to run depends on the substrate used in the experiment.
To provide some sort of visual confirmation that the segmentation and cell tracking was done successfully, there are also scripts for adding animations of cell trajectories to the tracked cells using the napari plugin [napari-animation](https://github.com/napari/napari-animation). Here too the choice for which script to run depends on the type of vessel used in the experiment.

To create animations of tracked cells in 384 or 1536 well plates.
```bash
Expand Down
3 changes: 3 additions & 0 deletions envs/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ dependencies:
- pip:
- btrack==0.6.5
- lxml-html-clean==0.1.1
- mpl-interactions==0.24.1
- ipympl==0.9.4
- arcadia-pycolor==0.5.0
- ipywidgets==8.1.2
37 changes: 29 additions & 8 deletions notebooks/2_temporal-variation-in-motility-metrics.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 124aab5

Please sign in to comment.