691a2b8981d6db69e8707ea44041c4661cdac97e
max
  Wed Sep 9 06:38:29 2026 -0700
Imprinting: add the ASM Atlas tracks, and tidy the collection's labels

Adds a composite built from Rosenski et al. 2025, "Atlas of imprinted and
allele-specific DNA methylation in the human body". Three subtracks: the
458 regions whose methylation follows the parent of origin, the 72 known
control regions with the boundaries the paper redrew, and the pool of
385,235 regions carrying two methylation states that those came out of.
A fourth set, the regions whose methylation follows a nearby SNP, is
built by the scripts but its stanza is commented out, since sequence
driven methylation is not imprinting.

The authors released hg19 only, so all three are lifted. Their published
files are close to bare BED, so the SNPs, cell types, p-values, gene
links and gamete methylation on the details pages are read out of the
paper's supplementary tables and joined on by position. Regions that
lift but change length by more than 10%, because hg38 added sequence
inside them, are kept with a note rather than dropped: one of them is
TCEB3C, the only control region on chr18.

Also across the collection:
- long labels name their source right after "Imprinting", so that a
label read on its own says where the data came from
- the two gene catalogs are worded alike, and ordered OMIM, Geneimprint,
MethBase2, Akbari, ASM Atlas
- the OMIM curators confirmed that their (I) marker covers established
and candidate imprinted genes alike, with nothing in the export to
tell them apart. Labels, description page and makeDoc now say so, and
the claim that the set is "more conservative" than the computational
tracks is gone. The bigBed was rebuilt for the autoSql line, same 459
features.
- every subtrack page opens by naming the collection, linked back to
its hgTrackUi page, and no longer repeats the collection page's
introduction to imprinting

refs #37599

diff --git src/hg/makeDb/scripts/imprinting/kaplanIcrAddOrig.py src/hg/makeDb/scripts/imprinting/kaplanIcrAddOrig.py
new file mode 100755
index 00000000000..5669fff1c77
--- /dev/null
+++ src/hg/makeDb/scripts/imprinting/kaplanIcrAddOrig.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+"""Add the pre-revision boundaries of each imprinting control region to the ICR
+BED file, as a chrom:start-end string in the assembly of the BED file.
+
+This runs on the raw liftOver output, whose last column is the id that
+kaplanLiftNote.py still needs, so the new field is inserted before it.
+
+Both input files were lifted from hg19 with the same chain, so a control region
+whose old boundaries failed to lift gets an empty field.
+
+Usage: kaplanIcrAddOrig.py <icrBed> <origBed> <outBed>
+"""
+import sys
+
+icrFname, origFname, outFname = sys.argv[1], sys.argv[2], sys.argv[3]
+
+orig = {}
+for line in open(origFname):
+    chrom, start, end, name = line.rstrip("\n").split("\t")[:4]
+    orig[name] = "%s:%s-%s" % (chrom, int(start) + 1, end)
+
+missing = 0
+changed = 0
+with open(outFname, "w") as ofh:
+    for line in open(icrFname):
+        fields = line.rstrip("\n").split("\t")
+        name = fields[3]
+        if name not in orig:
+            missing += 1
+        origCoords = orig.get(name, "")
+        # the field is only worth showing where the revision moved a boundary
+        if origCoords == "%s:%d-%s" % (fields[0], int(fields[1]) + 1, fields[2]):
+            origCoords = ""
+        else:
+            changed += 1
+        fields.insert(len(fields) - 1, origCoords)
+        ofh.write("\t".join(fields) + "\n")
+
+print("    %d control regions had a boundary moved, %d have no lifted "
+      "pre-revision boundaries" % (changed, missing))