Species and data groups
Species is the first data boundary. Start with the explicit oncoref.human,
oncoref.dog (alias oncoref.canine), and oncoref.mouse modules, then use a named dataset or a conceptual collection.
Human, dog/canine, and mouse expose the same groups: references,
expression, cancer, antigens, normalization, governance, and legacy, and all three target_selection() catalogs expose deterministic representative_transcripts.
A known species does not imply that every group has data or complete coverage.
import oncoref
dog = oncoref.dog # symmetric alias for oncoref.canine
dog.references.datasets()
dog.expression.sources(context="normal")
dog.target_selection_coverage() # evaluated genome-wide CanFam3.1 catalog (20,082 PEGs)
dog.cta_candidates() # 14 curated canine literature nominations (also on human and mouse)
human = oncoref.human
human.expression.sources() # existing human registry
from oncoref import barkbase, human_protein_atlas
human_protein_atlas.rna_consensus()
barkbase.source() # metadata and native measurement contract, without a download
# With verified assets in the cache or configured overrides:
matrix = dog.barkbase.read(offline=True)
assert dog.barkbase is barkbase
Explicit species and dataset modules (1.9.4)
Species and datasets are ordinary, explicitly declared Python modules. They work with direct imports and editor completion; no species/source string is needed to read a named dataset. The species modules reference the same dataset modules that are available at the package root, sharing readers, caches and provenance.
Dataset module under oncoref |
Species module | Main operations |
|---|---|---|
human_protein_atlas |
human |
rna_consensus(), normal_tissue(), single_cell(), cancer_rna_prevalence(), cancer_ihc_prevalence() |
bgee_srp009687 |
canine |
source(), read() — gene TPM |
bgee_srp181218 |
canine |
source(), read() — gene TPM |
barkbase |
canine |
source(), read() — gene TMM-CPM |
pfizer_canine_protein |
canine |
source(), read() — pooled protein-group iBAQ |
doga, pfizer_canine_rna, gse304066 |
canine |
source() describes the gap; read() fails with its recorded reason |
For example, from oncoref.canine import barkbase and
from oncoref import barkbase return the same module. All canine read() functions
accept offline, cache_root, local_overrides and max_bytes as keyword
arguments. Their species and source are fixed; callers cannot override them.
HPA's existing native table/query signatures remain available under the full
dataset name, including tissue resolution and assay limitations.
human.datasets and canine.datasets list the named dataset modules;
inventory() describes the full species catalog, including sources that do not
yet have a dedicated module. groups contains the conceptual inventory/coverage
views. Imports do not load matrices or fetch assets.
The existing for_species(...) helper and registry IDs remain available for
dynamic callers, CLI input and serialized provenance. Historical flat human APIs,
oncoref.hpa and oncoref.hpa_cancer continue to work. oncoref.mouse exposes a
pinned Ensembl 115 GRCm39 host reference (mouse.references.registered_references()),
a genome-wide multi-assay target catalog (mouse.target_selection(): 21,433 PEGs,
8 in vivo CTAs, 30 CA only, 303 RA only), curated P1A (Trap1a) somatic
counterevidence, and zero human fallback.
The direct species methods cta_candidates(), cta_evidence(),
cta_gene_ids(reference=...), and cta_snapshot() expose a common evidence
contract. See species CTA evidence for native units,
reference mappings, coverage limits and offline replay.
oncoref species
oncoref species dog
oncoref data list --species dog --group expression
oncoref expression-sources --species dog --context normal
Both listings default to human when --species is omitted; canine and dog
select the same species. The table output identifies the species, groups related
datasets/sources and wraps to the terminal width. Narrow terminals use labeled
records where a table would not fit. Source cancer-code lists are never truncated.
Pending expression imports show their acquisition status and read limitation;
an empty selection returns a successful, explicit empty result.
oncoref data list --species canine --json
oncoref expression-sources --species canine --json
--json returns full inventory/source records, including measurement contracts for
expression sources. Listing checks local presence only, without downloading or
verifying bytes. Use data status --species canine for hash verification.
Canine listings honor --cache-root and --asset-overrides as well as their
environment-variable equivalents. Human per-sample matrix availability is shown
as a local/registered cohort count.
The existing flat APIs, cache paths and data bundle retain their historical human
behavior. Their default is not a claim of species independence. The new species
collections never substitute HPA, human cancer facts or human CTA membership for
missing dog/mouse facts. Unknown species fail explicitly. catalog.inventory()
defaults to human and adds species, taxon_id, and group to each row;
catalog.inventory(species="dog") selects only dog facts. Availability describes
registered/local data, not complete normal-tissue or antigen coverage.
Expression contracts
ExpressionSource.expression_contract returns versioned, immutable metadata:
- Species, source ID/version, normal/tumor/cell-line/mixed/unknown biological scope.
- The shared
ReferenceIdentity(taxon, assembly, annotation, namespaces, hashes), or an explicit absent reference withunresolved/legacy_humanstatus. - Measured feature level (
gene,transcript,promoter,protein,protein_group, orunknown), native unit, scale and proxy status. - Source asset SHA-256s, provenance notes and ordered transformations, including their unit changes, assumptions and input/output feature counts.
A verified reference is an explicit source declaration supported by provenance;
syntax/digest checks alone cannot establish the correct biological reference.
Historical human rows use legacy_human; missing historical reference/feature
information is not reconstructed by guessing. They remain readable by existing
APIs. Nonhuman sources must declare their contract explicitly.
ExpressionContract.as_dict() / from_dict() provide strict JSON round trips,
version/digest verification and unknown-field rejection. The contract_id
fingerprints all metadata, so new derived artifacts must include it in their cache
identity. Existing human bundle fingerprints and replay are unchanged.
validate_expression_join(left, right) requires verified, matching species,
references, namespaces and measured feature levels. A directed,
checksum-supported ReferenceCrosswalk can authorize an annotation join between
different references within one species. It preserves one-to-many alternatives
and unresolved IDs. It does not authorize abundance allocation. With
combine_values=True, matching references and complete identical measurement
semantics are mandatory; joins do not infer missing values as zero.
contract.require_feature_level("transcript") rejects gene or promoter totals.
Exact protein identity also cannot establish individual isoform abundance.
Native counts, CPM, ERCC-normalized counts, FPKM, TPM, pseudo-TPM and iBAQ retain
their unit labels; transformations never turn a proxy into a measured quantity.
Staged canine support (1.9.0 foundation)
Version 1.9.0 established species collections, source/measurement contracts and join
validation without inferring CTA membership from raw source registration alone. Full
genome-wide canine (20,082 CanFam3.1 PEGs, 118 CTAs) and murine (21,433
GRCm39 PEGs, 8 in vivo CTAs) multi-assay screening builds on top of these
contracts in Cross-species target selection and comparative host contexts.
Pinned canine references (1.9.1)
dog.references.registered_references() exposes RefSeq GCF_011100685.1 /
annotation 106 and Ensembl CanFam3.1 / release 98 (GCA_000002285.2). The
former pins genome, GTF, CDS, RNA, complete annotated protein FASTA and feature
table; the latter pins GTF and peptide FASTA. Different assemblies/annotations
remain different reference identities. Registration does not claim a complete
validated translation subset or establish quantification-reference equivalence.
dog.references.registered_crosswalks() and dog.references.crosswalk(source_id,
target_id, feature_level=...) expose four directed, SHA-256-backed
ReferenceCrosswalk records (refseq106 ↔ ensembl98 at protein and gene
feature levels: 16,445 exact full-length amino-acid protein pairs across 10,230
shared sequences and 9,095 exact-protein-backed gene pairs). Paralog/multi-locus
alternatives remain intact, unmapped IDs stay unresolved, symbol/orthology matches
are excluded, and ExpressionDataset.join_annotations(other, crosswalk=...)
performs directed annotation joins without allocating or summing abundance.
reference, paths = dog.references.ensure_reference(
"refseq106", offline=True,
local_overrides={"9615:refseq106-genome": "/existing/genome.fna.gz",
# supply each reference asset or reuse its managed cache
},
)
# One asset, online if absent; an explicit transfer budget is required for large files:
path = dog.references.ensure("ensembl98-gtf", max_bytes=25_000_000)
Local overrides use taxon_id:asset_id keys and are verified in place, without
copying or overwriting the original. ONCOREF_ASSET_OVERRIDES can point to a JSON
mapping of those keys to paths. ONCOREF_ASSET_CACHE selects the datacache root;
the default uses datacache's oncoref application directory, partitioned by taxon,
group and content digest. Existing human cache locations are unchanged.
Native expression readers detect compression from file contents, so renamed files and extensionless symlinks work without changing the pinned bytes. This also applies to generic source-matrix imports and bundled CSV reads (since 1.9.6).
oncoref data metadata refseq106-gtf --species dog
oncoref data status references --species dog --asset-overrides /path/to/overrides.json
oncoref data fetch ensembl98-gtf --species dog --offline --asset-overrides /path/to/overrides.json
status, path, and offline replay verify the pinned size and SHA-256. Inventory
listing only checks local presence and reports integrity: not_checked. Online
fetches use datacache's atomic publication and bounded HTTP resume on POSIX;
other platforms, including Windows, use verified non-resumable downloads. The
default total transfer budget is 100 MiB (--max-bytes to change it). Reference fetches check
the total missing bytes before starting. An invalid override fails even online;
managed-cache corruption is automatically repaired by online fetches (no
--force needed) but fails offline. Failed transfers never replace the cached
file with unverified bytes. The wheel
contains small manifests only, with upstream URLs, byte pins and source terms.
Native canine expression (1.9.2)
dataset = dog.bgee_srp181218.read(
offline=True,
local_overrides={"9615:bgee-srp181218-matrix": "/existing/bgee-srp181218.tsv.gz"},
)
dataset.values # source features × libraries; missing remains NaN
dataset.features # original IDs/aliases; no human canonicalization
dataset.samples # tissues, donor scope, pooling, runs, original facts/evidence
dataset.contract # gene TPM; quantification reference explicitly unresolved
dataset.tissue_summary() # native values + measured-library/known-donor coverage
path = dataset.save("new-artifact-directory")
from oncoref.species_expression import ExpressionDataset
replayed = ExpressionDataset.load(path) # offline file/digest/contract verification
| Source ID | Native feature space | Unit | Source libraries |
|---|---|---|---|
bgee-srp009687 |
Ensembl source gene IDs | TPM | 13 |
bgee-srp181218 |
Ensembl source gene IDs | TPM | 75 |
barkbase |
All 37,149 StringTie gene rows, retaining Ensembl/symbol annotations | TMM-CPM | 150 |
Bgee's sparse gene/library rows remain missing where absent. BarkBase retains all source features, including unannotated StringTie IDs and ambiguous annotation strings; no length proxy or feature filter is applied. Exact quantification references remain unresolved for these sources, so cross-reference joins and cross-source abundance combination remain blocked by their contracts.
Sample metadata preserves source fields, BioSample/run provenance and unknown
age/sex/health/treatment/pooling facts. Five Bgee SRP181218 colon labels are corrected
to heart using BioSample source_name, with both labels, a correction reason and
source hashes retained. Donors are scoped to their study. BarkBase adult donor
labels follow the source columns and the publication's five-adult design;
embryonic donor identities and matrix-column-to-run mappings remain unresolved.
Pooled observations never contribute multiple independent donors. A zero count
of known donors means unresolved coverage, not proof that no animals exist.
dog.expression.lineage_overlaps() exposes the 46 shared runs between the global
Bgee inventory and BarkBase's RNA-seq inventory. This is inventory-level lineage;
it does not assert overlap of the two imported Bgee matrices or resolve BarkBase
column-to-run mappings. combine_expression() rejects known reused runs,
unresolved run lineage, unresolved reference identities and incompatible units.
Saved artifacts include all feature/sample facts, the expression contract and
checksummed Parquet/JSON files. New destinations are published atomically; existing
results are not overwritten. The artifact identity changes with its metadata or
file contents. scripts/build_canine_source_manifests.py replays the intake from
an acquired source snapshot; no downstream package is imported at runtime.
The builder loads pinned reference registrations from the installed OncoRef
package and creates the output directory as needed. For a separate replay:
python scripts/build_canine_source_manifests.py \
--source-root /path/to/acquisition-snapshot \
--output /tmp/canine-manifests
No seed files need copying into the destination.
Canine protein abundance and explicit gaps (1.9.3)
dog.pfizer_canine_protein.read(...) consumes the released ORFdata
pfizer-atlas-dog-protein generation 2026-10-12.1. Install
oncoref[quantitative] on Python 3.11+ for managed quantitative reads. The core
package and portable exports continue to work on Python 3.10 without ORFdata.
The reader retains the deposited IBAQ column from MassIVE MSV000099744,
ProteinGroup and representative
Protein identifiers, source run/channel/sample fields, and missing measurements.
The real table contains 9,929 reported groups across 38 tissue pools. This is bulk
protein-group evidence; resolving those groups to complete sequences or genes
requires additional evidence. It does not establish MHC presentation.
The source methods describe tissue
pooling and weighted iBAQ allocation across TMT channels. Every imported canine
sample is marked pooled, with unresolved individual donors; summaries therefore
cannot report independent donor detection. The exact deposited searched FASTA is
available as dog.references.ensure("pfizer-dog-search-fasta", ...) and its SHA-256
is also carried in the protein source contract. It is not assigned a guessed
assembly/annotation identity. Protein data and searched sequence bytes stay outside
the wheel. The processed download is 84,379,381 bytes and occupies 1,404,428,288
bytes installed. It reuses ORFdata's managed cache; ordinary reads never fetch
the vendor database or optional peptide evidence. The old and new imports are
the same experiment and cannot supply independent biological support.
pip install 'oncoref[quantitative]'
oncoref data metadata pfizer-dog-protein --species dog
oncoref data fetch pfizer-dog-protein --species dog
oncoref data path pfizer-dog-protein --species dog
The existing high-level API is unchanged:
from oncoref import for_species
from oncoref.species_expression import ExpressionDataset
data = for_species("dog").expression.read("pfizer-dog-protein", offline=True)
matrix = data.values
source_manifest = data.provenance["manifest"]
first_native_record = next(data.native_records("measurements"))
data.save("dog-expression-export")
replayed = ExpressionDataset.load("dog-expression-export")
native_records(kind) streams samples, assays, measurements,
reference_mappings, mappings, relations, or pairings. These records use
the producer's declared schema and retain original identifiers, source row and
column, native text, quantities, reference identities, and mapping uncertainty.
The archive contains all 626,526 source measurements (iBAQ and rIBAQ); the matrix
selects native iBAQ without aggregation. Eight explicit missing iBAQ records and
64,039 absent matrix cells remain distinguishable through the records. The 9,929
reported representative mappings remain unresolved. The summary release has no
peptide assignments or assay pairings; empty iterators do not establish absence.
Exports with records use a checksummed, streamed version-2 archive and can replay offline without ORFdata or a source cache. Matrix-only version-1 exports remain readable. Source records do not allocate group abundance to a representative or turn bulk proteomics into presentation evidence. Optional peptide enrichment is tracked separately in #585.
Use cache_root consistently across ORFdata and OncoRef to select a shared cache.
A local override maps 9615:pfizer-atlas-dog-protein to the released
dataset.sqlite; the reader verifies its pinned size, checksum, and manifest.
Optional peptide assignments use the same ExpressionDataset interface:
data.evidence_sources() # bundled release pins and transfer/install sizes; no download
enriched = data.with_evidence(
"pfizer-dog-peptide-evidence",
feature_ids=["A0A5F4CET6"], # explicit native summary groups
offline=True,
)
assignments = list(enriched.native_records("mappings"))
memberships = list(enriched.native_records("relations"))
enriched.save("protein-with-selected-assignments")
The optional dataset is ORFdata pfizer-atlas-dog-peptide-evidence, generation
2026-10-27.1. It transfers 6,896,030,151 bytes and occupies 24,710,258,688 bytes
installed. Acquisition is an explicit operation through the existing data manager:
oncoref data metadata pfizer-dog-peptide-evidence --species dog
oncoref data fetch pfizer-dog-peptide-evidence --species dog --max-bytes 6896030151
with_evidence() defaults to offline use and a zero transfer budget. To acquire
through that method, set offline=False and an adequate max_bytes; alternatively
provide the exact released SQLite file as the override
9615:pfizer-atlas-dog-peptide-evidence. Ordinary matrix reads remain summary-only.
The default max_records=50000 bounds the selected assignment records; choose
fewer features or explicitly raise it for a larger export. All companion
candidates remain present when selecting one representative, including reported
parent sets that differ from sequence-compatible candidates. Native group
memberships retain all members.
The producer's reconciled summary index connects accession-like summary groups to distinct numeric native groups. This is same-study representative context, not a unique attribution of the group's iBAQ. Values, missingness, the measurement contract, tissue summaries and donor counts do not change. Search-reference compatibility does not establish protein detection or MHC presentation.
provenance["enrichment"] records the selected features, native summary contexts,
full source/reference/artifact pins and assignment record IDs. Reported mappings
also retain their original native record and all reported links/endpoints under
provenance["oncoref_native_context"], including confidence and exclusion fields.
Binary native fields use {"__oncoref_native__": "bytes", "base64": ...};
integers outside JSON's exact 53-bit range use "integer" with decimal text;
nonfinite doubles use "float64" with little-endian IEEE-754 hexadecimal bytes.
These encodings preserve raw facts without silently interpreting source QC flags.
The portable artifact retains these records and replays without ORFdata. Its
fingerprint changes with the selected evidence. Re-enrichment requires starting
from the original snapshot, so repeated calls cannot duplicate evidence.
Historical raw TSV overrides are source-audit inputs, not quantitative reader inputs. A missing offline cache, corrupt override, changed source/reference, or incompatible producer release fails before returning a matrix.
The expression source catalog also exposes these explicit gaps:
| Source | Scope/status | Missing requirement |
|---|---|---|
doga |
normal, metadata only | Complete quantitative gene/promoter matrix and its feature semantics |
pfizer-dog-rna |
normal, metadata only | Canine RNA matrices and sample/feature/reference reconciliation |
gse304066-osteosarcoma |
tumor, blocked provenance | Resolve raw-count versus FPKM descriptions and exact annotation |
Their pinned metadata/supplement files remain inspectable/fetchable, while native matrix reads fail with the recorded reason before attempting any download:
dog.doga.metadata_samples(...),tissue_enriched_genes(...), andtissue_enriched_promoters(...)parse the SHA-256-pinned DoGA supplement archive (463STRT2 canine libraries,22,758categorical gene calls, and17,841categorical promoter calls) while keeping promoter and gene scopes separate and ERCC-normalized signals distinct from transcript TPM.dog.pfizer_canine_rna.series_metadata(...)parses the pinned GEOGSE325523series record documenting the multi-species batch design (9541,9615,10090,10116) and humanized-Entrez supplementary matrices.dog.gse304066.reconciled_samples()anddog.gse304066.provenance_audit()return the packaged offline audit of all26independentCOTC-030primary osteosarcoma dogs (GSM9142582–GSM9142607) and document whyGSE304066_all_sample_raw_count.txt.gzcontains RSEM v1.3.1 two-decimalexpected_countvalues (30,186fractional cells, library sums17.94M–27.50M) rather than integer raw counts or FPKM, withCanFam4_4/_3/_2symbol suffixes kept outside admittedReferenceCrosswalks.
Native units remain unknown for these expression registrations; no TPM normalization is fabricated. The osteosarcoma pseudo-TPM scenarios remain sensitivity analyses, outside admitted normalized expression cohorts.
Cross-species target selection and comparative host contexts
See the multi-species antigen whitepaper and the
interactive antigen explorer for the complete per-species
parameterization of human (9606), canine (9615), and murine (10090) datasets,
comparative anatomy, the mutually exclusive 4-way sex-restriction partition
(RA-M/CTA-M, RA-F/CTA-F, RA-P/CTA-P, RA-MF/CTA-MF), cross-species
ortholog concordance, and native nomination ledgers.
oncoref.antigens, oncoref.species_policies, and oncoref.species_target_selection
apply one mathematical three-stage process across human (9606, 19,893 protein groups, 322 CTAs),
dog (9615, 20,082 protein groups, 118 CTAs across 19 spontaneous patient cohorts + 12 cell lines)
and mouse (10090, 21,433 protein groups, 8 in vivo CTAs across 14 in vivo cohorts + 9 cell lines)
without transferring human expression, safety verdicts, or threshold calibrations by orthology:
- Reference proteome & identical-sequence protein grouping:
Collapses identical qualified amino-acid translations within one verified genome
reference into protein-equivalence groups while preserving every annotated isoform
sequence for 9-mer
Unsafecontainment (>=95%) and host self-proteome subtraction. - Multi-modal normal-tissue safety & symmetric
10×in vivo enrichment: Evaluates native expression, single-cell UMI, and protein assays in their own units, enforces uniform<= 2.5%olfactory-receptor gDNA library QC and monogenic chemosensory GPCR holds, and requires symmetric>= 10 × max(Normal N, Disposable D, 1)in vivo tumor (CA) and reproductive/embryonic (RA) enrichment, while tracking pure in vitro cancer cell lines separately as an experimental model reference. - Comparative-anatomy host protection:
Derives species-applicable reproductive, mammary, thymic, and disposable
compartments from
normal-tissue-taxonomy.yaml(for example, canine lacks seminal vesicles and appendix and includesuterine_horn; mouse includescoagulating_glandanduterine_hornand lacks appendix and palatine tonsil).
from oncoref import antigens, canine, human, mouse
antigens.summary() # Cross-species overview across human, dog, and mouse
dog_ctas = antigens.table("CTA", species="dog", sex="female", absent=("ovary", "uterus"))
mouse_ctas = antigens.table("CTA", species="mouse", ectopic_only=True)
antigens.explain("PRAME", species="dog")
human.target_selection_coverage()
canine.target_selection_coverage()
mouse.target_selection_coverage()
On the CLI, oncoref antigens summary, list, explain, funnel, and subtract
accept --species (human, dog/canine, or mouse) and --sex {female,male}.
All three species evaluate native genome-wide catalogs without borrowing expression or
safety calls across species.