#!/bin/bash
data_files=(
  "manifest_guest.json" \
  "dengue_all_tree.json" "dengue_all_meta.json" \
  "dengue_denv1_tree.json" "dengue_denv1_meta.json" \
  "dengue_denv2_tree.json" "dengue_denv2_meta.json" \
  "dengue_denv3_tree.json" "dengue_denv3_meta.json" \
  "dengue_denv4_tree.json" "dengue_denv4_meta.json" \
  "ebola_tree.json" "ebola_meta.json" \
  "lassa_s_tree.json" "lassa_s_meta.json" \
  "lassa_l_tree.json" "lassa_l_meta.json" \
  "measles_tree.json" "measles_meta.json" \
  "mers_tree.json" "mers_meta.json" \
  "mumps_global_tree.json" "mumps_global_meta.json" \
  "mumps_na_tree.json" "mumps_na_meta.json" \
  "WNV_NA_tree.json" "WNV_NA_meta.json" \
  "zika_tree.json" "zika_meta.json" \
  "flu_avian_h7n9_ha_tree.json" "flu_avian_h7n9_ha_meta.json" \
  "flu_avian_h7n9_mp_tree.json" "flu_avian_h7n9_mp_meta.json" \
  "flu_avian_h7n9_na_tree.json" "flu_avian_h7n9_na_meta.json" \
  "flu_avian_h7n9_np_tree.json" "flu_avian_h7n9_np_meta.json" \
  "flu_avian_h7n9_ns_tree.json" "flu_avian_h7n9_ns_meta.json" \
  "flu_avian_h7n9_pa_tree.json" "flu_avian_h7n9_pa_meta.json" \
  "flu_avian_h7n9_pb1_tree.json" "flu_avian_h7n9_pb1_meta.json" \
  "flu_avian_h7n9_pb2_tree.json" "flu_avian_h7n9_pb2_meta.json" \
  "flu_seasonal_h3n2_ha_2y_tree.json" "flu_seasonal_h3n2_ha_2y_meta.json" "flu_seasonal_h3n2_ha_2y_tip-frequencies.json" \
  "flu_seasonal_h3n2_ha_3y_tree.json" "flu_seasonal_h3n2_ha_3y_meta.json" "flu_seasonal_h3n2_ha_3y_tip-frequencies.json" \
  "flu_seasonal_h3n2_ha_6y_tree.json" "flu_seasonal_h3n2_ha_6y_meta.json" "flu_seasonal_h3n2_ha_6y_tip-frequencies.json" \
  "flu_seasonal_h3n2_ha_12y_tree.json" "flu_seasonal_h3n2_ha_12y_meta.json" "flu_seasonal_h3n2_ha_12y_tip-frequencies.json" \
  "flu_seasonal_h3n2_na_2y_tree.json" "flu_seasonal_h3n2_na_2y_meta.json" "flu_seasonal_h3n2_na_2y_tip-frequencies.json" \
  "flu_seasonal_h3n2_na_3y_tree.json" "flu_seasonal_h3n2_na_3y_meta.json" "flu_seasonal_h3n2_na_3y_tip-frequencies.json" \
  "flu_seasonal_h3n2_na_6y_tree.json" "flu_seasonal_h3n2_na_6y_meta.json" "flu_seasonal_h3n2_na_6y_tip-frequencies.json" \
  "flu_seasonal_h3n2_na_12y_tree.json" "flu_seasonal_h3n2_na_12y_meta.json" "flu_seasonal_h3n2_na_12y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_ha_2y_tree.json" "flu_seasonal_h1n1pdm_ha_2y_meta.json" "flu_seasonal_h1n1pdm_ha_2y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_ha_3y_tree.json" "flu_seasonal_h1n1pdm_ha_3y_meta.json" "flu_seasonal_h1n1pdm_ha_3y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_ha_6y_tree.json" "flu_seasonal_h1n1pdm_ha_6y_meta.json" "flu_seasonal_h1n1pdm_ha_6y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_ha_12y_tree.json" "flu_seasonal_h1n1pdm_ha_12y_meta.json" "flu_seasonal_h1n1pdm_ha_12y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_ha_pandemic_tree.json" "flu_seasonal_h1n1pdm_ha_pandemic_meta.json" "flu_seasonal_h1n1pdm_ha_pandemic_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_na_2y_tree.json" "flu_seasonal_h1n1pdm_na_2y_meta.json" "flu_seasonal_h1n1pdm_na_2y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_na_3y_tree.json" "flu_seasonal_h1n1pdm_na_3y_meta.json" "flu_seasonal_h1n1pdm_na_3y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_na_6y_tree.json" "flu_seasonal_h1n1pdm_na_6y_meta.json" "flu_seasonal_h1n1pdm_na_6y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_na_12y_tree.json" "flu_seasonal_h1n1pdm_na_12y_meta.json" "flu_seasonal_h1n1pdm_na_12y_tip-frequencies.json" \
  "flu_seasonal_h1n1pdm_na_pandemic_tree.json" "flu_seasonal_h1n1pdm_na_pandemic_meta.json" "flu_seasonal_h1n1pdm_na_pandemic_tip-frequencies.json" \
  "flu_seasonal_vic_ha_2y_tree.json" "flu_seasonal_vic_ha_2y_meta.json" "flu_seasonal_vic_ha_2y_tip-frequencies.json" \
  "flu_seasonal_vic_ha_3y_tree.json" "flu_seasonal_vic_ha_3y_meta.json" "flu_seasonal_vic_ha_3y_tip-frequencies.json" \
  "flu_seasonal_vic_ha_6y_tree.json" "flu_seasonal_vic_ha_6y_meta.json" "flu_seasonal_vic_ha_6y_tip-frequencies.json" \
  "flu_seasonal_vic_ha_12y_tree.json" "flu_seasonal_vic_ha_12y_meta.json" "flu_seasonal_vic_ha_12y_tip-frequencies.json" \
  "flu_seasonal_vic_na_2y_tree.json" "flu_seasonal_vic_na_2y_meta.json" "flu_seasonal_vic_na_2y_tip-frequencies.json" \
  "flu_seasonal_vic_na_3y_tree.json" "flu_seasonal_vic_na_3y_meta.json" "flu_seasonal_vic_na_3y_tip-frequencies.json" \
  "flu_seasonal_vic_na_6y_tree.json" "flu_seasonal_vic_na_6y_meta.json" "flu_seasonal_vic_na_6y_tip-frequencies.json" \
  "flu_seasonal_vic_na_12y_tree.json" "flu_seasonal_vic_na_12y_meta.json" "flu_seasonal_vic_na_12y_tip-frequencies.json" \
  "flu_seasonal_yam_ha_2y_tree.json" "flu_seasonal_yam_ha_2y_meta.json" "flu_seasonal_yam_ha_2y_tip-frequencies.json" \
  "flu_seasonal_yam_ha_3y_tree.json" "flu_seasonal_yam_ha_3y_meta.json" "flu_seasonal_yam_ha_3y_tip-frequencies.json" \
  "flu_seasonal_yam_ha_6y_tree.json" "flu_seasonal_yam_ha_6y_meta.json" "flu_seasonal_yam_ha_6y_tip-frequencies.json" \
  "flu_seasonal_yam_ha_12y_tree.json" "flu_seasonal_yam_ha_12y_meta.json" "flu_seasonal_yam_ha_12y_tip-frequencies.json" \
  "flu_seasonal_yam_na_2y_tree.json" "flu_seasonal_yam_na_2y_meta.json" "flu_seasonal_yam_na_2y_tip-frequencies.json" \
  "flu_seasonal_yam_na_3y_tree.json" "flu_seasonal_yam_na_3y_meta.json" "flu_seasonal_yam_na_3y_tip-frequencies.json" \
  "flu_seasonal_yam_na_6y_tree.json" "flu_seasonal_yam_na_6y_meta.json" "flu_seasonal_yam_na_6y_tip-frequencies.json" \
  "flu_seasonal_yam_na_12y_tree.json" "flu_seasonal_yam_na_12y_meta.json" "flu_seasonal_yam_na_12y_tip-frequencies.json" \
  "enterovirus_d68_genome_meta.json" "enterovirus_d68_genome_tree.json" \
  "enterovirus_d68_vp1_meta.json" "enterovirus_d68_vp1_tree.json" \
)

rm -rf data/
mkdir -p data/
for i in "${data_files[@]}"
do
  curl http://data.nextstrain.org/${i} --compressed -o data/${i}
done

echo "The local data directory ./data now contains up-to-date datasets from http://data.nextstrain.org"
