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/kaplanImprintXlsxToTsv.py src/hg/makeDb/scripts/imprinting/kaplanImprintXlsxToTsv.py new file mode 100755 index 00000000000..3c98eda9196 --- /dev/null +++ src/hg/makeDb/scripts/imprinting/kaplanImprintXlsxToTsv.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +"""Dump the sheets we need from the Rosenski 2025 supplementary workbook +(41467_2025_57433_MOESM4_ESM.xlsx) to plain TSV files. + +Every sheet in that workbook has a one-line title in row 1, the column header in +row 2 and the data from row 3 on, so we skip row 1 and treat row 2 as the header. + +Usage: kaplanImprintXlsxToTsv.py <workbook.xlsx> <outDir> +""" +import sys, os, importlib.abc + +class _NoDefusedXml(importlib.abc.MetaPathFinder): + """openpyxl prefers defusedxml, but the defusedxml installed on hgwdev is not + compatible with this python/openpyxl combination and dies in iterparse. Hide + it so openpyxl falls back to the standard library ElementTree.""" + def find_spec(self, name, path=None, target=None): + if name.split(".")[0] == "defusedxml": + raise ImportError(name) + +sys.meta_path.insert(0, _NoDefusedXml()) +import openpyxl + +# sheet name in the workbook -> output file name +SHEETS = { + "S2. iDMR bimodal boundari" : "dataS2_icr.tsv", + "S3. ASM SNPs" : "dataS3_asmSnps.tsv", + "S4. Parental-ASM SNPs" : "dataS4_parentalAsmSnps.tsv", + "S10. All imprinted genes m" : "dataS10_imprintedGenes.tsv", + "S16. Escape of imprinting" : "dataS16_escape.tsv", + "Sheet24" : "dataS_gameteMeth.tsv", +} + +def main(): + xlsxFname, outDir = sys.argv[1], sys.argv[2] + os.makedirs(outDir, exist_ok=True) + wb = openpyxl.load_workbook(xlsxFname, read_only=True) + for sheetName, outName in SHEETS.items(): + ws = wb[sheetName] + outPath = os.path.join(outDir, outName) + rowCount = 0 + with open(outPath, "w") as ofh: + for i, row in enumerate(ws.iter_rows(values_only=True)): + if i == 0: # the sheet title line + continue + cells = ["" if c is None else str(c).strip() for c in row] + while cells and cells[-1] == "": # trailing empty columns + cells.pop() + if not cells: + continue + ofh.write("\t".join(c.replace("\t", " ") for c in cells) + "\n") + rowCount += 1 + print("%s: %d rows (incl. header) -> %s" % (sheetName, rowCount, outPath)) + +main()