Skip to main content

An image feature extractor with self-supervised learning

Project description

cytoself

Code style: black PyPI Python Version DOI License

Alt Text

cytoself is a self-supervised platform that we developed for learning features of protein subcellular localization from cell images. This model is described in detail in our recent preprint [2]. The representations derived from cytoself encapsulate highly specific features that can derive functional insights for proteins on the sole basis of their localization.

Applying cytoself to images of endogenously labeled proteins from the recently released OpenCell database creates a highly resolved protein localization atlas [1].

[1] Cho, Nathan H., et al. "OpenCell: proteome-scale endogenous tagging enables the cartography of human cellular organization." bioRxiv (2021). https://www.biorxiv.org/content/10.1101/2021.03.29.437595v1
[2] Kobayashi, Hirofumi, et al. "Self-Supervised Deep-Learning Encodes High-Resolution Features of Protein Subcellular Localization." bioRxiv (2021). https://www.biorxiv.org/content/10.1101/2021.03.29.437595v1

How cytoself works

cytoself uses images and its identity information as a label to learn the localization patterns of proteins. We used cell images where single protein is labeled and the ID of labeled protein as identity information.

Alt Text

What's in this repository

This repository offers three main components: DataManager, cytoself.models, and Analytics.

DataManager is a simple module to handle train, validate and test data. You may want to modify it to adapt to your own data structure. This module is in cytoself.data_loader.data_manager.

cytoself.models contains modules for three different variants of the cytoself model: a model without split-quantization, a model without the pretext task, and the 'full' model (refer to our preprint for details about these variants). There is a submodule for each model variant that provides methods for constructing, compiling, and training the models (which are built using tensorflow).

Analytics is a simple module to perform analytic processes such as dimension reduction and plotting. You may want to modify it too to perform your own analysis. This module is in cytoself.analysis.analytics. Open In Colab

Installation

Recommended: create a new environment by

conda create -n cytoself python=3.7

Clone this repository

git clone https://github.com/royerlab/cytoself.git

(Option) Install TensorFlow GPU

If your computer is equipped with GPUs that supports Tensorflow 1.15, you can install Tensorflow-gpu to utilize GPUs. Make sure to install the following packages before running setup.py, otherwise you may want to uninstall and reinstall them with conda.

conda install h5py=2.10.0
conda install tensorflow-gpu=1.15

Run the following code inside the cytoself folder to install dependencies.

python setup.py develop

Example script

A minimal example script is in example/simple_training.py.

Test if this package runs in your computer with command

python examples/simple_example.py

Computation resources

It is highly recommended to use GPU to run cytoself. A full model with image shape (100, 100, 2) and batch size 64 can take ~9GB of GPU memory.

Tested Environment

Google Colab (CPU/GPU/TPU)

macOS 10.14.6, RAM 32GB (CPU)

Windows10 Pro 64bit, RAM 32GB (CPU)

Ubuntu 18.04.5 LTS, TITAN xp, CUDA 10.2 (GPU)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cytoself-0.0.1.1.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

cytoself-0.0.1.1-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file cytoself-0.0.1.1.tar.gz.

File metadata

  • Download URL: cytoself-0.0.1.1.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.10

File hashes

Hashes for cytoself-0.0.1.1.tar.gz
Algorithm Hash digest
SHA256 6cb883938c0a0304c5512e3d289664ef5cfd7716b568579be9e12aca3d2d1e7a
MD5 aa972dda49e8f1d65a75884427bf7ceb
BLAKE2b-256 8814bad0d8929aef7fd83b4d4bb81f2e2c907efe6b76eeb60dde5fce7845e862

See more details on using hashes here.

File details

Details for the file cytoself-0.0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cytoself-0.0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.10

File hashes

Hashes for cytoself-0.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a23ee42a23c9949a4d6d114175bafc0c0722fa4f85219f136fdd8eff1646fe6
MD5 3da24344c311a27bd3c931859b4288fd
BLAKE2b-256 71601d356d74a75f70e8005af2ccd6d1d8a38e9b68269580054b7ba412ee2c16

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