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/kaplanLiftNote.py src/hg/makeDb/scripts/imprinting/kaplanLiftNote.py new file mode 100755 index 00000000000..07f38d7a323 --- /dev/null +++ src/hg/makeDb/scripts/imprinting/kaplanLiftNote.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +"""Flag regions that liftOver stretched across sequence added in hg38. + +liftOver maps the two ends of a region independently, so when hg38 inserted +sequence inside a region the lifted interval comes out much longer than the +original. These regions are still at the right locus, but their boundaries no +longer mean what they meant in hg19, so rather than dropping them or showing +them as if nothing happened, the size change is written into a note field. + +The input is the output of liftOver on a BED whose last column is +"<lineNumber>|<lengthBeforeLifting>". That column is replaced by the note. + +Usage: kaplanLiftNote.py <liftedBed> <outBed> [maxRatio] +""" +import sys + +liftedFname, outFname = sys.argv[1], sys.argv[2] +maxRatio = float(sys.argv[3]) if len(sys.argv) > 3 else 1.1 + +flagged = 0 +total = 0 +with open(outFname, "w") as ofh: + for line in open(liftedFname): + fields = line.rstrip("\n").split("\t") + oldLen = int(fields.pop().split("|")[1]) + newLen = int(fields[2]) - int(fields[1]) + ratio = float(newLen) / oldLen + total += 1 + # thickStart/thickEnd were copied from the hg19 coordinates by the + # BED writer, so reset them to the lifted ones + fields[6], fields[7] = fields[1], fields[2] + if ratio > maxRatio or ratio < 1.0 / maxRatio: + flagged += 1 + fields.append("region was %d bp on hg19 and is %d bp after lifting, " + "so its boundaries are not reliable" % (oldLen, newLen)) + else: + fields.append("") + ofh.write("\t".join(fields) + "\n") + +print(" %d regions, %d whose size changed by more than %.0f%% when lifted" + % (total, flagged, (maxRatio - 1) * 100))