# STRchive disease-associated STR loci track (part of strVar supertrack)
# 2026-03-12 (max)

# Data from STRchive (https://strchive.org/), CC BY 4.0
# Paper: Hiatt et al. Genome Med 2025, PMID 40140942
# 75 disease-associated tandem repeat expansion loci
# Curated from published literature by the Dashnow lab

# Source: downloaded from GitHub
mkdir -p /hive/data/genomes/hg38/bed/str/strchive
cd /hive/data/genomes/hg38/bed/str/strchive
wget https://raw.githubusercontent.com/dashnowlab/STRchive/refs/heads/main/data/catalogs/STRchive-disease-loci.hg38.general.bed

# Convert to BED9+ format (colored by inheritance mode)
python3 ~/kent/src/hg/makeDb/scripts/strchive/strchiveToBed.py \
    STRchive-disease-loci.hg38.general.bed > strchive.bed 2>/dev/null

# Sort and convert to bigBed
bedSort strchive.bed strchive.bed
bedToBigBed strchive.bed /hive/data/genomes/hg38/chrom.sizes strchive.bb \
    -type=bed9+ -tab -as=$HOME/kent/src/hg/makeDb/scripts/strchive/strchive.as

# Symlink into /gbdb (under webstr/ directory with other STR tracks)
ln -sf /hive/data/genomes/hg38/bed/str/strchive/strchive.bb /gbdb/hg38/webstr/strchive.bb

# trackDb: strchive track is inside the strVar supertrack
# trackDb entry: ~/kent/src/hg/makeDb/trackDb/human/hg38/webstr.ra
# HTML doc: ~/kent/src/hg/makeDb/trackDb/human/hg38/strchive.html

# Load trackDb
cd ~/kent/src/hg/makeDb/trackDb
make DBS=hg38

#############################################################################
# STRchive is now an otto track, on hg19/hg38/hs1
# 2026-09-04 (max)

# Everything above is history. STRchive now builds a Genome Browser bigBed for
# every release and publishes it on their GitHub releases page, so there is no
# conversion left to do on our side - see dashnowlab/STRchive#333. An otto job
# checks weekly for a new release and repoints the /gbdb symlinks at it:

#   kent/src/hg/utils/otto/strchive/       script, makefile, README
#   /hive/data/outside/otto/strchive/      where it runs, and where the data lives
#   otto.crontab                           45 7 * * 1

# Do not rebuild by hand. To force an update or roll back:
#   /hive/data/outside/otto/strchive/strchiveOtto.py --force
#   /hive/data/outside/otto/strchive/strchiveOtto.py --release v2.26.1

# Their release ships hg19, hg38 and T2T-chm13 (= hs1) files and we take all
# three, so the track is on three assemblies now. The trackDb stanza moved from
# human/hg38/strVar.ra to human/strVar.ra and uses $D in the bigDataUrls, so
# hgTrackDb -strict gives each assembly only the strVar members whose file is
# actually there. strVar.html and strchive.html moved up to human/ with it.

# /gbdb/<db>/strVar/strchive.bb -> the otto releases dir, one symlink per db
# /gbdb/<db>/strVar/strchive.version.txt is what the dataVersion setting shows

# The new trackDb is alpha-only until the auto-push exists: without a cron
# copying /gbdb/*/strVar/ out to the RR, a released trackDb would promise data
# the RR does not have. human/strVarNew.ra is tagged alpha, human/hg38/strVar.ra
# is tagged beta,public and still describes the old hg38-only track. Release
# steps are in the header of strVarNew.ra. refs #38268
