#!/bin/bash

set -e

cascade design -d ctrl.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -t targets/Photoreceptor_cells.h5ad --pool targets/Photoreceptor_cells.txt -o model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-42.csv -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-42.pt --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --design-size 3 --design-scale-bias --target-weight weight --n-devices 1 --log-subdir design/target=Photoreceptor_cells-size=3-sd=42 --random-seed 42 -v
cascade design -d ctrl.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -t targets/Photoreceptor_cells.h5ad --pool targets/Photoreceptor_cells.txt -o model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-43.csv -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-43.pt --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --design-size 3 --design-scale-bias --target-weight weight --n-devices 1 --log-subdir design/target=Photoreceptor_cells-size=3-sd=43 --random-seed 43 -v
cascade design -d ctrl.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -t targets/Photoreceptor_cells.h5ad --pool targets/Photoreceptor_cells.txt -o model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-44.csv -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-44.pt --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --design-size 3 --design-scale-bias --target-weight weight --n-devices 1 --log-subdir design/target=Photoreceptor_cells-size=3-sd=44 --random-seed 44 -v
cascade design -d ctrl.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -t targets/Photoreceptor_cells.h5ad --pool targets/Photoreceptor_cells.txt -o model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-45.csv -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-45.pt --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --design-size 3 --design-scale-bias --target-weight weight --n-devices 1 --log-subdir design/target=Photoreceptor_cells-size=3-sd=45 --random-seed 45 -v

python ctfact_prep.py --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-42.csv --output model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-42.h5ad
python ctfact_prep.py --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-43.csv --output model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-43.h5ad
python ctfact_prep.py --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-44.csv --output model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-44.h5ad
python ctfact_prep.py --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-45.csv --output model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-45.h5ad

cascade counterfactual -d model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-42.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-42.pt -p model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-42.h5ad --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --sample -v
cascade counterfactual -d model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-43.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-43.pt -p model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-43.h5ad --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --sample -v
cascade counterfactual -d model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-44.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-44.pt -p model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-44.h5ad --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --sample -v
cascade counterfactual -d model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/prep-45.h5ad -m model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/tune.pt -u model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-45.pt -p model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-45.h5ad --interv-key knockup --use-covariate covariate --use-size ncounts --use-layer counts --sample -v

python check_ctfact.py --markers markers.yaml --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-42.csv --ctfact model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-42.h5ad --explained model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/explained-42.csv --expr-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/expr_scatter-42.pdf --logfc-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_scatter-42.pdf --logfc-violin model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_violin-42.pdf
python check_ctfact.py --markers markers.yaml --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-43.csv --ctfact model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-43.h5ad --explained model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/explained-43.csv --expr-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/expr_scatter-43.pdf --logfc-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_scatter-43.pdf --logfc-violin model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_violin-43.pdf
python check_ctfact.py --markers markers.yaml --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-44.csv --ctfact model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-44.h5ad --explained model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/explained-44.csv --expr-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/expr_scatter-44.pdf --logfc-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_scatter-44.pdf --logfc-violin model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_violin-44.pdf
python check_ctfact.py --markers markers.yaml --ctrl ctrl.h5ad --target targets/Photoreceptor_cells.h5ad --design model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/design-45.csv --ctfact model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/ctfact-45.h5ad --explained model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/explained-45.csv --expr-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/expr_scatter-45.pdf --logfc-scatter model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_scatter-45.pdf --logfc-violin model/nptc=4-dz=16-beta=0.1-sps=L1-acyc=SpecNorm-lik=NegBin-lam=0.1-alp=0.5-run_sd=1/design/target=Photoreceptor_cells-size=3/logfc_violin-45.pdf
