What is seqspec?
seqspec is a simple, standardized file format to describe how a genomics library was prepared and sequenced. Different genomics assays require unique processing steps. Including a seqspec file with your data makes it easy for others (and future you!) to reanalyze your dataset. Here we will give a brief description of the seqspec format. For a more in-depth description of seqspec and the seqspec file format, refer to the GitHub page and the paper.
Understanding the seqspec File Format
A seqspec file is a YAML-formatted document with three main sections:
- Assay Info – metadata describing the assay and protocols used
- Library Structure – layout and sequence of regions in the library
- Read Structure – how the sequencing reads correspond to library regions
Each section depends on the specific library preparation and sequencing technology used in your assay.
YAML (short for “YAML Ain’t Markup Language”) is a lightweight, human-readable format that is easy to edit and interpret, yet structured enough for automated parsing by software. This balance makes it ideal for encoding experimental metadata that must be both transparent to researchers and machine-accessible for reproducible analysis.
Section 1: Assay Info
The first section describes the overall experiment — what assay was used, which kit, and how it was sequenced.
Basic Format
!Assay
seqspec_version: 0.3.0
assay_id:
name:
doi:
date:
description:
modalities:
- rna
lib_struct:
sequence_protocol:
sequence_kit:
library_protocol:
library_kit:seqspec_version — version of the seqspec format used. This tutorial uses format version 0.3.0, which is the current format and is fully supported by the latest seqspec tool (v0.4.0)
assay_id, name, doi, date, description — metadata describing the assay. The date must be written as day, full month name and year (e.g., 29 July 2024)
modalities — a list of the modalities in the library (rna, dna, atac, protein, tag or crispr). Even a single modality must be written as a list item (- rna)
library_protocol, library_kit — kit and reagents used for library prep
sequence_protocol, sequence_kit — sequencing instrument and reagents used
library_protocol, sequence_protocol and sequence_kit must be chosen from seqspec’s controlled vocabulary (for example, single-cell RNA sequencing assay (OBI:0002631) or Illumina NovaSeq 6000 (EFO:0008637)). If your protocol or kit is not listed, use Custom. library_kit may be any text.
Example
Suppose you used the Parse Biosciences Evercode WT Mega v2.0.1 dual index kit to generate an scRNA-seq library, sequenced on Illumina NovaSeq X. The corresponding seqspec file might look like so:
!Assay
seqspec_version: 0.3.0
assay_id: Evercode-WT-mega-v2-dual-index
name: Parse Evercode Mega WT v2 using dual Illumina multiplex index
doi: https://www.protocols.io/view/evercode-wt-mega-v2-2-1-8epv5xxrng1b/v1?step=21
date: 08 November 2023
description: split-pool ligation-based transcriptome sequencing
modalities:
- rna
lib_struct: https://igvf.github.io/seqspec/
library_protocol: single-nucleus RNA sequencing assay (OBI:0003109)
library_kit: Evercode WT Mega v2.0.1 dual index
sequence_protocol: Illumina NovaSeq X (EFO:0022840)
sequence_kit: NovaSeq X Series 25B Reagent KitSection 2: Library Structure
The library structure section lists all regions in the sequencing library (from 5’ to 3’), such as primers, linkers, UMIs, and barcodes.
Each region is defined with the following template:
- !Region
parent_id:
region_id:
region_type:
name:
sequence_type:
sequence:
min_len:
max_len:
onlist:
regions: region_id, region_type, name — identifies and describes the region
parent_id — refers to the parent region (if it exists)
region_type — must be one of seqspec’s region types, such as illumina_p5, illumina_p7, truseq_read1, truseq_read2, index5, index7, barcode, umi, linker, cdna or named
sequence, sequence_type — specifies the nucleotide sequence and its type: fixed (a known sequence), onlist (one of a list of known sequences, written as Ns), random (an unknown sequence such as a UMI or cDNA, written as Xs) or joined (a parent region made up of child regions)
min_len, max_len — defines expected sequence lengths
onlist — references a file of valid sequences (e.g., known cell barcodes); null if the region has no onlist
regions — the child regions of this region; [] if it has none
Nested Regions
Parent regions can contain multiple child regions, forming a hierarchical structure. Here’s a minimal example with one parent and two child regions:
library_spec:
- !Region
parent_id: null
region_id: parent
...
regions:
- !Region
parent_id: parent
region_id: region_1
...
regions: []
- !Region
parent_id: parent
region_id: region_2
...
regions: []Examples
Below are two example regions you might find in a seqspec file.
Example 1: Illumina P5 primer
- !Region
parent_id: rna
region_id: P5
region_type: illumina_p5
name: Illumina P5 primer
sequence_type: fixed
sequence: AATGATACGGCGACCACCGAGATCTACAC
min_len: 29
max_len: 29
onlist: null
regions: []Example 2: Parse Biosciences Evercode WT v2 round 1 barcode
- !Region
parent_id: rna
region_id: R1_BC
region_type: barcode
name: Round 1 Barcode
sequence_type: onlist
sequence: NNNNNNNN
min_len: 8
max_len: 8
onlist: !Onlist
file_id: BC1_WT_rev.txt
filename: BC1_WT_rev.txt
filetype: txt
filesize: 864
url: https://caltech-bioinformatics-resource-center.github.io/Tutorials/seqspec/onlists/Parse/v2/BC1_WT_rev.txt
urltype: https
md5: "820449f4ab25627116df1911ce50e6c5"
regions: []Barcode and index regions are often validated against a fixed list of known sequences called an “onlist” (for example, 10x Genomics cell barcodes or Parse Biosciences round barcodes). Each onlist entry must include file_id, filename, filetype, filesize (in bytes), url, urltype (local, http, https or ftp) and md5. Onlist sequences are written in the same orientation as the library structure (5’→3’ from P5 to P7). If a barcode is sequenced by a read on the negative strand (as Parse barcodes are by Read 2), it appears in that read’s FASTQ as the reverse complement of its onlist, and tools such as seqspec onlist do not reverse it for you. For this reason, the Parse seqspecs should not be used with seqspec onlist to make a kb-python whitelist (see our Parse tutorials).
Section 3: Read Structure
The read structure section links your FASTQ files to specific sequencing reads.
Each read entry looks like this:
- !Read
read_id:
name:
modality:
primer_id:
min_len:
max_len:
strand:
files:read_id, name — identifies the read object
primer_id — links to the corresponding primer region
strand — direction of sequencing relative to the library layout
min_len, max_len — expected read length
files — references the FASTQ files containing this read. filesize is the size of the file in bytes, and md5 is its checksum (on macOS, run md5 read_1.fastq.gz; on Linux, run md5sum read_1.fastq.gz)
Example
sequence_spec:
- !Read
read_id: read_1
name: Read 1
modality: rna
primer_id: truseq_read1
min_len: 28
max_len: 28
strand: pos
files:
- !File
file_id: read_1.fastq.gz
filename: read_1.fastq.gz
filetype: fastq
filesize: 10737418240
url: https://example.org/read_1.fastq.gz
urltype: https
md5: d1410f93b53357d4f95edb0ba0d73c07Validate Your seqspec file with seqspec check
You can use the seqspec check command from the seqspec package to verify your seqspec file is correctly formatted.
seqspec check seqspec.yamlIf your file is valid, the command will complete without errors; otherwise, it will print a description of any issues found in the specification.
In order to install seqspec, follow our installation instructions here, using seqspec as the package name (e.g., pip install seqspec). The latest version of seqspec (v0.4.0) requires Python 3.12 or newer.
Summary
| Section | Purpose |
|---|---|
| Assay Info | Defines the experimental and sequencing metadata |
| Library Structure | Describes regions within your sequencing library |
| Read Structure | Links reads and files to specific regions |
To get an assay-specific sample seqspec file and tutorial, select your assay here.