#!/bin/bash
# Run all optimal_dose phenotypes GWAS with regenie_dosages method
# 310 optimal_dose phenotypes (continuous)

PHENOTYPES=(
  "ondansetron__optimal_dose"
  "tinzaparin__optimal_dose"
  "sumatriptan__optimal_dose"
  "almotriptan__optimal_dose"
  "midazolam__optimal_dose"
  "moclobemide__optimal_dose"
  "cilostazol__optimal_dose"
  "fentanyl__optimal_dose"
  "terazosin__optimal_dose"
  "selegiline__optimal_dose"
  "flecainide__optimal_dose"
  "verapamil__optimal_dose"
  "lurasidone__optimal_dose"
  "fondaparinux__optimal_dose"
  "doxepin__optimal_dose"
  "bupropion__optimal_dose"
  "flunarizine__optimal_dose"
  "rizatriptan__optimal_dose"
  "hydroflumethiazide__optimal_dose"
  "cannabidiol__optimal_dose"
  "edoxaban__optimal_dose"
  "thioridazine__optimal_dose"
  "nalmefene__optimal_dose"
  "modafinil__optimal_dose"
  "nicardipine__optimal_dose"
  "riluzole__optimal_dose"
  "lithium__optimal_dose"
  "tadalafil__optimal_dose"
  "oxycodone__optimal_dose"
  "flupentixol__optimal_dose"
  "diazepam__optimal_dose"
  "carvedilol__optimal_dose"
  "olmesartan__optimal_dose"
  "valsartan__optimal_dose"
  "eletriptan__optimal_dose"
  "ivabradine__optimal_dose"
  "citalopram__optimal_dose"
  "donepezil__optimal_dose"
  "varenicline__optimal_dose"
  "nifedipine__optimal_dose"
  "escitalopram__optimal_dose"
  "frovatriptan__optimal_dose"
  "colestipol__optimal_dose"
  "domperidone__optimal_dose"
  "midodrine__optimal_dose"
  "cabergoline__optimal_dose"
  "colestyramine__optimal_dose"
  "pentazocine__optimal_dose"
  "captopril__optimal_dose"
  "cinnarizine__optimal_dose"
  "clopidogrel__optimal_dose"
  "lisdexamfetamine__optimal_dose"
  "pericyazine__optimal_dose"
  "apomorphine__optimal_dose"
  "pethidine__optimal_dose"
  "nitrazepam__optimal_dose"
  "trandolapril__optimal_dose"
  "dalteparin__optimal_dose"
  "melatonin__optimal_dose"
  "ranolazine__optimal_dose"
  "tolfenamic_acid__optimal_dose"
  "methadone__optimal_dose"
  "zopiclone__optimal_dose"
  "ropinirole__optimal_dose"
  "ciprofibrate__optimal_dose"
  "zolmitriptan__optimal_dose"
  "ramipril__optimal_dose"
  "tetradecyl_sulphate__optimal_dose"
  "xipamide__optimal_dose"
  "orlistat__optimal_dose"
  "metoprolol__optimal_dose"
  "naloxone__optimal_dose"
  "acipimox__optimal_dose"
  "piracetam__optimal_dose"
  "naratriptan__optimal_dose"
  "losartan__optimal_dose"
  "torasemide__optimal_dose"
  "amiloride__optimal_dose"
  "granisetron__optimal_dose"
  "prazosin__optimal_dose"
  "rutosides__optimal_dose"
  "bumetanide__optimal_dose"
  "reboxetine__optimal_dose"
  "levomepromazine__optimal_dose"
  "haloperidol__optimal_dose"
  "ethosuximide__optimal_dose"
  "fluoxetine__optimal_dose"
  "mirtazapine__optimal_dose"
  "amisulpride__optimal_dose"
  "lacosamide__optimal_dose"
  "nicotinic_acid__optimal_dose"
  "furosemide__optimal_dose"
  "pizotifen__optimal_dose"
  "amiodarone__optimal_dose"
  "metolazone__optimal_dose"
  "caffeine__optimal_dose"
  "warfarin__optimal_dose"
  "nefopam__optimal_dose"
  "meclozine__optimal_dose"
  "levetiracetam__optimal_dose"
  "gabapentin__optimal_dose"
  "pramipexole__optimal_dose"
  "imipramine__optimal_dose"
  "omega_3_acid__optimal_dose"
  "vortioxetine__optimal_dose"
  "eprosartan__optimal_dose"
  "labetalol__optimal_dose"
  "hydrochlorothiazide__optimal_dose"
  "perindopril__optimal_dose"
  "isometheptene__optimal_dose"
  "rivastigmine__optimal_dose"
  "nimodipine__optimal_dose"
  "colesevelam__optimal_dose"
  "topiramate__optimal_dose"
  "dextropropoxyphene__optimal_dose"
  "nadolol__optimal_dose"
  "hydromorphone__optimal_dose"
  "tetrabenazine__optimal_dose"
  "galantamine__optimal_dose"
  "primidone__optimal_dose"
  "risperidone__optimal_dose"
  "perampanel__optimal_dose"
  "phenindione__optimal_dose"
  "venlafaxine__optimal_dose"
  "rotigotine__optimal_dose"
  "phenobarbital__optimal_dose"
  "aliskiren__optimal_dose"
  "bosentan__optimal_dose"
  "ibuprofen__optimal_dose"
  "benzatropine__optimal_dose"
  "disopyramide__optimal_dose"
  "apixaban__optimal_dose"
  "dabigatran__optimal_dose"
  "lercanidipine__optimal_dose"
  "eplerenone__optimal_dose"
  "lorazepam__optimal_dose"
  "sulpiride__optimal_dose"
  "promethazine__optimal_dose"
  "prochlorperazine__optimal_dose"
  "aprepitant__optimal_dose"
  "dronedarone__optimal_dose"
  "amitriptyline__optimal_dose"
  "oxazepam__optimal_dose"
  "pregabalin__optimal_dose"
  "phenylephrine__optimal_dose"
  "timolol__optimal_dose"
  "orphenadrine__optimal_dose"
  "loprazolam__optimal_dose"
  "acamprosate__optimal_dose"
  "isosorbide_mononitrate__optimal_dose"
  "clonidine__optimal_dose"
  "bisoprolol__optimal_dose"
  "clobazam__optimal_dose"
  "rosuvastatin__optimal_dose"
  "moxonidine__optimal_dose"
  "tryptophan__optimal_dose"
  "phenelzine__optimal_dose"
  "pindolol__optimal_dose"
  "sildenafil__optimal_dose"
  "paroxetine__optimal_dose"
  "tranylcypromine__optimal_dose"
  "oxcarbazepine__optimal_dose"
  "morphine__optimal_dose"
  "aspirin__optimal_dose"
  "diamorphine__optimal_dose"
  "cyclizine__optimal_dose"
  "telmisartan__optimal_dose"
  "clomipramine__optimal_dose"
  "duloxetine__optimal_dose"
  "sacubitril__optimal_dose"
  "acebutolol__optimal_dose"
  "benperidol__optimal_dose"
  "phenoxybenzamine__optimal_dose"
  "betahistine__optimal_dose"
  "tramadol__optimal_dose"
  "imidapril__optimal_dose"
  "felodipine__optimal_dose"
  "acenocoumarol__optimal_dose"
  "chlortalidone__optimal_dose"
  "nebivolol__optimal_dose"
  "minoxidil__optimal_dose"
  "chlorothiazide__optimal_dose"
  "fluphenazine__optimal_dose"
  "mexiletine__optimal_dose"
  "propranolol__optimal_dose"
  "spironolactone__optimal_dose"
  "rivaroxaban__optimal_dose"
  "disulfiram__optimal_dose"
  "pentosan__optimal_dose"
  "doxazosin__optimal_dose"
  "tolcapone__optimal_dose"
  "olanzapine__optimal_dose"
  "amlodipine__optimal_dose"
  "flurazepam__optimal_dose"
  "metoclopramide__optimal_dose"
  "paracetamol__optimal_dose"
  "ezetimibe__optimal_dose"
  "valproic_acid__optimal_dose"
  "methylphenidate__optimal_dose"
  "dosulepin__optimal_dose"
  "fluvastatin__optimal_dose"
  "rufinamide__optimal_dose"
  "lamotrigine__optimal_dose"
  "meptazinol__optimal_dose"
  "vigabatrin__optimal_dose"
  "candesartan__optimal_dose"
  "procyclidine__optimal_dose"
  "ephedrine__optimal_dose"
  "atenolol__optimal_dose"
  "irbesartan__optimal_dose"
  "lofepramine__optimal_dose"
  "nortriptyline__optimal_dose"
  "enoxaparin__optimal_dose"
  "pentoxifylline__optimal_dose"
  "nicotine__optimal_dose"
  "ticagrelor__optimal_dose"
  "pyridoxine__optimal_dose"
  "brivaracetam__optimal_dose"
  "levodopa__optimal_dose"
  "levomenthol__optimal_dose"
  "nicorandil__optimal_dose"
  "trazodone__optimal_dose"
  "simvastatin__optimal_dose"
  "alprazolam__optimal_dose"
  "tiagabine__optimal_dose"
  "moxisylyte__optimal_dose"
  "zolpidem__optimal_dose"
  "dimenhydrinate__optimal_dose"
  "digoxin__optimal_dose"
  "gemfibrozil__optimal_dose"
  "atomoxetine__optimal_dose"
  "buprenorphine__optimal_dose"
  "heparin__optimal_dose"
  "tranexamic_acid__optimal_dose"
  "phenytoin__optimal_dose"
  "glyceryl_trinitrate__optimal_dose"
  "agomelatine__optimal_dose"
  "methyldopa__optimal_dose"
  "fluvoxamine__optimal_dose"
  "codeine__optimal_dose"
  "dihydrocodeine__optimal_dose"
  "triamterene__optimal_dose"
  "naltrexone__optimal_dose"
  "trihexyphenidyl__optimal_dose"
  "asenapine__optimal_dose"
  "chlordiazepoxide__optimal_dose"
  "clonazepam__optimal_dose"
  "indapamide__optimal_dose"
  "chloral_hydrate__optimal_dose"
  "clozapine__optimal_dose"
  "sotalol__optimal_dose"
  "mianserin__optimal_dose"
  "adrenaline__optimal_dose"
  "fosinopril__optimal_dose"
  "dexamfetamine__optimal_dose"
  "dipyridamole__optimal_dose"
  "hyoscine__optimal_dose"
  "tapentadol__optimal_dose"
  "hydralazine__optimal_dose"
  "clomethiazole__optimal_dose"
  "memantine__optimal_dose"
  "bromazepam__optimal_dose"
  "prasugrel__optimal_dose"
  "zuclopenthixol__optimal_dose"
  "propafenone__optimal_dose"
  "benserazide__optimal_dose"
  "lormetazepam__optimal_dose"
  "dipipanone__optimal_dose"
  "enalapril__optimal_dose"
  "paliperidone__optimal_dose"
  "diltiazem__optimal_dose"
  "carbamazepine__optimal_dose"
  "eslicarbazepine__optimal_dose"
  "carbidopa__optimal_dose"
  "trifluoperazine__optimal_dose"
  "isocarboxazid__optimal_dose"
  "quinidine__optimal_dose"
  "naftidrofuryl__optimal_dose"
  "buspirone__optimal_dose"
  "aripiprazole__optimal_dose"
  "fenofibrate__optimal_dose"
  "rasagiline__optimal_dose"
  "bezafibrate__optimal_dose"
  "temazepam__optimal_dose"
  "ketamine__optimal_dose"
  "quetiapine__optimal_dose"
  "sertraline__optimal_dose"
  "entacapone__optimal_dose"
  "bendroflumethiazide__optimal_dose"
  "promazine__optimal_dose"
  "valproate__optimal_dose"
  "botulinum__optimal_dose"
  "indoramin__optimal_dose"
  "pimozide__optimal_dose"
  "quinapril__optimal_dose"
  "lidocaine__optimal_dose"
  "cloral_betaine__optimal_dose"
  "amantadine__optimal_dose"
  "perphenazine__optimal_dose"
  "celiprolol__optimal_dose"
  "ergotamine__optimal_dose"
  "atorvastatin__optimal_dose"
  "isosorbide_dinitrate__optimal_dose"
  "chlorpromazine__optimal_dose"
  "nabilone__optimal_dose"
  "zonisamide__optimal_dose"
  "lacidipine__optimal_dose"
  "trimipramine__optimal_dose"
  "lisinopril__optimal_dose"
  "pravastatin__optimal_dose"
)

echo "Starting optimal_dose GWAS analysis (${#PHENOTYPES[@]} phenotypes) - submitting every 30s"
echo "========================================"

for pheno in "${PHENOTYPES[@]}"; do
  echo "$(date '+%H:%M:%S') Submitting: $pheno"
  ./manhattan.sh --phenotype "$pheno" --method regenie_dosages --tag optimal_dose --covariates all &
  sleep 30
done

echo "========================================"
echo "All optimal_dose phenotypes submitted!"
echo "========================================"
