a56d88e05670b759ff3b32829542537ccc790c57
lrnassar
  Tue Apr 28 19:18:20 2026 -0700
Address CR feedback on insight + tp53 hub scripts. refs #37418

Drop duplicated bash() wrappers in favor of subprocess.run / check_output
with list args, eliminating shell=True, embedded-quote concerns, and
stderr-into-stdout merging. Centralize common operations as
run_sort_bed/run_liftOver in tp53FuncLib alongside existing run_bedToBigBed.

Switch HTML escaping to stdlib html.escape() consistently. insightHCIPriors
mouseover (previously unescaped) now escapes HGVS fields, addressing the
specific c.123A>G case Jonathan flagged. Replace invalid </br> tags with
<br> across all five affected mouseover sites.

diff --git src/hg/makeDb/scripts/tp53/tp53ClinDomains.py src/hg/makeDb/scripts/tp53/tp53ClinDomains.py
index bb5622540bd..642a8da7c39 100644
--- src/hg/makeDb/scripts/tp53/tp53ClinDomains.py
+++ src/hg/makeDb/scripts/tp53/tp53ClinDomains.py
@@ -124,31 +124,31 @@
 def build(db, outdir):
     print("=== {} ===".format(db))
     tx = lib.get_transcript_info(db)
     print("  {} at {}:{}-{} {}".format(
         tx['name'], tx['chrom'], tx['txStart'], tx['txEnd'], tx['strand']))
     bed_lines = generate_bed(tx)
     print("  {} BED rows".format(len(bed_lines)))
 
     os.makedirs(outdir, exist_ok=True)
     as_file = os.path.join(outdir, "TP53clinDomains.as")
     lib.write_autosql(as_file, AUTOSQL)
 
     bed = os.path.join(outdir, "TP53clinDomains_{}.bed".format(db))
     with open(bed, 'w') as f:
         f.write("\n".join(bed_lines) + "\n")
-    lib.bash("sort -k1,1 -k2,2n {0} -o {0}".format(bed))
+    lib.run_sort_bed(bed)
 
     bb = os.path.join(outdir, "TP53clinDomains{}.bb".format(db.capitalize()))
     lib.run_bedToBigBed(bed, as_file, bb, lib.chrom_sizes_path(db), "bed9+5")
     print("  wrote {}".format(bb))
 
 
 def main():
     import argparse
     p = argparse.ArgumentParser(description=__doc__)
     p.add_argument('-o', '--output-dir', default=DEFAULT_OUTDIR)
     p.add_argument('--db', action='append',
                    help='Assembly db (hg38 or hg19); repeat for both. Default: hg38 only.')
     args = p.parse_args()
     dbs = args.db if args.db else ['hg38']
     for db in dbs: