  The orbital period ratios of neighbouring sub-Neptunes are distributed
asymmetrically near first-order resonances. There are deficits of
systems---"troughs" in the period ratio histogram---just short of
commensurability, and excesses---"peaks"---just wide of it. We reproduce
quantitatively the strongest peak-trough asymmetries, near the 3:2 and 2:1
resonances, using dissipative interactions between planets and their natal
discs. Disc eccentricity damping captures bodies into resonance and clears the
trough, and when combined with disc-driven convergent migration, draws planets
initially wide of commensurability into the peak. The migration implied by the
magnitude of the peak is modest; reductions in orbital period are $\sim$10\%,
supporting the view that sub-Neptunes complete their formation more-or-less in
situ. Once captured into resonance, sub-Neptunes of typical mass $\sim$$5$--$15
M_{\oplus}$ stay captured (contrary to an earlier claim), as they are immune to
the overstability that afflicts lower mass planets. Driving the limited,
short-scale migration is a gas disc depleted in mass relative to a
solar-composition disc by 3--5 orders of magnitude. Such gas-poor but not
gas-empty environments are quantitatively consistent with sub-Neptune core
formation by giant impacts (and not, e.g., pebble accretion). While disc-planet
interactions at the close of the planet formation era adequately explain the
3:2 and 2:1 asymmetries at periods $\gtrsim$ $5$--$15$ days, subsequent
modification by stellar tides appears necessary at shorter periods,
particularly for the 2:1.
