Skip to content

Commit

Permalink
Standardize data paths (#34)
Browse files Browse the repository at this point in the history
* Add new directory structure and adjust the notebook

* Adjust the paths in the snakemake workflow
  • Loading branch information
pawel-czyz authored Nov 23, 2024
1 parent d3a572b commit 67b6b30
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Private files
private/
data/
# Snakemake-generated files
generated/
.snakemake/

.DS_Store
src/.DS_Store
Expand Down
12 changes: 12 additions & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.csv
*.tsv
*.yml
*.yaml
*.pdf
*.npy
*.npz
*.zip
*.png
*.pdf
*.jpg
*.gif
19 changes: 19 additions & 0 deletions data/main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Main data set

This is the main data set from which we load the data.

Structure:

data/main
├── deconvolved.csv
├── README.md
└── var_dates.yaml

Checksums:
```
$ sha256sum data/main/deconvolved.csv
b8dbd93634a6310e13f639eff5402b40d47ed484a905d450b4e0a518d18d0f04 data/main/deconvolved.csv
$ sha256sum data/main/var_dates.yaml
a6464599af6859d9542862e081766d31baffd7bc36792a0c671501142f9eda66 data/main/var_dates.yaml
```
12 changes: 4 additions & 8 deletions examples/frequentist_notebook_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import matplotlib.ticker as ticker
import pandas as pd
import yaml
from pathlib import Path

from covvfit import plot, preprocess
from covvfit import quasimultinomial as qm
Expand All @@ -37,13 +38,9 @@
# We start by loading the data:

# +
_dir_switch = False # Change this to True or False, depending on the laptop you are on
if _dir_switch:
DATA_PATH = "../../LolliPop/lollipop_covvfit/deconvolved.csv"
VAR_DATES_PATH = "../../LolliPop/lollipop_covvfit/var_dates.yaml"
else:
DATA_PATH = "../new_data/deconvolved.csv"
VAR_DATES_PATH = "../new_data/var_dates.yaml"
DATA_DIR = Path("../data/main/")
DATA_PATH = DATA_DIR / "deconvolved.csv"
VAR_DATES_PATH = DATA_DIR / "var_dates.yaml"


data = pd.read_csv(DATA_PATH, sep="\t")
Expand Down Expand Up @@ -550,4 +547,3 @@ def get_upper(ys):
# Plot individual overdispersions
for i, ax in enumerate(axs[:, 2]):
plot_predictions(ax, i, **obtain_predictions(mcmc_indivi))
# -
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ numpy = "==1.24.3"
seaborn = "^0.13.2"
numpyro = "^0.14.0"
subplots-from-axsize = "^0.1.9"
pango-aliasor = "^0.3.0"


[tool.poetry.group.dev]
Expand Down
2 changes: 2 additions & 0 deletions workflows/compare_clinical/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
results/
.snakemake/
11 changes: 11 additions & 0 deletions workflows/compare_clinical/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Comparison with clinical data

To run the workflow, ensure that you have the `data/main` directory set up with the data.
Note that the workflow should be run from this directory:

Usage:

```bash
$ snakemake -s compare_clinical.smk --configfile CONFIG_NAME.yaml
```

2 changes: 1 addition & 1 deletion workflows/compare_clinical/config_ba1.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_url: "https://lapis.cov-spectrum.org/open/v2/sample/aggregated"
country: "Switzerland"
wastewater_data_path: "../../../LolliPop/lollipop_covvfit/deconvolved.csv"
wastewater_data_path: "../../data/main/deconvolved.csv"

run_name: "config_ba1"

Expand Down
2 changes: 1 addition & 1 deletion workflows/compare_clinical/config_ba1ba2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_url: "https://lapis.cov-spectrum.org/open/v2/sample/aggregated"
country: "Switzerland"
wastewater_data_path: "../../../LolliPop/lollipop_covvfit/deconvolved.csv"
wastewater_data_path: "../../data/main/deconvolved.csv"

run_name: "config_ba1ba2"

Expand Down
2 changes: 1 addition & 1 deletion workflows/compare_clinical/config_ba4ba5.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_url: "https://lapis.cov-spectrum.org/open/v2/sample/aggregated"
country: "Switzerland"
wastewater_data_path: "../../../LolliPop/lollipop_covvfit/deconvolved.csv"
wastewater_data_path: "../../data/main/deconvolved.csv"

run_name: "config_ba4ba5"

Expand Down
2 changes: 1 addition & 1 deletion workflows/compare_clinical/config_ba4ba5_2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_url: "https://lapis.cov-spectrum.org/open/v2/sample/aggregated"
country: "Switzerland"
wastewater_data_path: "../../../LolliPop/lollipop_covvfit/deconvolved.csv"
wastewater_data_path: "../../data/main/deconvolved.csv"

run_name: "config_ba4ba5_2"

Expand Down

0 comments on commit 67b6b30

Please sign in to comment.