Package: cytoself
cytoselfSelf-supervised deep learning encodes high-resolution features of protein subcellular localizationcytoself is a self-supervised model that we developed for learning features of protein subcellular localization from microscopy images.
This model is described in detail in our paper[1].
The image 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 releasedOpenCelldatabase creates a highly resolved protein localization atlas[2].[1] Kobayashi, Hirofumi,et al."Self-Supervised Deep-Learning Encodes High-Resolution Features of Protein
Subcellular Localization."Nature Methods(2022).https://www.nature.com/articles/s41592-022-01541-z[2] Cho, Nathan H.,et al."OpenCell: Endogenous tagging for the cartography of human cellular organization."Science375.6585 (2022): eabi6983.https://www.science.org/doi/10.1126/science.abi6983How cytoself workscytoself uses images and an associated identity information (ID) as a label to learn the localization patterns of proteins.
When applied to OpenCell we used cell images where individual proteins are endogenously tagged per image. For each image we know which
protein is tagged and that is the ID used. Our model implicitely learns to ignore image differences for images that
are associated to the same ID, and tries its best to tell images apart if they are associated to different IDs. In practice cytoself
can resolve very fine textural differences between image classes but also can ignore very complex sources of image variability
such as cell shapes, states, etc...What's in this repositoryThis repository offers three main components:DataManager,cytoself.models,
andAnalytics.DataManageris 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 incytoself.data_loader.data_manager.cytoself.modelscontains 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).Analyticsis 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 incytoself.analysis.analytics.Pre-trained model weights are included in theexample script.Note: Cytoself will migrate to pytorch implementation in the near future.InstallationRecommended: create a new environment and install cytoself on the environment from pypicondacreate-y-ncytoselfpython=3.7
condaactivatecytoself
pipinstallcytoself(Option) Install TensorFlow GPUIf your computer is equipped with GPUs that support Tensorflow 1.15, you can install Tensorflow-gpu to utilize GPUs.
Install the following packages before cytoself, or uninstall the existing CPU versions and reinstall the GPU versions
again with conda.condainstall-yh5py=2.10.0tensorflow-gpu=1.15For developersYou can also install cytoself from this GitHub repository.gitclonehttps://github.com/royerlab/cytoself.git
pipinstall.TroubleshootingIn case of getting errors in the installation, run the following code inside the cytoself folder to manually install
the dependencies.pipinstall-rrequirements.txtAs a reference for a complete dependency, a snapshot of a working environment can be found inenvironment.ymlExample script (How to use cytoself)A minimal example script is inexample/simple_training.py.
Learn how to use cytoself throughTest if this package runs in your computer with commandpythonexamples/simple_example.pyComputational resourcesIt is highly recommended to use a GPU to run cytoself.
For example, a full model with image shape of (100, 100, 2) and batch size 64 can take ~9GB of GPU memory.Tested EnvironmentGoogle Colab (CPU/GPU/TPU)macOS 10.14.6, RAM 32GB (CPU)Windows10 Pro 64bit, RTX 1080Ti, CUDA 11.6 (CPU/GPU)Ubuntu 18.04.6 LTS, RTX 2080Ti, CUDA 11.2 (CPU/GPU)Data AvailabilityPretrained modelPre-trained models used in thepaper.
Please follow theexample scriptorto lean how to use a pre-trained model.model_protein_nucleardistance.h5: The model trained on target protein and nuclear distance.model_protein.h5: The model trained on target protein alone.model_protein_nucleus.h5: The model trained on target protein and nucleus.The full data of image and protein label used in this work can be found here.
The image data have the shape of[batch, 100, 100, 4], in which the last channel dimension corresponds to[target  protein, nucleus, nuclear distance, nuclear segmentation].EmbeddingsThe embedding vectors of global representations and their labels are available from the following links.
Due to their large size, only embeddings extracted from test data are provided.Global_representation.npyIn the shape of 114,806 images x 9,216 latent dimensions. (3.9 GB)label.csv114,806 rows x 7 columns. (6.2 MB)Image and label dataDue to the large size, the whole data is split to 10 files. The files are intended to be concatenated together to
form one large numpy file or one large csv.Image_data00.npyImage_data01.npyImage_data02.npyImage_data03.npyImage_data04.npyImage_data05.npyImage_data06.npyImage_data07.npyImage_data08.npyImage_data09.npyLabel_data00.csvLabel_data01.csvLabel_data02.csvLabel_data03.csvLabel_data04.csvLabel_data05.csvLabel_data06.csvLabel_data07.csvLabel_data08.csvLabel_data09.csv