Skip to content
intermediatescience

Human Protein Atlas Subcellular Localization Across 28 Labels

Select every compartment a protein localizes to on four-channel microscopy images, using 28 HPA labels. The ten sample images are synthetic and illustrative.

Get This Design

View on GitHub(opens in a new tab)

Clone or download from the repository

Quick start:

bash
git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/science/microscopy/hpa-protein-localization
potato start config.yaml

About this dataset

The Human Protein Atlas (HPA) maps where human proteins sit inside cells. The HPA Image Classification competition, analyzed by Ouyang et al. in Nature Methods in 2019, used 42,774 images sampled across 27 main cell lines, split into 31,072 training and 11,702 test images. Each image has four channels. The antibody-stained protein of interest is green, and three reference channels outline the cell, with microtubules in red, the nucleus in blue, and the endoplasmic reticulum in yellow.

The protocol applies one or more labels to each image, typically two to six, from 28 compartments that the HPA merged down from 32 organelle classes. The original labels came from two workflows, experts curated by a second expert and EVE Online gamers curated by experts. The design reproduces the label set verbatim from the competition data page. One annotator labels each image with a multiselect scheme beside a microscopy display that switches channels on and off. The microscopy scheme is a viewer, with no regions or cells drawn. The HPA license page names CC BY 4.0 for the database but no separate image license, so all ten sample images are synthetic OME-TIFF files made for the showcase, and the files carry no gold labels.

The model_training block uses hf-image-classification, which fine-tunes a vision transformer as a multi-label classifier over the 28 labels and writes predictions back as pre-labels for images nobody has labeled. The green protein channel is read as a PNG, since Pillow cannot open the four-channel OME-TIFF, and the reference channels are never seen. The sklearn-text trainer, which classifies CLIP image embeddings, needs no extra install. With ten synthetic images the demo shows the loop and not a useful model.

Images
42,774 in the competition dataset (31,072 training, 11,702 test)
Channels per image
4 (protein, microtubules, nucleus, endoplasmic reticulum)
Localization labels
28, merged from 32 HPA organelle classes
Cell lines
27 main cell lines
Sample images
10 synthetic, illustrative OME-TIFF images
Licence
HPA database CC BY 4.0, image licence not stated, so no HPA images are shipped

Configuration File

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# Human Protein Atlas: subcellular localization of a protein, 28 labels per image
#
# Dataset: Human Protein Atlas (HPA) Image Classification competition data
# URL: https://www.proteinatlas.org/humanproteome/subcellular/data
# Competition data page: https://www.kaggle.com/c/human-protein-atlas-image-classification/data
# Licence: HPA licenses "all copyrightable parts of our database" under CC BY 4.0, names no
#   separate image licence, and asks for the credit "Human Protein Atlas"
#   (https://www.proteinatlas.org/about/licence). Because the image terms are not stated,
#   every sample image in this design is synthetic and illustrative.
# Paper: Ouyang, W., Winsnes, C. F., Hjelmare, M., et al. (2019). Analysis of the Human
#   Protein Atlas Image Classification competition. Nature Methods 16(12), 1254-1261.
#   @article{Ouyang_2019, title={Analysis of the Human Protein Atlas Image Classification competition},
#     volume={16}, DOI={10.1038/s41592-019-0658-6}, number={12}, journal={Nature Methods},
#     author={Ouyang, Wei and Winsnes, Casper F. and Hjelmare, Martin and others}, year={2019},
#     pages={1254-1261}}
# DOI: 10.1038/s41592-019-0658-6
#
# Protocol quotes (Ouyang et al. 2019, Nature Methods):
#   "Each image consists of four channels: the antibody-stained protein of interest (green)
#   and three reference channels to outline the cell: microtubules (red), nucleus (blue)
#   and endoplasmic reticulum (ER; yellow)."
#   "Manual annotation of the observed localization pattern is performed by applying one or
#   more labels to the images" (typically two to six labels per sample).
#   "A total of 32 organelle classes from the HPA were merged into 28 classes for the
#   competition."
# Kaggle data page: "The green filter should hence be used to predict the label, and the
#   other filters are used as references."
#
# Label glossary, verbatim from the Kaggle data page (integer codes 0-27 in train.csv):
#   0 Nucleoplasm, 1 Nuclear membrane, 2 Nucleoli, 3 Nucleoli fibrillar center,
#   4 Nuclear speckles, 5 Nuclear bodies, 6 Endoplasmic reticulum, 7 Golgi apparatus,
#   8 Peroxisomes, 9 Endosomes, 10 Lysosomes, 11 Intermediate filaments, 12 Actin filaments,
#   13 Focal adhesion sites, 14 Microtubules, 15 Microtubule ends, 16 Cytokinetic bridge,
#   17 Mitotic spindle, 18 Microtubule organizing center, 19 Centrosome, 20 Lipid droplets,
#   21 Plasma membrane, 22 Cell junctions, 23 Mitochondria, 24 Aggresome, 25 Cytosol,
#   26 Cytoplasmic bodies, 27 Rods & rings
#
# Sample items: ten synthetic, illustrative four-channel OME-TIFF images (media/), drawn
# with numpy. They are cartoons of localization-like patterns, not HPA images, and carry no
# gold labels. See media/LICENSE-media.txt.
#
# Adaptations:
#   - Images are synthetic and illustrative, not HPA images (licence for images not stated).
#   - Each four-channel image is one OME-TIFF (the original ships four PNG or TIFF files per
#     sample), because Potato's microscopy display reads OME-TIFF or OME-Zarr from local files.
#   - The microscopy scheme is a viewer (tools: []). Annotators switch channels and contrast
#     and record the labels in the multiselect below. No regions or cells are drawn.
#   - One annotator labels each image. The original data mixes expert annotation, curated by a
#     second expert, with annotation by EVE Online gamers, curated by experts. Neither workflow
#     is reproduced.
#   - The model_training trainer reads the green (protein) channel as a PNG
#     (image_url, media/hpa_NNN_green.png), since Pillow cannot read a four-channel OME-TIFF.
#
# Model training (admin page /admin/training, admin key below):
#   hf-image-classification fine-tunes a vision transformer on the labelled green-channel
#   PNGs as a multi-label classifier over the 28 labels, and predicts labels for images
#   nobody has labelled, written back as prelabels to correct. It learns from the green
#   channel only and does not see the reference channels. Needs:
#   pip install 'potato-annotation[train-vision]'
#   sklearn-text, which classifies CLIP image embeddings, is the option with no extra install.
#   With ten synthetic images the demo shows the loop, not a useful model.
#
# Run (the microscopy display needs the optional readers):
#   pip install 'potato-annotation[microscopy]'
#   potato start config.yaml -p 8000

annotation_task_name: "HPA protein localization"

task_dir: "."
media_directory: media

data_files:
  - "sample-data.json"

item_properties:
  id_key: "id"
  text_key: "note"

output_annotation_dir: "annotation_output"
export_annotation_format: jsonl

user_config:
  allow_all_users: true
  users: []

require_password: false
admin_api_key: "demo-admin-key"

annotation_instructions: |
  The green channel shows the protein of interest. The red, blue, and yellow channels show
  microtubules, the nucleus, and the endoplasmic reticulum, to place the protein inside the
  cell. Turn channels on and off and adjust contrast, then select every compartment where the
  protein sits. Most samples carry between two and six labels.

annotation_schemes:
  - annotation_type: microscopy
    name: cells
    description: "Inspect the four channels (protein, microtubules, nucleus, endoplasmic reticulum)."
    instructions: >-
      Turn channels on and off and set their contrast in the Channels panel. Compare the
      green protein channel against the three reference channels.
    image_key: image
    tools: []
    labels:
      - name: region
        color: "#e8590c"
    channels:
      - name: protein
        label: "Protein (green)"
        color: "#00ff00"
      - name: microtubules
        label: "Microtubules (red)"
        color: "#ff0000"
      - name: nucleus
        label: "Nucleus (blue)"
        color: "#0000ff"
      - name: ER
        label: "Endoplasmic reticulum (yellow)"
        color: "#ffff00"
    height: 520

  - annotation_type: multiselect
    name: localization
    description: "Which compartments does the protein localise to? Select every label that applies."
    labels:
      - "Nucleoplasm"
      - "Nuclear membrane"
      - "Nucleoli"
      - "Nucleoli fibrillar center"
      - "Nuclear speckles"
      - "Nuclear bodies"
      - "Endoplasmic reticulum"
      - "Golgi apparatus"
      - "Peroxisomes"
      - "Endosomes"
      - "Lysosomes"
      - "Intermediate filaments"
      - "Actin filaments"
      - "Focal adhesion sites"
      - "Microtubules"
      - "Microtubule ends"
      - "Cytokinetic bridge"
      - "Mitotic spindle"
      - "Microtubule organizing center"
      - "Centrosome"
      - "Lipid droplets"
      - "Plasma membrane"
      - "Cell junctions"
      - "Mitochondria"
      - "Aggresome"
      - "Cytosol"
      - "Cytoplasmic bodies"
      - "Rods & rings"
    display_config:
      num_columns: 3
    label_requirement:
      required: true

model_training:
  enabled: true
  writeback:
    schemas: ["localization"]
    include_unlabeled: true
    min_confidence: 0.5

Sample Data

json
[
  {
    "id": "hpa_001",
    "image": "hpa_001.ome.tif",
    "image_url": "hpa_001_green.png",
    "note": "Illustrative image 1 of 10. Synthetic four-channel field of five cells."
  },
  {
    "id": "hpa_002",
    "image": "hpa_002.ome.tif",
    "image_url": "hpa_002_green.png",
    "note": "Illustrative image 2 of 10. Synthetic four-channel field of five cells."
  }
]

// ... and 8 more items

Dataset & paper

Ouyang et al., Nature Methods 2019

Paper DOI
10.1038/s41592-019-0658-6

Citation (BibTeX)

bibtex
@article{Ouyang_2019,
  title = {Analysis of the Human Protein Atlas Image Classification competition},
  author = {Ouyang, Wei and Winsnes, Casper F. and Hjelmare, Martin and Cesnik, Anthony J. and \r{A}kesson, Lovisa and Xu, Hao and Sullivan, Devin P. and Dai, Shubin and Lan, Jun and Jinmo, Park and Galib, Shaikat M. and Henkel, Christof and Hwang, Kevin and Poplavskiy, Dmytro and Tunguz, Bojan and Wolfinger, Russel D. and Gu, Yinzheng and Li, Chuanpeng and Xie, Jinbin and Buslov, Dmitry and Fironov, Sergei and Kiselev, Alexander and Panchenko, Dmytro and Cao, Xuan and Wei, Runmin and Wu, Yuanhao and Zhu, Xun and Tseng, Kuan-Lun and Gao, Zhifeng and Ju, Cheng and Yi, Xiaohan and Zheng, Hongdong and Kappel, Constantin and Lundberg, Emma},
  journal = {Nature Methods},
  volume = {16},
  number = {12},
  pages = {1254--1261},
  year = {2019},
  month = nov,
  publisher = {Springer Science and Business Media LLC},
  doi = {10.1038/s41592-019-0658-6}
}

Details

Annotation Types

microscopymultiselect

Domain

microscopycell biologyproteomics

Use Cases

subcellular localizationmulti-label image classificationmultichannel microscopymodel-assisted annotation

Tags

human protein atlashpaprotein localizationmultichannel microscopyome-tiffmulti-labelhf-image-classification

Found an issue or want to improve this design?

Open an Issue(opens in a new tab)