28292a7173cf27b4da7f09b809a1d51aed180f15 max Fri Feb 24 11:06:41 2023 +0100 adding special case for hg38 to chromToUcsc, email from Hiram, no redmine diff --git src/utils/chromToUcsc/chromToUcsc src/utils/chromToUcsc/chromToUcsc index bc1f2d7..ad7b1e6 100755 --- src/utils/chromToUcsc/chromToUcsc +++ src/utils/chromToUcsc/chromToUcsc @@ -197,32 +197,35 @@ row[fieldIdx] = ucscChrom line = sep.join(row) ofh.write(line) ofh.write("\n") def download(db): " download chromAlias file from UCSC " # Genark assemblies are in a different directory of the download server if "_" in db: p1 = db[0:3] p2 = db[4:7] p3 = db[7:10] p4 = db[10:13] url = "https://hgdownload.soe.ucsc.edu/hubs/%s/%s/%s/%s/%s/%s.chromAlias.txt" % (p1, p2, p3, p4, db, db) + elif db in ["hg38"]: + # hg38 has been patched a few times, assume that the user wants the latest chromAlias file + url="https://hgdownload.soe.ucsc.edu/goldenPath/%s/bigZips/latest/%s.chromAlias.txt" % (db, db) else: - url = "http://hgdownload.soe.ucsc.edu/goldenPath/%s/database/chromAlias.txt.gz" % db + url = "https://hgdownload.soe.ucsc.edu/goldenPath/%s/database/chromAlias.txt.gz" % db data = urlopen(url).read() if url.endswith(".gz"): if 'cStringIO' in modules: data = StringIO(data) else: data = BytesIO(data) data = gzip.GzipFile(fileobj=data).read().decode() outFname = db+".chromAlias.tsv" open(outFname, "w").write(data) print("Wrote %s to %s" % (url, outFname)) print("You can now convert a file with 'chromToUcsc -a %s -i infile.bed -o outfile.bed'" % outFname)