Core Concepts04/06
Starting sandbox…
Beginner·4 graded tests

Glossary

Glossary

Terms that appear across the vault. Library-specific terms link to their note.

Python data stack

Array: see ndarray. A fixed-size, homogeneously-typed, n-dimensional block of memory plus a shape and strides.

Axis: a dimension of an array. axis=0 is rows (down), axis=1 is columns (across). See Axes and Reductions.

Broadcasting: automatic expansion of array shapes so elementwise operations work on mismatched shapes without copying. See Broadcasting.

Copy-on-Write (CoW): pandas 3.0 semantics where every indexing result behaves as an independent copy, with the actual copy deferred until a write. See Copy-on-Write.

dtype: the element type of an array or Series (int64, float32, str, category). See NumPy dtypes, pandas dtypes.

Index: the row labels of a pandas object. Not a position. See Index Objects.

ufunc: a NumPy universal function: elementwise, compiled, broadcasting-aware. See ufuncs.

Vectorization: expressing a loop as a whole-array operation so it runs in compiled code. See Vectorization.

View: an array sharing memory with another. Writing to it changes the original. See Views vs Copies.

Plotting

Artist: any drawable matplotlib object: a line, a text, an Axes, the Figure itself. See Matplotlib Artists.

Axes: one plotting panel (confusingly, not "axis"). A Figure holds many Axes. See Figure and Axes.

Figure-level function: a seaborn function that creates and owns its own Figure (relplot, catplot, displot). See Figure-level vs Axes-level.

Facet: a small-multiples grid, one panel per subset. See Faceting.

Sequences and biology

Accession: a versioned database identifier, e.g. NM_000546.6, NC_000017.11. The version suffix matters; sequences change between versions.

CDS: coding sequence: the ATG-to-stop portion of a transcript.

Contig / scaffold: an assembled sequence fragment; in practice, anything in your reference FASTA that is not a primary chromosome.

FASTA / FASTQ: sequence without / with per-base quality. See Applied - FASTA and FASTQ Workflows.

GFF / GTF: feature annotation formats, 1-based closed. See Applied - GFF and Genomic Intervals.

MSA: multiple sequence alignment. See AlignIO.

Phred score: Q = -10 log10(P_error), stored as ASCII with an offset of 33. Q30 = 1 error in 1000.

Reference assembly: GRCh37 (hg19) or GRCh38 (hg38). Coordinates are not comparable between them without liftover.

SeqRecord: Biopython's sequence-plus-metadata container. See SeqRecord.

VCF: variant call format, 1-based. See Applied - Reading VCF with pandas.

Variants and nomenclature

Allele frequency (AF): proportion of chromosomes in a population carrying the alternate allele.

AssemblyMapper: the hgvs class that projects variants between g., c., n. and p. for a chosen assembly. See AssemblyMapper.

c. / g. / n. / p. / m.: HGVS reference-sequence types: coding DNA, genomic, non-coding RNA, protein, mitochondrial. See HGVS Nomenclature.

HGVS: Human Genome Variation Society; also the nomenclature standard they publish, and the Python library implementing it. See biocommons hgvs.

Left/right shifting: moving an ambiguously-placed indel to the most 5' or most 3' equivalent position. VCF convention is left; HGVS convention is 3'-most (right, on the transcript). Source of endless confusion. See hgvs Normalizer.

Normalization: rewriting a variant into a canonical form so equivalent variants compare equal. See hgvs Normalizer.

Projection: mapping a variant from one reference sequence to another (genome ↔ transcript ↔ protein). See Projection c to g to p.

SeqRepo: biocommons' local, immutable, versioned sequence store. See SeqRepo.

UTA: Universal Transcript Archive: the PostgreSQL database of transcript–genome alignments that hgvs queries. See UTA and Data Providers.

VRS: Variation Representation Specification (GA4GH). A computed, hash-based identifier scheme for variants. The successor concept to string-matching variants; worth knowing about after you master HGVS.

Data modelling

Long / wide: see Tidy Data.

Observational unit: the thing one row represents. Mixing two in one table is the classic tidiness violation.

Split-apply-combine: the grouped-computation pattern. See Split-Apply-Combine.

See also

START HERE · Map of Content · Ecosystem Map

Exercise

Write resolve(queries), where queries is a list of raw query strings, one per input line. Build two dictionaries in your own code: a term table mapping each canonical term to its category, and an alias table mapping a shorthand or spelling variant to a canonical term. Normalise every query by lowercasing it, stripping it, and collapsing runs of internal whitespace to a single space, then look the alias table up first and the term table second. Skip any query that is empty after normalisation.

The term table holds broadcasting and dtype in numpy; copy-on-write and index in pandas; artist and facet in matplotlib; accession and phred score in sequences; allele frequency and normalization in variants; and observational unit in modelling. The alias table maps cow to copy-on-write, af to allele frequency, and normalisation to normalization. Emit <canonical term> -> <category> for a query you resolve, and <query> -> unknown for one you do not, printing the unresolved query stripped of surrounding whitespace but otherwise exactly as it was given. Finish with one line resolved=<n> unknown=<n>, which is printed even when every input line was blank.

exerciseEvery submission runs independently in a fresh namespace.

Test cases · 4

#viainputexpected stdout
1stdinBroadcasting CoW AF Phred Score observational unit broadcasting -> numpy copy-on-write -> pandas allele frequency -> variants phred score -> sequences observational unit -> modelling resolved=5 unknown=0
2stdinnormalisation Normalization projection dtype normalization -> variants normalization -> variants projection -> unknown dtype -> numpy resolved=3 unknown=1
3stdin seqrepo INDEX seqrepo -> unknown index -> pandas resolved=1 unknown=1
4stdin resolved=0 unknown=0

Hints · 3

01Hint

`' '.join(raw.lower().split())` lowercases, strips and collapses internal whitespace in one step.

02Hint

Resolve the alias first, then the canonical term: `key = ALIASES.get(key, key)` leaves a non-alias untouched.

03Hint

The unknown branch reports the query as the user wrote it, so keep the original string around rather than printing the normalised key.