Get started
Every output below is what the call returned on 3 November 2026, on apb-catalog's bundle 0.1.4 and the synthetic results of its test bundle: tiny APB results of two runs and three features, one per software version.
Install
npm install @anndata-omics-bridge/apb-catalogThe package reads APB's Parquet results. Convert with apb2:
apb2 convert DATA --params PARAMETER_FILE --format parquet --output result # writes result.parquetLoad the bundle
Download apb-catalog-bundle.tar.gz from an apb-catalog release and serve its folder next to the data; the file server must answer HTTP range requests.
import {
Bundle, Catalog, DataCatalog, UnresolvedField, sets
} from '@anndata-omics-bridge/apb-catalog'
const bundle = await Bundle.load('catalog/apb-catalog-bundle/manifest.json')
bundle.version // '0.1.4'
sets(bundle).map((row) => [row.set, row.entries])
// [['abundance_alpha', 45], ['confidence_alpha', 26], ['proteobench_entrapment_alpha', 7],
// ['apb_alpha', 181], ['obs_annotation_alpha', 7], ['fasta_peptides_alpha', 28],
// ['fasta_proteins_alpha', 4], ['chromatography_alpha', 58]]Names without data
Catalog takes a software name and a software version, such as '2.2.0', and answers from the rules alone; its levels hold names:
const catalog = new Catalog(bundle, 'DIA-NN', '2.2.0', 'abundance_alpha')
Array.from(catalog.levels.keys()) // ['peptidoform_ion', 'protein']
const ion = catalog.levels.get('peptidoform_ion')
ion?.layers.keys()
// ['intensity', 'intensity_ms1', 'intensity_norm_settings', 'intensity_ms1_norm_settings']
ion?.layers.get('intensity') // 'Precursor_Quantity'
ion?.layers.get('maxlfq') // null: no MaxLFQ for precursors
ion?.layers.name('maxlfq')
// throws KeyError: peptidoform_ion layers has no key or field 'maxlfq'
const apb = new Catalog(bundle, 'DIA-NN', '2.2.0', 'apb_alpha')
apb.levels.get('peptidoform_ion')?.var.select(['peptidoform_ion', 'protein_assignment'])
// ['ProForma_ion', 'Protein_Group']Get the data of a result
read_parsed_levels reads a result from its provenance JSON, as apbCatalogR's read_parsed_levels() does; new DataCatalog wraps it and composes the named sets alone; apb_alpha answers only when named:
const result = await read_parsed_levels('results/maxquant_wide-peptidoform_ion.parquet/manifest.json')
const confidence = new DataCatalog(bundle, result, ['confidence_alpha', 'apb_alpha'])
const level = confidence.levels.get('peptidoform_ion')
level?.layers.keys() // ['pep']
level?.var.keys()
// ['contaminant', 'decoy', 'fasta_accessions', 'peptide', 'peptidoform',
// 'peptidoform_ion', 'protein_assignment']
level?.layers.name('pep') // 'PEP', MaxQuant's name
const pep = await level?.layers.get('pep')
// { runs: ['S0', 'S1'], features: ['F0', 'F1', 'F2'],
// values: [Float64Array [0.8, 0.9, 1], …] }: one array per run| Call | Returns | One value per |
|---|---|---|
layers.get(key) | Promise<Layer | null>: runs, features, and one Float64Array per run | run and feature |
var.get(key) | Promise<Column | null>: a Float64Array for numbers, otherwise strings or booleans | feature |
obs.get(key) | Promise<Column | null> | run |
layers.name(key), var.name(key), obs.name(key) | the field's name, at once |
await level?.var.get('decoy') // [true, false, true]
level?.var.name('peptidoform_ion') // 'ProForma_ion'
await level?.layers.get('q_value') // null: no q-value per run here
await level?.X() // the primary layer, Intensity: 2 runs × 3 features
await level?.obs_names() // ['S0', 'S1']null means the vendor reports no such field, or APB2 left it out because it held one value or none. A lookup is answered from the provenance JSON alone; only the data fetches a Parquet file.
The whole result
The result itself holds each level as AnnData does, by the vendor's own names: the whole var and obs tables, X() and the other layers. var() is R's result$levels$peptidoform_ion$var and Python's adata.var:
const own = result.levels.get('peptidoform_ion')
await own?.var()
// Map { 'ProForma_ion' => ['F0', 'F1', 'F2'], 'Sequence' => ['v0', 'v1', 'v2'], …,
// 'Charge' => Float64Array [1, 2, 3], …, 'apb_Contaminant' => [true, false, true] }: 20 columns
await own?.obs() // Map { 'Raw_file' => ['S0', 'S1'], 'Experiment' => …, 'Fraction' => … }
own?.layers.keys() // ['MS_MS_count', 'Retention_time', …, 'Score', 'PEP']
await own?.layers.get('PEP') // the same Layer as level.layers.get('pep')Keys first, then the level's own names
A name that is no key reads the level's own field of that name, as cf_xarray's accessor does; keys() and has() know keys only:
level?.layers.name('Score') // 'Score': MaxQuant's own layer
level?.layers.has('Score') // false
level?.layers.has('pep') // trueA vendor may name a column as a key is named, as Sage names its quantification q-value q_value. A prefix makes the lookup exact: a set's prefix asks that set alone and never the level's own field, v: the level's own field alone and never the catalog; sets(bundle) lists each set's prefix:
level?.layers.name('c:pep') // 'PEP': the confidence set alone
level?.layers.name('v:Score') // 'Score': MaxQuant's own layer alone
level?.layers.get('c:Score') // throws: unknown key 'Score'Name several sets to read their keys together:
const both = new DataCatalog(bundle, result, ['abundance_alpha', 'confidence_alpha'])
both.levels.get('peptidoform_ion')?.layers.keys() // ['intensity', 'pep']Narrow with qualifiers
A qualifier the key leaves open is the second argument of get and name:
const alphadia = await read_parsed_levels('results/alphadia_v2-peptidoform_ion.parquet/manifest.json')
const chromatography = new DataCatalog(bundle, alphadia, ['chromatography_alpha'])
const rt = chromatography.levels.get('peptidoform_ion')
rt?.layers.name('retention_time', { unit: 'second' }) // 'precursor_rt_observed'
await rt?.layers.get('retention_time', { unit: 'minute' }) // null: AlphaDIA's is in secondsA qualifier the key already fixes throws: in the abundance_alpha set, layers.get('intensity_norm_settings', { normalization: 'none' }) throws "ask by key; intensity_norm_settings fixes normalization".
Several columns for one key
Where a key names several columns, such as the two SDRF factor values that both say group, get throws UnresolvedField and select reads them all:
const annotated = new DataCatalog(bundle, await read_parsed_levels('results/edge-sdrf.parquet/manifest.json'), [])
const sdrf = annotated.levels.get('peptidoform_ion')
sdrf?.obs.get('group')
// throws UnresolvedField: group (kind=group) on peptidoform_ion is ambiguous:
// 2 entries match: factor_value_treatment, factor_value_dose
await sdrf?.obs.select(['group'])
// Map { 'factor_value_treatment' => ['a', 'b'], 'factor_value_dose' => ['1', '2'] }When there is no single answer
| Call | Throws |
|---|---|
Spectronaut abundance_alpha, protein level: layers.get('intensity_norm_settings', { aggregation: 'sum' }) | UnresolvedField, unknown: PG_Quantity leaves aggregation unknown |
var.name(key) where only apb-fasta's field answers and apb-fasta has not run, in a set that also has vendor fields | UnresolvedField, unknown: run apb-fasta verify-peptides; get returns null, as for a column the result lacks |
layers.name('maxlfq') where there is none | KeyError; get returns null |
new Catalog(bundle, 'DIA-NN', '3.0', 'confidence_alpha') | Error: no packaged DIA-NN rule admits version '3.0' |
const spectronaut = await read_parsed_levels('results/spectronaut-protein.parquet/manifest.json')
const abundance = new DataCatalog(bundle, spectronaut, ['abundance_alpha'])
try {
await abundance.levels.get('protein')?.layers.get('intensity_norm_settings', { aggregation: 'sum' })
} catch (error) {
if (!(error instanceof UnresolvedField)) throw error
error.resolution.status // 'unknown'
error.message // the reason and the candidate fields
}A lookup throws at once; only the data arrives as a promise.