31e95f0d1dd4ca08feba9b081a356527bd4b45e6 markd Sat Sep 26 20:36:20 2026 -0700 Drop the hand-built Files column from the TSS faceted tables. refs #35528 UCSC will generate the download links in the faceted table, so the Files column each composite built for itself is redundant. Remove downloadCell, the Files header and cell, the Files entry in subtrackUrls, and the DOWNLOAD constant that only fed them. The table is now Tissue, Sample class, Experiment, Cell line on all three composites. writeMetadata no longer needs db or track; the metadata files it writes are byte-identical. Lead each Data Access section with the link to the hgdownload directory, since that is now the way to a single file, and keep the naming convention beside it. Drop the paragraph describing the Files column. diff --git src/hg/makeDb/outside/proCapNet/proCapNetTrackDb src/hg/makeDb/outside/proCapNet/proCapNetTrackDb index d775d21bb93..fabe4c2976a 100755 --- src/hg/makeDb/outside/proCapNet/proCapNetTrackDb +++ src/hg/makeDb/outside/proCapNet/proCapNetTrackDb @@ -10,121 +10,104 @@ composite child, but hui.c compositeUiSubtracks() walks descendant leaves, so under a plain composite the multiWig is flattened away and never drawn. A faceted composite is routed to facetedCompositeUi() instead, which builds its rows from metaDataUrl and leaves the multiWig intact. fiberSeqCompendium is the same pattern. Subtrack names are __, which is how the faceted UI maps a table cell to a track. """ import argparse import json from pycbio.sys import cli, fileOps from pycbio.tsv import TsvReader GBDB = "/gbdb/{db}/{track}" -DOWNLOAD = "https://hgdownload.soe.ucsc.edu/gbdb/{db}/{track}/$$" SAMPLE_CLASS_DESC = "Cancer = cell line derived from a tumor" # Deliberately outside the Okabe-Ito palette the cell lines use. Sharing a hue # with a cell line makes a track's color read as its sample class: A673 is a # cancer line and draws in #0072B2, which was the Non-cancer swatch. SAMPLE_CLASS_COLORS = {"Cancer": "#000000", "Non-cancer": "#808080"} def parseArgs(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("db") parser.add_argument("experimentsTsv") parser.add_argument("outRa") parser.add_argument("gbdbDir", help="/gbdb directory holding the track directories, where " "the metadata and color files are written") return cli.parseOptsArgsWithLogging(parser) def stanza(indent, lines): pad = " " * indent return "".join(pad + line + "\n" for line in lines) + "\n" -def downloadCell(db, track, exp): - """The Files column, one comma-separated token per bigWig. - - Each token is path|label: the path substitutes into the subtrackUrls $$ and - the label is what the cell shows, so the table offers a named link per file - rather than a bare file name.""" - if track == "proCapNet": - files = [(f"pred/{exp.cell}.proCapNet.pos.bw", "+ strand"), - (f"pred/{exp.cell}.proCapNet.neg.bw", "- strand")] - if db == "hg38": - files.append((f"contrib/{exp.cell}.proCapNet-contrib.bw", "contribution")) - else: - files = [(f"{exp.cell}.{exp.procapAcc}.pos.bw", "+ strand"), - (f"{exp.cell}.{exp.procapAcc}.neg.bw", "- strand")] - return ",".join(f"{path}|{label}" for path, label in files) - -def writeMetadata(path, experiments, accField, db, track): +def writeMetadata(path, experiments, accField): """The cell line table shown on the faceted track UI page. A plain column name gets facet checkboxes, a leading underscore means searchable and sortable but not faceted. facetedComposite.js only offers a facet value that occurs more than once, so Sample_class is the only column worth faceting: cell, tissue and accession are unique per row and would each draw six checkboxes that match one row apiece. Cell_line is the primaryKey, so it names the tracks and is shown as its own column; there is no second column repeating the cell name. Column names are underscore separated because toTitleStyle() in facetedComposite.js turns an underscore into a space but does not split camelCase. A header cell may carry a description after a "|", shown behind an info icon.""" fileOps.ensureFileDir(path) with fileOps.AtomicFileOpen(path) as fh: - print(f"_Tissue\tSample_class|{SAMPLE_CLASS_DESC}\tExperiment\tFiles\tCell_line", + print(f"_Tissue\tSample_class|{SAMPLE_CLASS_DESC}\tExperiment\tCell_line", file=fh) for exp in experiments: print(f"{exp.tissue}\t{exp.sampleClass}\t{getattr(exp, accField)}\t" - f"{downloadCell(db, track, exp)}\t{exp.cell}", file=fh) + f"{exp.cell}", file=fh) def writeColors(path): "swatches beside the facet checkboxes, keyed by the faceted column name" fileOps.ensureFileDir(path) with fileOps.AtomicFileOpen(path) as fh: json.dump({"Sample_class": SAMPLE_CLASS_COLORS}, fh, indent=4) print(file=fh) def superStanza(): return stanza(0, [ "track transcriptionStart", "superTrack on show", "shortLabel Transcription Initiation (TSS)", "longLabel Transcription initiation (TSS)", "group rna", ]) def compositeStanza(db, track, shortLabel, longLabel, dataTypes, accUrl, priority): gbdb = GBDB.format(db=db, track=track) return stanza(4, [ f"track {track}", "parent transcriptionStart", "compositeTrack faceted", "type bigWig", f"shortLabel {shortLabel}", f"longLabel {longLabel}", f"metaDataUrl {gbdb}/metadata.tsv", f"colorSettingsUrl {gbdb}/colors.json", "primaryKey Cell_line", f"dataTypes {dataTypes}", - f"subtrackUrls Experiment={accUrl} Files={DOWNLOAD.format(db=db, track=track)}", + f"subtrackUrls Experiment={accUrl}", "defaultSortField Cell_line", "maxCheckboxes 50", "noInherit on", "visibility hide", f"priority {priority}", ]) def strandOverlay(db, composite, exp, dataType, subDir, fileTag, shortLabel, longLabel, childLabel, priority): """One cell line's two strands as an overlay, plus strand drawn up and minus strand drawn down. The ProCapNet minus-strand files hold positive values and are flipped with negateValues; the ENCODE minus-strand signal is already negative and is not flipped. fileTag is the part of the file name that says what the file holds, so a @@ -221,29 +204,27 @@ f"{exp.cell} PRO-cap transcription start sites, plus strand up and minus strand down", f"{exp.cell} PRO-cap transcription start sites", priority) return out def proCapNetTrackDb(opts, args): experiments = list(TsvReader(args.experimentsTsv)) fileOps.ensureFileDir(args.outRa) with fileOps.AtomicFileOpen(args.outRa) as fh: print(f"# Generated by hg/makeDb/outside/proCapNet/proCapNetTrackDb for {args.db}.", file=fh) print("# Do not edit by hand, edit the script and regenerate.\n", file=fh) fh.write(superStanza()) if args.db == "hg38": fh.write(encode4ProCapComposite(args.db, experiments)) fh.write(proCapNetComposite(args.db, experiments)) - writeMetadata(f"{args.gbdbDir}/proCapNet/metadata.tsv", experiments, "modelAcc", - args.db, "proCapNet") + writeMetadata(f"{args.gbdbDir}/proCapNet/metadata.tsv", experiments, "modelAcc") writeColors(f"{args.gbdbDir}/proCapNet/colors.json") if args.db == "hg38": - writeMetadata(f"{args.gbdbDir}/encode4ProCap/metadata.tsv", experiments, "procapAcc", - args.db, "encode4ProCap") + writeMetadata(f"{args.gbdbDir}/encode4ProCap/metadata.tsv", experiments, "procapAcc") writeColors(f"{args.gbdbDir}/encode4ProCap/colors.json") def main(): opts, args = parseArgs() with cli.ErrorHandler(noStackExcepts=(OSError, cli.PycbioException)): proCapNetTrackDb(opts, args) main()