Contact: brianraymor@chanzuckerberg.com
Document Status: Approved
Version: 2.0.0
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED" "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14, RFC2119, and RFC8174 when, and only when, they appear in all capitals, as shown here.
cellxgene aims to support the publication, sharing, and exploration of single-cell datasets. Building on those published datasets, cellxgene seeks to create references of the phenotypes and composition of cells that make up human tissues.
Creating references from multiple datasets requires some harmonization of metadata and features in the cellxgene Data Portal. But if that harmonization is too onerous, it will burden the goal of rapid data sharing. cellxgene balances publishing and reference creation needs by requiring datasets hosted in the cellxgene Data Portal to include a small set of metadata readily available from data submitters.
This document describes the schema, a type of contract, that cellxgene requires all datasets to adhere to so that it can enable searching, filtering, and integration of datasets it hosts.
Note that the requirements in the schema are just the minimum required information. Datasets often have additional metadata, which is preserved in datasets submitted to the cellxgene Data Portal.
This schema supports multiple assay types. Each assay takes the form of one or more two-dimensional matrices whose values are quantitative measures of the phenotypes of cells.
The schema additionally describes how the dataset, genes, and cells are annotated to describe the biological and technical characteristics of the data.
This document is organized by:
- General requirements
X
(Matrix layers), which describe the data required for different assaysobs
(Cell metadata), which describe each cell in the datasetvar
andraw.var
(Gene metadata), which describe each gene in the datasetobsm
(Embeddings), which describe each embedding in the datasetuns
(Dataset metadata), which describe the dataset as a whole
-
AnnData - The canonical data format for the cellxgene Data Portal is HDF5-backed AnnData as written by version 0.7 of the anndata library. Part of the rationale for selecting this format is to allow cellxgene to access both the data and metadata within a single file. The schema requirements and definitions for the AnnData
X
,obs
,var
,raw.var
,obsm
, anduns
attributes are described below.All data submitted to the cellxgene Data Portal is automatically converted to a Seurat V3 object that can be loaded by the R package Seurat. See the Seurat encoding for further information.
-
Organisms. Data MUST be from a Metazoan organism or SARS-COV-2 and defined in the NCBI organismal classification. For data that is neither Human, Mouse, nor SARS-COV-2, features MUST be translated into orthologous genes from the pinned Human and Mouse gene annotations.
-
Reserved Names. The names of the metadata keys specified by the schema are reserved and MUST be unique. For example, duplicate
"feature_biotype"
keys in AnnDatavar
are not allowed. -
Redundant Metadata. It is STRONGLY RECOMMENDED to avoid multiple metadata fields containing identical or similar information.
-
No PII. Curators agree to this requirement as part of the data submission policy. However, it is not strictly enforced in our validation tooling because it is difficult for software to predict what is and is not PII. It is up to the submitter to ensure that no metadata can be personally identifiable: no names, dates of birth, specific locations, etc. See this list for guidance.
The types below are python3 types. Note that a python3 str
is a sequence of Unicode code points, which is stored null-terminated and UTF-8-encoded by anndata.
The data stored in the X
data matrix is the data that is viewable in cellxgene Explorer. cellxgene does not impose any additional constraints on the X
data matrix.
In any layer, if a matrix has 50% or more values that are zeros, it is STRONGLY RECOMMENDED that the matrix be encoded as a scipy.sparse.csr_matrix
.
cellxgene's matrix layer requirements are tailored to optimize data reuse. Because each assay has different characteristics, the requirements differ by assay type. In general, cellxgene requires submission of "raw" data suitable for computational reuse when a standard raw matrix format exists for an assay and strongly recommends that a "final" matrix suitable for visualization in cellxgene Explorer be included. So that cellxgene's data can be provided in download formats suitable for both R and Python, the schema imposes the following requirements:
- All matrix layers MUST have the same shape, and have the same cell labels and gene labels.
- Because it is impractical to retain all barcodes in raw and final matrices, any cell filtering MUST be applied to both. By contrast, those wishing to reuse datasets require access to raw gene expression values, so genes SHOULD NOT be filtered from either dataset. Summarizing, any cell barcodes that are removed from the data MUST be filtered from both raw and final matrices and genes SHOULD NOT be filtered from the raw matrix.
- Any genes that publishers wish to filter from the final matrix MAY have their values replaced by zeros and MUST be flagged in the column
feature_is_filtered
ofvar
, which will mask them from exploration. - Additional layers provided at author discretion MAY be stored using author-selected keys, but MUST have the same cells and genes as other layers. It is STRONGLY RECOMMENDED that these layers have names that accurately summarize what the numbers in the layer represent (e.g.
"counts_per_million"
,"SCTransform_normalized"
, or"RNA_velocity_unspliced"
).
The following table describes the matrix data and layers requirements that are assay-specific. If an entry in the table is empty, the schema does not have any other requirements on data in those layers beyond the ones listed above.
Assay | "raw" required? | "raw" location | "final" required? | "final" location |
---|---|---|---|---|
scRNA-seq (UMI, e.g. 10x v3) | REQUIRED. Values MUST be de-duplicated molecule counts. | AnnData.raw.X unless no "final" is provided, then AnnData.X |
STRONGLY RECOMMENDED | AnnData.X |
scRNA-seq (non-UMI, e.g. SS2) | REQUIRED. Values MUST be one of read counts (e.g. FeatureCounts) or estimated fragments (e.g. output of RSEM). | AnnData.raw.X unless no "final" is provided, then AnnData.X |
STRONGLY RECOMMENDED | AnnData.X |
Accessibility (e.g. ATAC-seq, mC-seq) | NOT REQUIRED | REQUIRED | AnnData.X |
|
cellxgene requires ontology terms to enable search, comparison, and integration of data. Ontology terms for cell metadata MUST use OBO-format identifiers, meaning a CURIE (prefixed identifier) of the form Ontology:Identifier. For example, EFO:0000001 is a term in the Experimental Factor Ontology (EFO).
The most accurate ontology term MUST always be used. This is true even in cases where there may not be an exact or approximate ontology term.
For example if cell_type_ontology_term_id
describes a relay interneuron, but the most accurate available term in the CL ontology is CL:0000099 for interneuron, then the interneuron term can be used to fulfill this requirement and ensures that users searching for "neuron" are able to find these data. If no appropriate high-level term can be found or the cell type is unknown, then the most accurate term is CL:0000003 for native cell.
Users will still be able to access more specific cell type annotations that have been submitted with the dataset (but aren't required by the schema).
Terms documented as obsolete in an ontology MUST NOT be used. For example, EFO:0009310 for obsolete_10x v2 was marked as obsolete in EFO version 3.31.0 and replaced by EFO:0009899 for 10x 3' v2.
The following ontology dependencies are pinned for this version of the schema.
Ontology | OBO Prefix | Required version |
---|---|---|
Cell Ontology | CL | cl.owl : 2021-08-10 |
Experimental Factor Ontology | EFO | efo.owl : 2021-08-16 EFO 3.33.0 |
Human Ancestry Ontology | HANCESTRO | hancestro.owl : 2021-01-04 (2.5) |
Human Developmental Stages | HsapDv | hsapdv.owl : 2020-03-10 |
Mondo Disease Ontology | MONDO | mondo.owl : 2021-08-11 |
Mouse Developmental Stages | MmusDv | mmusdv.owl : 2020-03-10 |
NCBI organismal classification | NCBITaxon | ncbitaxon.owl : 2021-06-10 |
Phenotype And Trait Ontology | PATO | pato.owl : 2021-08-06 |
Uberon multi-species anatomy ontology | UBERON | uberon.owl : 2021-07-27 |
cellxgene requires ENSEMBL identifiers for genes and External RNA Controls Consortium (ERCC) identifiers for RNA Spike-In Control Mixes to ensure that all datasets it stores measure the same features and can therefore be integrated.
The following gene annotation dependencies are pinned for this version of the schema. For multi-organism experiments, cells from any Metazoan organism are allowed as long as orthologs from the following organism annotations are used.
Source | Required version | Download |
---|---|---|
GENCODE (Human) | Human reference GRCh38 (GENCODE v38/Ensembl 104) | gencode.v38.primary_assembly.annotation.gtf |
GENCODE (Mouse) | Mouse reference GRCm39 (GENCODE vM27/Ensembl 104) | gencode.vM27.primary_assembly.annotation.gtf |
ENSEMBL (COVID-19) | SARS-CoV-2 reference (ENSEMBL assembly: ASM985889v3) | Sars_cov_2.ASM985889v3.101.gtf |
ThermoFisher ERCC Spike-Ins | ThermoFisher ERCC RNA Spike-In Control Mixes (Cat # 4456740, 4456739) | cms_095047.txt |
obs
is a pandas.DataFrame
.
Curators MUST annotate the following columns in the obs
dataframe:
Key | assay_ontology_term_id | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Annotator | Curator | ||||||||||||||
Value | categorical with str categories. This MUST be an EFO term and either:
"EFO:0008995" for 10x technology or preferably its most accurate child. An assay based on SMART (Switching Mechanism at the 5' end of the RNA Template) or SMARTer technology SHOULD either be "EFO:0010184" for Smart-like or preferably its most accurate child.If there is not an exact match for the assay, clarifying text MAY be enclosed in parentheses and appended to the most accurate term. For example, the sci-plex assay could be curated as "EFO:0010183 (sci-plex)" .Recommended values for specific assays:
|
Key | cell_type_ontology_term_id |
---|---|
Annotator | Curator |
Value | categorical with str categories. This MUST be a CL term.
|
Key | development_stage_ontology_term_id | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Annotator | Curator | ||||||||||||||||
Value | categorical with str categories. If unavailable, this MUST be "unknown" If organism_ontolology_term_id is "NCBITaxon:9606" for Homo sapiens, this MUST be the mostaccurate HsapDv term with the following STRONGLY RECOMMENDED:
If organism_ontolology_term_id is "NCBITaxon:10090" for Mus musculus, this MUST be the mostaccurate MmusDv term with the following STRONGLY RECOMMENDED:
Otherwise, for all other organisms this MUST be the most accurate child of UBERON:0000105 for life cycle stage, excluding UBERON:0000071 for death stage. |
Key | disease_ontology_term_id |
---|---|
Annotator | Curator |
Value | categorical with str categories. This MUST be a MONDO term or "PATO:0000461" for normal or healthy.
|
Key | ethnicity_ontology_term_id |
---|---|
Annotator | Curator |
Value | categorical with str categories. If organism_ontolology_term_id is "NCBITaxon:9606" for Homo sapiens, this MUST be either a HANCESTRO term or "unknown" if unavailable. Otherwise, for all other organisms this MUST be "na" .
|
Key | is_primary_data |
---|---|
Annotator | Curator |
Value | bool . This MUST be True if this is the canonical instance of this cellular observation and False if not. This is commonly False for meta-analyses reusing data or for secondary views of data.
|
Key | organism_ontology_term_id |
---|---|
Annotator | Curator |
Value | categorical with str categories. This MUST be a child of NCBITaxon:33208 for Metazoa.
|
Key | sex_ontology_term_id |
---|---|
Annotator | Curator |
Value | categorical with str categories. This MUST be a child of PATO:0001894 for phenotypic sex or "unknown" if unavailable.
|
Key | tissue_ontology_term_id | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Annotator | Curator | ||||||||||
Value | categorical with str categories. This MUST be the UBERON or CL term that best describes the tissue that this cell was derived from, depending on the type of biological sample:
|
When a dataset is uploaded, the cellxgene Data Portal MUST automatically add the matching human-readable name for the corresponding ontology term to the obs
dataframe. Curators MUST NOT annotate the following columns.
Key | assay |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be the human-readable name assigned to the value of assay_ontology_term_id . Any clarifying text enclosed in parentheses and appended to assay_ontology_term_id MUST be appended to assay .For example, if the sci-plex assay was curated as "EFO:0010183 (sci-plex)" , then the value would be "single-cell library construction (sci-plex)" .
|
Key | cell_type |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be the human-readable name assigned to the value of cell_type_ontology_term_id .
|
Key | development_stage |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be "unknown" if set in development_stage_ontology_term_id ; otherwise, this MUST be the human-readable name assigned to the value of development_stage_ontology_term_id .
|
Key | disease |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be the human-readable name assigned to the value of disease_ontology_term_id .
|
Key | ethnicity |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be "na" or "unknown" if set in ethnicity_ontology_term_id ; otherwise, this MUST be the human-readable name assigned to the value of ethnicity_ontology_term_id .
|
Key | organism |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be the human-readable name assigned to the value of organism_ontology_term_id .
|
Key | sex |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be "unknown" if set in sex_ontology_term_id ; otherwise, this MUST be the human-readable name assigned to the value of sex_ontology_term_id .
|
Key | tissue |
---|---|
Annotator | Data Portal |
Value | categorical with str categories. This MUST be the human-readable name assigned to the value of tissue_ontology_term_id . " (cell culture)" or " (organoid)" MUST be appended if present in tissue_ontology_term_id .For example, if the tissue_ontology_term_id was curated as "CL:0000057 (cell culture)" , then the value would be "fibroblast (cell culture)" .
|
var
and raw.var
are both of type pandas.DataFrame
.
Curators MUST annotate the following columns in the var
dataframe and if present, the raw.var
dataframe.
Key | feature_biotype |
---|---|
Annotator | Curator |
Value | This MUST be "gene" or "spike-in" .
|
Key | index of pandas.DataFrame |
---|---|
Annotator | Curator |
Value | str . If the feature_biotype is "gene" then this MUST be an ENSEMBL term. If the feature_biotype is "spike-in" then this MUST be an ERCC Spike-In identifier.The index of the pandas.DataFrame MUST contain unique identifiers for features. If present, the index of raw.var MUST be identical to the index of var . |
Curators MUST annotate the following column only in the var
dataframe. This column MUST NOT be present in raw.var
:
Key | feature_is_filtered |
---|---|
Annotator | Curator |
Value | bool . This MUST be True if the feature was filtered out in the final matrix (X ) but is present in the raw matrix (raw.X ). The value for all cells of the given feature in the final matrix MUST be 0 . Otherwise, this MUST be False . |
When a dataset is uploaded, cellxgene Data Portal MUST automatically add the matching human-readable name for the corresponding feature identifier and the inferred NCBITaxon term for the reference organism to the var
and raw.var
dataframes. Curators MUST NOT annotate the following columns:
Key | feature_name |
---|---|
Annotator | Data Portal |
Value | str . If the feature_biotype is "gene" then this MUST be the human-readable ENSEMBL gene name assigned to the feature identifier in var.index . If the feature_biotype is "spike-in" then this MUST be the ERCC Spike-In identifier appended with " (spike-in control)" .
|
Key | feature_reference | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Annotator | Data Portal | ||||||||||
Value | str . This MUST be the reference organism for a feature:
|
For each str
key, obsm
stores a numpy.ndarray
of shape (n_obs, m)
, where n_obs
is the number of rows in X
and m >= 1
.
To display a dataset in cellxgene Explorer, Curators MUST annotate one or more two-dimensional (m >= 2
) embeddings (e.g. tSNE, UMAP, PCA, spatial coordinates) as numpy.ndarrays
in obsm
. The keys for these embedding MUST be prefixed with "X_"
. The text that follows this prefix is presented to users in the Embedding Choice selector in cellxgene Explorer.
To illustrate, the Krasnow Lab Human Lung Cell Atlas, 10X dataset in the A molecular cell atlas of the human lung from single cell RNA sequencing collection defines two embeddings in obsm
:
"X_Compartment_tSNE"
"X_tSNE"
Users can then choose which embedding is visualized in cellxgene Explorer:
See also default_embedding
in uns
.
uns
is a ordered dictionary with a str
key. Curators MUST annotate the following keys and values in uns
:
Key | schema_version |
---|---|
Annotator | Curator |
Value |
This MUST be "2.0.0" .
|
Key | title |
---|---|
Annotator | Curator |
Value |
str . This text describes and differentiates the dataset from other datasets in the same collection. It is displayed on a page in the cellxgene Data Portal that also has the collection name. To illustrate, the first dataset name in the Cells of the adult human heart collection is "All — Cells of the adult human heart".It is STRONGLY RECOMMENDED that each dataset title in a collection is unique and does not depend on other metadata such as a different assay to disambiguate it from other datasets in the collection.
|
Key | X_normalization |
---|---|
Annotator | Curator |
Value |
str . This SHOULD describe the method used to normalize the data stored in AnnData X . If data in X are raw, this SHOULD be "none" .
|
Curators MAY also annotate the following optional keys and values in uns
. If the key is present, then its value MUST NOT be empty.
Key | batch_condition |
---|---|
Annotator | Curator |
Value |
list[str] . str values MUST refer to cell metadata keys in obs . Together, these keys define the batches that a normalization or integration algorithm should be aware of. For example if "patient" and "seqBatch" are keys of vectors of cell metadata, either ["patient"] , ["seqBatch"] , or ["patient", "seqBatch"] are valid values.
|
Key | default_embedding |
---|---|
Annotator | Curator |
Value |
str . The value MUST match a key to an embedding in obsm for the embedding to display by default in cellxgene Explorer.
|
Key | X_approximate_distribution |
---|---|
Annotator | Curator |
Value |
str . cellxgene runs a heuristic to detect the approximate distribution of the data in X so that it can accurately calculate statistical properties of the data. This field enables the curator to override this heuristic and specify the data distribution explicitly. The value MUST be "count" (for data whose distributions are best approximated by counting distributions like Poisson, Binomial, or Negative Binomial) or "normal" (for data whose distributions are best approximated by the Gaussian distribution.)
|
schema v2.0.0 substantially remodeled schema v1.1.0:
-
"must", "should", and select other words have a defined, standard meaning.
-
Curators are responsible for annotating ontology and gene identifiers. The cellxgene Data Portal adds the assigned human-readable names for all identifiers.
-
Documented and pinned the required versions of ontologies and gene annotations used in schema validation.
-
General Requirements
-
AnnData is now the canonical data format. The schema outline and descriptions are AnnData-centric.
-
Metazoan multi-organism data is accepted by the cellxgene Data Portal. For data that is neither Human, Mouse, nor SARS-COV-2, features MUST be translated into orthologous genes from the Human and Mouse gene annotations.
-
Policies for reserved names and redundant metadata are documented.
-
#45 Updated reference to new PII content
-
-
X (matrix layers)
- Added guidance for sparse matrices
- Clarified matrix requirements by assay
-
obs (cell metadata)
- Empty ontology fields are no longer permitted.
- Moved organism from uns to obs
- Clarified requirements and added detailed guidance for assays, tissue, and development stages
- Added ontology for mouse development stages
- Added ontology for sex
- Added
is_primary_data
-
var
- Replaced HGNC gene symbols as
var.index
with ENSEMBL or ERCC spike-in identifiers - Added
feature_name
,index
, andfeature_reference
- Added
feature_is_filtered
- Added requirements for
raw.var
which must be identical tovar
- Replaced HGNC gene symbols as
-
uns
- Added
batch_condition
- Added
X_approximate_distribution
- Replaced
layer_descriptions
withX_normalization
- Replaced
version
which includedcorpora_schema_version
andcorpora_encoding_version
withschema_version
- Deprecated
tags
anddefault_field
presentation metadata - Removed
obs_column_colors
- Added