| Title: | Look Up APB Result Fields by Meaning |
|---|---|
| Description: | Looks up the fields of AnnData Proteomics Bridge (APB) results by meaning, such as a PEP or an unnormalized intensity, without naming vendor columns. Reimplements the apb-catalog API on the bundle apb-catalog releases: reviewed catalogues, apb2's rule levels and expected answers. Reads APB results, as h5ad, Parquet or DuckDB, into anndataR objects. |
| Authors: | Witold E. Wolski [aut] (ORCID: <https://orcid.org/0000-0002-6468-120X>), Witek Wolski [cre] |
| Maintainer: | Witek Wolski <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.0 |
| Built: | 2026-11-03 19:50:17 UTC |
| Source: | https://github.com/BiocStaging/apbCatalogR |
Read a var or obs slot by several keys
## S3 method for class 'Columns' x[i, ...]## S3 method for class 'Columns' x[i, ...]
x |
A var or obs slot of a level. |
i |
Keys, or the level's own names. |
... |
Ignored. |
A data frame of every column the names name; the names without data.
Read a slot by key
## S3 method for class 'Slot' x[[i, ...]]## S3 method for class 'Slot' x[[i, ...]]
x |
A Slot. |
i |
A key, or the level's own name. |
... |
Ignored. |
A matrix for layers, a vector for var and obs; a name without data.
Answers from the catalogue alone, without data. The rule levels whose version
pattern admits the version give the levels; the set's entries for that
pattern give each level's fields. levels have the slots of a
DataCatalog's levels, holding names: a slot answers one of the set's keys,
such as "normalized_intensity", with the field's name, and its $get()
takes further qualifiers, such as unit. Lookups that several fields answer,
or that an unreviewed level cannot, signal UnresolvedField.
The class generator; Catalog$new() returns a Catalog.
levelsOne level per rule level, with a DataCatalog's slots holding names.
descriptionWhat this catalogue set holds and who uses it.
Catalog$new()Bind a catalogue set to the rule levels of one software version.
Catalog$new(software, version, catalog, enforce = NULL)
softwareThe software name, such as "DIA-NN".
versionThe software version, such as "2.2.0".
catalogThe catalogue set, such as "abundance" or
"confidence"; see catalogues().
enforceNULL, "MUST" or "SHOULD": signal
MissingRequiredField when a field the set requires at that
strength is missing.
Catalog$fields()Every catalogued field the rule declares, one row per
field, as catalogue_table() shows them.
Catalog$fields()
A data frame, with present true for each row.
Catalog$print()Print the set and the levels.
Catalog$print(...)
...Ignored.
Catalog$clone()The objects of this class are cloneable with this method.
Catalog$clone(deep = FALSE)
deepWhether to make a deep clone.
catalog <- Catalog$new("DIA-NN", "2.2.0", "abundance") catalog$levels$peptidoform_ion$layers[["intensity"]] catalog$levels$peptidoform_ion$layers$keys()catalog <- Catalog$new("DIA-NN", "2.2.0", "abundance") catalog$levels$peptidoform_ion$layers[["intensity"]] catalog$levels$peptidoform_ion$layers$keys()
Reports the bundle lookups answer from: its version, whether it was shipped
with the package or downloaded by update_catalog(), and the apb2 version
its rule levels come from.
catalog_version()catalog_version()
A list with version, origin ("shipped" or "cache"), path
and apb2_version.
catalog_version()catalog_version()
One row per entry and software version it applies to, as apb-catalog table
prints it.
catalogue_table(catalogue = NULL)catalogue_table(catalogue = NULL)
catalogue |
One set's name; |
A data frame with columns set, source (the conversion software,
an app or annotation:<convention>), software_version_pattern (NA for
an entry of every software version), level, location, table, name
(prefix:<prefix> for a field found by column-name prefix), key, kind,
one qualifier.<name> column per other qualifier, requirement and
entry_id.
head(catalogue_table("confidence"))head(catalogue_table("confidence"))
Every catalogue set of the bundle with its purpose, its users and its number of entries.
catalogues()catalogues()
A data frame with columns catalogue, purpose, used_by (a list
column), has_requirements and entries.
catalogues()catalogues()
Answers on a result read with read_parsed_levels() and hands the data back
directly: levels give each level's slots, looked up by one of the set's
keys, such as "q_value" or Sage's "quantification_q_value". Ambiguous or
unreviewed answers signal UnresolvedField.
The class generator; DataCatalog$new() returns a DataCatalog.
levelsOne Level per level of the result, with anndataR's slots looked up by key.
descriptionWhat this catalogue set holds and who uses it.
DataCatalog$new()Bind catalogue sets to the levels of one result; apb,
APB's own fields, is always in.
DataCatalog$new(result, ..., enforce = NULL)
resultA ParsedLevels object.
...The catalogue sets, such as "abundance" and
"confidence"; see catalogues().
enforceNULL, "MUST" or "SHOULD": signal
MissingRequiredField when a field a set requires at that strength
is missing.
DataCatalog$fields()Every catalogued field of the result in every composed
set, one row per field, as catalogue_table() shows them.
DataCatalog$fields()
A data frame with present and, for a field apb2 left out
because it held one value, that constant.
DataCatalog$print()Print the set and the levels.
DataCatalog$print(...)
...Ignored.
DataCatalog$clone()The objects of this class are cloneable with this method.
DataCatalog$clone(deep = FALSE)
deepWhether to make a deep clone.
results <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) result <- read_parsed_levels( file.path(results, "maxquant_wide-peptidoform_ion.parquet") ) catalog <- DataCatalog$new(result, "confidence") dim(catalog$levels$peptidoform_ion$layers[["pep"]]) catalog$levels$peptidoform_ion$layers$name("pep")results <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) result <- read_parsed_levels( file.path(results, "maxquant_wide-peptidoform_ion.parquet") ) catalog <- DataCatalog$new(result, "confidence") dim(catalog$levels$peptidoform_ion$layers[["pep"]]) catalog$levels$peptidoform_ion$layers$name("pep")
The R counterpart of apb2's ParsedLevels, as read_parsed_levels() returns
it.
Each level is an anndataR AnnData laid out as apb2's .h5ad writer lays it
out: the primary layer in X, the other layers in layers, obs and var
frames named by their key columns, and the level's APB part in uns$apb:
parse (with provenance$rule_json), roles, storage and post-parse
records.
The class generator; ParsedLevels$new() returns a ParsedLevels
object.
levelsA named list of anndataR AnnData, one per level.
unsThe root parse record.
metadataThe root post-parse records, such as sdrf or fasta.
hierarchyHow the levels nest, or NULL.
annotation_tablesA named list of data frames; each carries its
metadata as the attribute apb.
feature_relationsA named list of data frames of source, row,
target, column and value; each carries its metadata as the attribute
apb.
ParsedLevels$new()Collect the levels and records of one result.
ParsedLevels$new( levels, uns = list(), metadata = list(), hierarchy = NULL, annotation_tables = list(), feature_relations = list() )
levelsA named list of anndataR AnnData.
unsThe root parse record.
metadataThe root post-parse records.
hierarchyHow the levels nest, or NULL.
annotation_tablesA named list of data frames.
feature_relationsA named list of data frames.
ParsedLevels$print()Print the levels and their shapes.
ParsedLevels$print(...)
...Ignored.
ParsedLevels$clone()The objects of this class are cloneable with this method.
ParsedLevels$clone(deep = FALSE)
deepWhether to make a deep clone.
results <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) result <- read_parsed_levels(file.path(results, "edge-two-levels.parquet")) names(result$levels) result$levels$proteinresults <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) result <- read_parsed_levels(file.path(results, "edge-two-levels.parquet")) names(result$levels) result$levels$protein
Reads a result apb2 wrote into a ParsedLevels object, one anndataR
AnnData per level, the same for every format: a .h5ad file, a .duckdb
file, or the directory apb2 writes for a .parquet result. Reading Parquet
needs the arrow package, DuckDB the duckdb and DBI packages; .h5ad
needs nothing beyond anndataR.
read_parsed_levels(path)read_parsed_levels(path)
path |
The result, such as |
A ParsedLevels object.
results <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) read_parsed_levels(file.path(results, "edge-two-levels.parquet"))results <- tempfile() archive <- system.file( "extdata", "test-bundle", "results.tar.gz", package = "apbCatalogR" ) utils::untar(archive, exdir = results) read_parsed_levels(file.path(results, "edge-two-levels.parquet"))
One row per catalogued or required field of each rule level the set reviews;
a set without vendor catalogues is checked against every level the bundle's
entries name for each version of versions.csv. A set with requirements
judges each level: fail when a MUST field is unsupported, warn when a
SHOULD or MAY field is, pass otherwise.
rule_coverage(catalogue)rule_coverage(catalogue)
catalogue |
The set's name. |
A data frame with columns software, version (the label),
software_version_pattern, level, key, kind, qualifiers (the other
qualifiers as name=value), origin, producer (the app, NA for the
conversion software's fields), requirement, location, table, column
(NA when unsupported), needs (what to run before the field exists) and
verdict (NA for a set without requirements).
head(rule_coverage("abundance"))head(rule_coverage("abundance"))
Downloads the bundle of an apb-catalog release from GitHub into the user cache, so lookups use it without a package update. Later sessions keep using the newest bundle, shipped or downloaded. It works from the next apb-catalog release, the first to ship the bundle.
update_catalog(version = NULL)update_catalog(version = NULL)
version |
The apb-catalog release, such as |
The catalog_version() now in use, invisibly.
if (interactive()) { update_catalog() }if (interactive()) { update_catalog() }