1. Structure
  2. Life Sciences
  3. Single-cell
  4. Foundation
  5. Data Model
  • Home
  • What is TileDB?
  • Get Started
  • Explore Content
  • Accounts
    • Individual Accounts
      • Apply for the Free Tier
      • Profile
        • Overview
        • Cloud Credentials
        • Storage Paths
        • REST API Tokens
        • Credits
    • Organization Admins
      • Create an Organization
      • Profile
        • Overview
        • Members
        • Cloud Credentials
        • Storage Paths
        • Billing
      • API Tokens
    • Organization Members
      • Organization Invitations
      • Profile
        • Overview
        • Members
        • Cloud Credentials
        • Storage Paths
        • Billing
      • API Tokens
  • Catalog
    • Introduction
    • Data
      • Arrays
      • Tables
      • Single-Cell (SOMA)
      • Genomics (VCF)
      • Biomedical Imaging
      • Vector Search
      • Files
    • Code
      • Notebooks
      • Dashboards
      • User-Defined Functions
      • Task Graphs
      • ML Models
    • Groups
    • Marketplace
    • Search
  • Collaborate
    • Introduction
    • Organizations
    • Access Control
      • Introduction
      • Share Assets
      • Asset Permissions
      • Public Assets
    • Logging
    • Marketplace
  • Analyze
    • Introduction
    • Slice Data
    • Multi-Region Redirection
    • Notebooks
      • Launch a Notebook
      • Usage
      • Widgets
      • Notebook Image Dependencies
    • Dashboards
      • Dashboards
      • Streamlit
    • Preview
    • User-Defined Functions
    • Task Graphs
    • Serverless SQL
    • Monitor
      • Task Log
      • Task Graph Log
  • Scale
    • Introduction
    • Task Graphs
    • API Usage
  • Structure
    • Why Structure Is Important
    • Arrays
      • Introduction
      • Quickstart
      • Foundation
        • Array Data Model
        • Key Concepts
          • Storage
            • Arrays
            • Dimensions
            • Attributes
            • Cells
            • Domain
            • Tiles
            • Data Layout
            • Compression
            • Encryption
            • Tile Filters
            • Array Schema
            • Schema Evolution
            • Fragments
            • Fragment Metadata
            • Commits
            • Indexing
            • Array Metadata
            • Datetimes
            • Groups
            • Object Stores
          • Compute
            • Writes
            • Deletions
            • Consolidation
            • Vacuuming
            • Time Traveling
            • Reads
            • Query Conditions
            • Aggregates
            • User-Defined Functions
            • Distributed Compute
            • Concurrency
            • Parallelism
        • Storage Format Spec
      • Tutorials
        • Basics
          • Basic Dense Array
          • Basic Sparse Array
          • Array Metadata
          • Compression
          • Encryption
          • Data Layout
          • Tile Filters
          • Datetimes
          • Multiple Attributes
          • Variable-Length Attributes
          • String Dimensions
          • Nullable Attributes
          • Multi-Range Reads
          • Query Conditions
          • Aggregates
          • Deletions
          • Catching Errors
          • Configuration
          • Basic S3 Example
          • Basic TileDB Cloud
          • fromDataFrame
          • Palmer Penguins
        • Advanced
          • Schema Evolution
          • Advanced Writes
            • Write at a Timestamp
            • Get Fragment Info
            • Consolidation
              • Fragments
              • Fragment List
              • Consolidation Plan
              • Commits
              • Fragment Metadata
              • Array Metadata
            • Vacuuming
              • Fragments
              • Commits
              • Fragment Metadata
              • Array Metadata
          • Advanced Reads
            • Get Fragment Info
            • Time Traveling
              • Introduction
              • Fragments
              • Array Metadata
              • Schema Evolution
          • Array Upgrade
          • Backends
            • Amazon S3
            • Azure Blob Storage
            • Google Cloud Storage
            • MinIO
            • Lustre
          • Virtual Filesystem
          • User-Defined Functions
          • Distributed Compute
          • Result Estimation
          • Incomplete Queries
        • Management
          • Array Schema
          • Groups
          • Object Management
        • Performance
          • Summary of Factors
          • Dense vs. Sparse
          • Dimensions vs. Attributes
          • Compression
          • Tiling and Data Layout
          • Tuning Writes
          • Tuning Reads
      • API Reference
    • Tables
      • Introduction
      • Quickstart
      • Foundation
        • Data Model
        • Key Concepts
          • Indexes
          • Columnar Storage
          • Compression
          • Data Manipulation
          • Optimize Tables
          • ACID
          • Serverless SQL
          • SQL Connectors
          • Dataframes
          • CSV Ingestion
      • Tutorials
        • Basics
          • Ingestion with SQL
          • CSV Ingestion
          • Basic S3 Example
          • Running Locally
        • Advanced
          • Scalable Ingestion
          • Scalable Queries
      • API Reference
    • AI & ML
      • Vector Search
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • Vector Search
            • Vector Databases
            • Algorithms
            • Distance Metrics
            • Updates
            • Deployment Methods
            • Architecture
            • Distributed Compute
          • Storage Format Spec
        • Tutorials
          • Basics
            • Ingestion & Querying
            • Updates
            • Deletions
            • Basic S3 Example
            • Running Locally
          • Advanced
            • Versioning
            • Time Traveling
            • Consolidation
            • Distributed Compute
            • RAG LLM
            • LLM Memory
            • File Search
            • Image Search
            • Protein Search
          • Performance
        • API Reference
      • ML Models
        • Introduction
        • Quickstart
        • Foundation
          • Basics
          • Storage
          • Cloud Execution
          • Why TileDB for Machine Learning
        • Tutorials
          • Ingestion
            • Data Ingestion
              • Dense Datasets
              • Sparse Datasets
            • ML Model Ingestion
          • Management
            • Array Schema
            • Machine Learning: Groups
            • Time Traveling
    • Life Sciences
      • Single-cell
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • Data Structures
            • Use of Apache Arrow
            • Join IDs
            • State Management
            • TileDB Cloud URIs
          • SOMA API Specification
        • Tutorials
          • Data Ingestion
          • Bulk Ingestion Tutorial
          • Data Access
          • Distributed Compute
          • Basic S3 Example
          • Multi-Experiment Queries
          • Appending Data to a SOMA Experiment
          • Add New Measurements
          • SQL Queries
          • Running Locally
          • Shapes in TileDB-SOMA
          • Drug Discovery App
        • Spatial
          • Introduction
          • Foundation
            • Spatial Data Model
            • Data Structures
          • Tutorials
            • Spatial Data Ingestion
            • Access Spatial Data
            • Manage Coordinate Spaces
        • API Reference
      • Population Genomics
        • Introduction
        • Quickstart
        • Foundation
          • Data Model
          • Key Concepts
            • The N+1 Problem
            • Architecture
            • Arrays
            • Ingestion
            • Reads
            • Variant Statistics
            • Annotations
            • User-Defined Functions
            • Tables and SQL
            • Distributed Compute
          • Storage Format Spec
        • Tutorials
          • Basics
            • Basic Ingestion
            • Basic Queries
            • Export to VCF
            • Add New Samples
            • Deleting Samples
            • Basic S3 Example
            • Basic TileDB Cloud
          • Advanced
            • Scalable Ingestion
            • Scalable Queries
            • Query Transforms
            • Handling Large Queries
            • Annotations
              • Finding Annotations
              • Embedded Annotations
              • External Annotations
              • Annotation VCFs
              • Ingesting Annotations
            • Variant Statistics
            • Tables and SQL
            • User-Defined Functions
            • Sample Metadata
            • Split VCF
          • Performance
        • API Reference
          • Command Line Interface
          • Python API
          • Cloud API
      • Biomedical Imaging
        • Introduction
        • Foundation
          • Data Model
          • Key Concepts
            • Arrays
            • Ingestion
            • Reads
            • User Defined Functions
          • Storage Format Spec
        • Quickstart
        • Tutorials
          • Basics
            • Ingestion
            • Read
              • OpenSlide
              • TileDB-Py
          • Advanced
            • Batched Ingestion
            • Chunked Ingestion
            • Machine Learning
              • PyTorch
            • Napari
    • Files
  • API Reference
  • Self-Hosting
    • Installation
    • Upgrades
    • Administrative Tasks
    • Image Customization
      • Customize User-Defined Function Images
      • AWS ECR Container Registry
      • Customize Jupyter Notebook Images
    • Single Sign-On
      • Configure Single Sign-On
      • OpenID Connect
      • Okta SCIM
      • Microsoft Entra
  • Glossary
  1. Structure
  2. Life Sciences
  3. Single-cell
  4. Foundation
  5. Data Model

Single-Cell Data Model

life sciences
single cell (soma)
foundation
data model
This page covers the basics of the SOMA data model, including the expression matrix, cell annotations, and gene annotations.

Before diving into SOMA’s data model, it is important to understand the structure at the core of single-cell datasets: the annotated matrix. This structure provides a natural representation for the key elements of any multiplexed assay in which multiple measurements are collected across a set of samples. For example, the output from a single-cell RNA-seq (snRNA-seq) experiment would include, at minimum:

  1. Expression matrix: Each row corresponds to a single cell and each column to a gene. The value in a particular cell of this matrix represents the expression level of a gene in a specific cell.
  2. Cell annotations: Alongside the expression matrix, you have a table containing metadata annotations for each cell (rows in the expression matrix). This typically includes sample identifiers, experimental conditions, and other information that provides context for the expression levels. These annotations facilitate grouping, filtering, or other analyses on subsets of cells.
  3. Gene annotations: Similar to cell annotations, you have another table that provides metadata for each gene (columns in the expression matrix). These annotations might include gene IDs, gene names, or functional categories, providing a reference point for interpreting the expression levels and performing downstream analyses like pathway enrichment.

These three elements are then combined into a single annotated matrix, that can be represented as follows:

Diagram of an annotated matrix. Diagram of an annotated matrix.

This encapsulation has a long history in computational biology. Over 20 years ago, the Bioconductor project added a specialized exprSet class to its Biobase R package to represent annotated matrices containing microarray data. This pioneering work made it possible to store and manipulate complex biological data in a simple, intuitive structure, allowing researchers to easily query expression data based on sample or feature annotations, now standard in most omics toolkits. It also laid the foundation for data structures utilized by modern single-cell analysis libraries like Seurat, AnnData, and Bioconductor’s own SingleCellExperiment.

In TileDB-SOMA, each component of a single-cell dataset is stored in a dedicated TileDB array. These arrays are then organized within nested TileDB groups to form a structured hierarchy similar to the in-memory structures described previously and shown in the figure below.

TileDB-SOMA data model. TileDB-SOMA data model.

Tip

TileDB-SOMA adopts AnnData’s naming conventions for many of its components.

A SOMAExperiment is the top-level, multi-modal container for a TileDB-SOMA dataset. It contains:

  • obs, a SOMADataFrame that stores observation (e.g., cell) annotations.
  • ms, a SOMACollection that stores one or more SOMAMeasurement objects.

In SOMA, a SOMAMeasurement is the container for a single modality (e.g., gene or protein expression) for the set of observations in the experiment. It contains:

  • var, a SOMADataFrame that stores annotations for the variables (e.g., genes or proteins) in the measured modality.
  • X, a collection of one or more SOMASparseNDArrays that store the measurement values collected for the modality (e.g., gene expression values). Each SOMASparseNDArray within X is referred to as a “layer” and allows for the storage of multiple transformations of the data (e.g., raw counts, normalized expression values).
  • obsm/varm, which are collections of SOMASparseNDArrays for matrix-like data where rows corresponds to observations (for obsm arrays) or variables (for varm arrays), with variable numbers of columns. These arrays are typically used to store data like PCA coordinates, UMAP coordinates, or other derived data.
  • obsp/varp, which are collections of SOMASparseNDArrays for pairwise matrix-like data where rows and columns correspond to observations (for obsp arrays) or variables (for varp arrays). These arrays are typically used to store data like graph-based connectivities or distances.
  • uns is a SOMACollection that stores unstructured data (e.g., metadata) that does not fit into the other categories.

The TileDB-SOMA dataset is organized on disk as follows, considering that the example has a dataset called pbmc3k.

pbmc3k/
├── ms/
│   │
│   └── RNA/
│       ├── var
│       ├── X/
│       │   ├── raw
│       │   └── normalized
│       ├── obsm/
│       │   ├── pca
│       │   └── umap
│       ├── obsp/
│       │   ├── connectivities
│       │   └── distances
│       ├── varm/
│       │   └── PCs
│       └── uns/
└── obs

In the above tree structure, leaf nodes ending with / represent SOMACollections (or SOMACollection subclasses such as SOMAExperiment or SOMAMeasurement). Other nodes are arrays (e.g., SOMADataFrame, SOMASparseNDArray, etc).

You can see this dataset contains a single modality: RNA. The X collection contains two layers: raw and normalized, which store the raw and normalized expression values, respectively. Results from PCA and UMAP analyses are stored in the obsm (and varm) collection, while pairwise connectivities and distances are stored in the obsp collection.

Note

For more technical details about SOMA’s data structures and data model, visit the SOMA specification.

Foundation
Key Concepts