Skip to main content

Score cells for centrioles in IF data

Project description

CenFind

A command line interface to score cells for centrioles.

Introduction

cenfind is a command line interface to detect and assign centrioles in immunofluorescence images of human cells. Specifically, it orchestrates:

  • the z-max projection of the raw files;
  • the detection of centrioles;
  • the detection of the nuclei;
  • the assignment of the centrioles to the nearest nucleus.

Installation

  1. Install python via pyenv
  2. Download and set up 3.9.5 as local version
  3. Set up Python interpreter
pyenv local 3.9.5
pyenv global 3.9.5
  1. Create a virtual environment for CenFind
python -m venv venv-cenfind
source venv-cenfind/bin/activate
  1. Check that cenfind's programs are correctly installed by running:
cenfind squash --help

Basic usage

Before scoring the cells, you need to prepare the dataset folder. cenfind assumes a fixed folder structure. In the following we will assume that the .ome.tif files are all immediately in raw/. Each file is a z-stack field of view (referred to as field, in the following) containing 4 channels (0, 1, 2, 3). The channel 0 contains the nuclei and the channels 1-3 contains centriolar markers.

<project_name>/
└── raw/
  1. Run prepare to initialise the folder with a list of channels and output folders:
cenfind prepare /path/to/dataset <list channels of centrioles, like 1 2 3, (if 0 is the nucleus channel)>
  1. Run squash with the path to the project folder and the suffix of the raw files. projections/ is populated with the max-projections *_max.tif files.
cenfind squash path/to/dataset
  1. Run score with the arguments source, the index of the nuclei channel (usually 0 or 3), the channel to score and the path to the model. You need to download it from https://figshare.com/articles/software/Cenfind_model_weights/21724421
cenfind score /path/to/dataset /path/to/model/ 0 1 2 3 --projection_suffix '_max'
  1. Check that the predictions are satisfactory by looking at the folders visualisation/ and statistics/

  2. If you interested in categorising the number of centrioles, run cenfind analyse path/to/dataset --by <well> the --by option is interesting if you want to group your scoring by well, if the file names obey to the rule <WELLID_FOVID>.

Running cenfind score in the background

When you exit the shell, running programs receive the SIGHUP, which aborts them. This is undesirable if you need to close your shell for some reasons. Fortunately, you can make your program ignore this signal by prepending the program with the nohup command. Moreover, if you want to run your program in the background, you can append the ampersand &. In practice, run nohup cenfind score ... & instead of cenfind score ....

The output will be written to the file nohup.out and you can peek the progress by running tail -F nohup.out, the flag -F will refresh the screen as the file is being written. Enter Ctrl-C to exit the tail program.

If you want to kill the program score, run jobs and then run kill <jobid>. If you see no jobs, check the log nohup.out; it can be done or the program may have crashed, and you can check the error there.

Internal API

cenfind consists of two core classes: Dataset and Field.

A Dataset represents a collection of related fields, i.e., same pixel size, same channels, same cell type.

It should:

  • return the name
  • iterate over the fields,
  • construct the file name for the projections and the z-stacks
  • read the fields.txt
  • write the fields.txt file
  • set up the folders projections, predictions, visualisations and statistics
  • set and get the splits

A Field represents a field of view and should:

  • construct file names for projections, annotation
  • get Dataset
  • load the projection as np.ndarray
  • load the channel as np.ndarray
  • load annotation as np.ndarray
  • load mask as np.ndarray

Using those two objects, cenfind should

  • detect centrioles (data, model) => points,
  • extract nuclei (data, model) => contours,
  • assign centrioles to nuclei (contours, points) => pairs
  • outline centrioles and nuclei (data, points) => image
  • create composite vignettes (data) => composite_image
  • flag partial nuclei (contours, tolerance) => contours
  • compare predictions with annotation (points, points) => metrics_namespace

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

cenfind-0.10.3.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

cenfind-0.10.3-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file cenfind-0.10.3.tar.gz.

File metadata

  • Download URL: cenfind-0.10.3.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1031-azure

File hashes

Hashes for cenfind-0.10.3.tar.gz
Algorithm Hash digest
SHA256 9fd152f9a265b87560eb10ce3cfbd5f9a11887325097435506441a838a2515b2
MD5 0d061b31977e21a7a727c4a7c5261f1e
BLAKE2b-256 27337692a0369d479a27de6a7c80c5dc69e1f76e6b6370180feee6d14bd6f504

See more details on using hashes here.

File details

Details for the file cenfind-0.10.3-py3-none-any.whl.

File metadata

  • Download URL: cenfind-0.10.3-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1031-azure

File hashes

Hashes for cenfind-0.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 589fcacb5b3f8cbe758f5e8912633acf600907fa540d4d45b9cc7f3cf756213a
MD5 42f302e289f4c8061113310715c396a1
BLAKE2b-256 908a7ee3d121cdc51ec844c7c2e56b87852c224fdedf21ed72f10a0e93b6a685

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page