8548ce2dc690933cbc0ba86b02260401fdc1682e
angie
  Sun Apr 19 12:00:01 2020 -0700
Add timestamp to ncov.json filename since there can be interesting changes within a single day and we need to have reproducible analyses.  refs #25188

diff --git src/hg/utils/otto/nextstrainNcov/doUpdate.sh src/hg/utils/otto/nextstrainNcov/doUpdate.sh
index 1e19ac2..8f25ca2 100755
--- src/hg/utils/otto/nextstrainNcov/doUpdate.sh
+++ src/hg/utils/otto/nextstrainNcov/doUpdate.sh
@@ -14,36 +14,39 @@
 
 # The file is named .json, but is actually gzipped, so gunzip it.
 curl -s "$ncovJsonUrl" \
 | gunzip -c > ncov.json
 curl -s -I "$ncovJsonUrl" \
 | grep Last-Mod | sed -re 's/Last-Modified: //; s/\r//;' \
    > ncov.json.date
 latestDate=$(cat ncov.json.date)
 oldDate=$(cat old.ncov.json.date)
 if [ $(date -d "$latestDate" +%s) -le $(date -d "$oldDate" +%s)  ]; then
     exit 0
 fi
 
 today=`date +%F`
 mkdir -p $today
-cp -p ncov.json $today
+ncovTime=$(date -d "$latestDate" +%F-%H:%M)
+cp -p ncov.json $today/ncov.$ncovTime.json
 mv ncov.json old.ncov.json
 mv ncov.json.date old.ncov.json.date
 
 runDir=$ottoDir/$today
 cd $runDir
+chmod 444 ncov.$ncovTime.json
+ln -sf ncov.$ncovTime.json ncov.json
 
 #Generate bed and VCF files
 $ottoDir/nextstrain.py
 
 # bgzip & tabix the VCF files
 bgzip -f nextstrainSamples.vcf
 tabix -p vcf nextstrainSamples.vcf.gz
 for clade in A1a A2 A2a A3 A6 A7 B B1 B2 B4; do
   bgzip -f nextstrainSamples$clade.vcf
   tabix -p vcf nextstrainSamples$clade.vcf.gz
 done
 
 # bigBed-ify the gene names and "clades"
 bedToBigBed -type=bed4 -tab -verbose=0 nextstrainGene.bed $chromSizes \
     nextstrainGene.bb