Skip to content

Commit

Permalink
Merge pull request #47 from YeChen-IDM/snakemake_integration
Browse files Browse the repository at this point in the history
Snakemake plotting and reporting scripts integration; Update to the latest Eradication on M-O; update to version v1.1.0
  • Loading branch information
YeChen-IDM authored Dec 5, 2022
2 parents 08a0362 + c6580bd commit d363687
Show file tree
Hide file tree
Showing 144 changed files with 1,302 additions and 402 deletions.
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- [Option 2_Run all Sites with Snakemake (Recommended)](#option-2_run-all-sites-with-snakemake-recommended)
- [How to Change Default Setting](#how-to-change-default-setting)
- [Snakemake Tips](#snakemake-tips)
- [Generate Plots and Final Reports](#generate-plots-and-final-reports)
- [Check Plots and Final Report](#check-plots-and-final-report)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -112,23 +112,35 @@ snakemake -j
snakemake -j
```

- If you want to re-run the analyzers steps with previous experiments you ran, you can delete the analyzer id files and run:
- If you want to re-run the analyzers steps with previous experiments you ran, you can delete the analyzer id files and all following the analyzers steps and run:
```bash
snakemake clean_ana clean_download -j
snakemake clean_ana -j
snakemake -j
```

- Simular to previous scenario, if you want to run only the download and plotting steps:
- Simular to previous scenario, if you want to only re-run starting from the download steps:
```bash
snakemake clean_download -j
snakemake -j
```

- Simular to previous scenario, if you want to only re-run starting from the plotting steps:
```bash
snakemake clean_plot -j
snakemake -j
```
- Simular to previous scenario, if you want to only re-run starting from the reporting steps:
```bash
snakemake clean_report -j
snakemake -j
```

- If you want to re-run simulations for certain sites, delete COMPS ID files for those sites that you want to -re-run
(/simulations/COMPS_ID/{site_name}_COMPS_ID_exp_submit, _analyzers and _download files) and run "snakemake -j" again.
- If you want to re-run simulations for certain sites, delete COMPS ID files for those sites that you want to -re-run
(/simulations/COMPS_ID/{site_name}_COMPS_ID_exp_submit, _analyzers and _download files) and run
"snakemake clean_plot -j" and then "snakemake -j" again.

- If you want to re-run the analyzers and plotting steps for certain sites, delete the {site_name}_COMPS_ID_analyzers
and _download files only and re-run "snakemake -j".
- If you want to re-run the analyzers and plotting steps for certain sites, delete the {site_name}_COMPS_ID_analyzers
and _download files only and run "snakemake clean_plot -j" and then "snakemake -j".

- Other snakemake tips:
- Snakemake log can be found in '\malaria-model_validation\simulations\.snakemake\log'.
Expand All @@ -137,10 +149,6 @@ snakemake -j
- If you have incompleted file from previous snakemake instance, you can run "snakemake --cleanup-metadata
<filenames>" to clean up the metadata. Or you can delete the '.snakemake' folder to clean up the metadata manually.


# Generate Plots and Final Reports
Run Plotting and reportting scripts with site(s) that you ran:
```bash
Rscript create_plots\run_generate_validation_comparisons_site.R
python3 report\create_pdf_report_3.py
```
# Check Plots and Final Report
You can check the plots in \malaria-model_validation\report\_plots folder and final report:
\malaria-model_validation\report\Malaria_model_validation_output_{date}}({time}).pdf.
5 changes: 4 additions & 1 deletion create_plots/run_generate_validation_comparisons_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# reference dataset.

from simulations.manifest import simulation_output_filepath, benchmark_simulation_filepath, \
base_reference_filepath, plot_output_filepath
base_reference_filepath, plot_output_filepath, comps_id_folder
from simulations.helpers import load_coordinator_df
from create_plots.helpers_coordinate_each_relationship import generate_age_incidence_outputs, \
generate_age_prevalence_outputs, generate_parasite_density_outputs, generate_infectiousness_outputs, \
Expand Down Expand Up @@ -67,6 +67,9 @@ def run():
generate_age_infection_duration_outputs(coord_csv, simulation_output_filepath, base_reference_filepath,
plot_output_filepath, pos_thresh_dens, duration_bins,
benchmark_simulation_filepath=benchmark_simulation_filepath)
# generate dummy file for snakemake plot rule.
with open(comps_id_folder + 'plot_completed', 'w') as file:
file.write('Plotting is completed.')


if __name__ == '__main__':
Expand Down
Binary file not shown.
Binary file added report/Malaria_model_validation_output_v1.1.0.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Site,mean_rel_diff,mean_abs_diff,corr_slope,corr_r_squared,mean_rel_slope_diff,mean_abs_slpe_diff
chonyi_1999,2.359037548734484,0.9527363074851136,1.0864286693488938,0.4909669217402624,8.439261308486314,0.14796578722119713
dielmo_1990,1.4081812654541295,1.2458223958828658,1.4662896933383196,0.9136326384809177,2.7887861639664027,0.33110512980784795
dongubougou_1999,0.20347658923882478,0.20058805816706715,1.084140813158362,0.8655226920015983,0.5908511281184664,0.055915663172901274
ebolakounou_1997,3.5298250987213704,1.3500864647430642,1.5910150844822293,0.36079816878572557,5.540963413406026,0.09385532642413291
chonyi_1999,2.359037548734484,0.9527363074851135,1.0864286693488938,0.4909669217402626,8.439261308486312,0.14796578722119708
dielmo_1990,1.4081812654541295,1.2458223958828656,1.4662896933383196,0.9136326384809177,2.788786163966403,0.3311051298078479
dongubougou_1999,0.20347658923882472,0.20058805816706715,1.0841408131583619,0.8655226920015985,0.5908511281184664,0.05591566317290126
ebolakounou_1997,3.5298250987213704,1.3500864647430642,1.591015084482229,0.36079816878572557,5.540963413406026,0.09385532642413291
koundou_1997,2.4201137951985316,2.1409045381563216,2.4059180140110406,0.583784813025154,4.061363882148547,0.2988974553053057
ndiop_1993,0.46935752353216675,0.5183624018079345,1.3707184658549694,0.8617239579850393,1.4238643917237108,0.06385891135139789
ngerenya_1999,2.1701872774703364,0.6138116970950674,-0.060277891520447935,0.015456288322816111,1.8822112986842252,0.15579650258632832
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Site,mean_rel_diff,mean_abs_diff,corr_slope,corr_r_squared,mean_rel_slope_diff,mean_abs_slpe_diff
chonyi_1999_month7,0.6825254910261515,0.3393820994465812,0.1566309755712942,0.4301695105868464,12.214132279434569,0.042317923534964316
dielmo_1990_monthmultiple,0.5711687112890077,0.3965314003825952,0.6219099246260963,0.9274859257167195,0.8630959749052143,0.020346956805853512
chonyi_1999_month7,0.6825254910261515,0.3393820994465812,0.15663097557129418,0.4301695105868461,12.214132279434569,0.042317923534964316
dielmo_1990_monthmultiple,0.5711687112890077,0.3965314003825952,0.6219099246260962,0.9274859257167193,0.8630959749052138,0.02034695680585351
dongubougou_1999_monthmultiple,0.2921917392007317,0.17073999016392666,0.13038640523567407,0.09423861595745166,0.6506923472111071,0.02470917658914631
ebolakounou_1997_monthmultiple,0.6858638609195971,0.3886452217302862,-0.10398602600941884,0.09180777382837431,0.8668243442164759,0.010454242841899759
koundou_1997_monthmultiple,0.5614177043381496,0.3462386846857258,0.43728547052724426,0.7472381451807503,1.3249240850644364,0.005923631221470194
matsari_1970_month10,0.39820928816459034,0.18674109376023418,0.7863094941336288,0.9256435924626562,1.3770296193627964,0.012248340369871116
matsari_1970_month2,0.6299855911450253,0.3950905744647875,0.7864003185032957,0.9932297717710127,,0.0024505860481569366
matsari_1970_month7,0.4404135744799402,0.23401638055083646,0.676475606141136,0.8707864429680627,0.9187147875941257,0.008318495110730701
matsari_1970_month7,0.4404135744799402,0.23401638055083646,0.676475606141136,0.8707864429680627,0.9187147875941255,0.0083184951107307
ndiop_1993_monthmultiple,0.4657205735231557,0.14894292742359438,0.5214373120598216,0.795715073267172,0.6319126797626777,0.008540974359763517
ngerenya_1999_month7,0.8510846198405031,0.2561096994580539,-0.002692043148475209,0.00011484196242583909,0.9246367805158168,0.03231061623631442
rafin_marke_1970_month10,0.33576501065627096,0.14162445663845127,0.889262048689702,0.7164946161179646,0.5855068867610722,0.01670433705872292
Expand Down
Binary file modified report/_plots_Python/corr_ref_sim_points_incidence_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/corr_ref_sim_points_prevalence_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion report/_plots_Python/loglikelihood_prevalence_age.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_month,loglikelihood_new_sim,loglikelihood_benchmark_sim
dielmo_1990_monthmultiple,-3466.6023937629193,-3466.6023937629193
dielmo_1990_monthmultiple,-3466.6023937629197,-3466.6023937629197
dongubougou_1999_monthmultiple,-84.26103051901676,-84.26103051901676
ebolakounou_1997_monthmultiple,-1363.029630690697,-1363.029630690697
koundou_1997_monthmultiple,-1245.5403763380814,-1245.5403763380814
Expand Down
Binary file modified report/_plots_Python/scatter_benchmark_asex_dens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/scatter_benchmark_gamet_dens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/scatter_benchmark_incidence_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/scatter_benchmark_infectiousness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/scatter_benchmark_prevalence_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_asex_dens_age_dapelogo_2007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_asex_dens_age_laye_2007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_asex_dens_age_matsari_1970.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_asex_dens_age_sugungum_1970.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_barplot_asex_dens_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_barplot_gamet_dens_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_gamet_dens_age_dapelogo_2007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_gamet_dens_age_laye_2007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_gamet_dens_age_sugungum_1970.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_incidence_age.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified report/_plots_Python/site_compare_infectiousness_dapelogo_2007.png
Binary file modified report/_plots_Python/site_compare_infectiousness_laye_2007.png
Binary file modified report/_plots_Python/site_compare_prevalence_age.png
10 changes: 10 additions & 0 deletions report/_plots_v1.1.0/comparison_metric_table_incidence_age.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Site,mean_rel_diff,mean_abs_diff,corr_slope,corr_r_squared,mean_rel_slope_diff,mean_abs_slpe_diff
chonyi_1999,2.359037548734484,0.9527363074851135,1.0864286693488938,0.4909669217402626,8.439261308486312,0.14796578722119708
dielmo_1990,1.4081812654541295,1.2458223958828656,1.4662896933383196,0.9136326384809177,2.788786163966403,0.3311051298078479
dongubougou_1999,0.20347658923882472,0.20058805816706715,1.0841408131583619,0.8655226920015985,0.5908511281184664,0.05591566317290126
ebolakounou_1997,3.5298250987213704,1.3500864647430642,1.591015084482229,0.36079816878572557,5.540963413406026,0.09385532642413291
koundou_1997,2.4201137951985316,2.1409045381563216,2.4059180140110406,0.583784813025154,4.061363882148547,0.2988974553053057
ndiop_1993,0.46935752353216675,0.5183624018079345,1.3707184658549694,0.8617239579850393,1.4238643917237108,0.06385891135139789
ngerenya_1999,2.1701872774703364,0.6138116970950674,-0.060277891520447935,0.015456288322816111,1.8822112986842252,0.15579650258632832
sotuba_1999,0.3696682793427051,0.5674355266406905,0.07836804114542992,0.018623563537865394,1.0594253967100906,0.040875299422955785
all_sites,1.6610911744982817,0.9404107512855068,,,,
19 changes: 19 additions & 0 deletions report/_plots_v1.1.0/comparison_metric_table_prevalence_age.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Site,mean_rel_diff,mean_abs_diff,corr_slope,corr_r_squared,mean_rel_slope_diff,mean_abs_slpe_diff
chonyi_1999_month7,0.6825254910261515,0.3393820994465812,0.15663097557129418,0.4301695105868461,12.214132279434569,0.042317923534964316
dielmo_1990_monthmultiple,0.5711687112890077,0.3965314003825952,0.6219099246260962,0.9274859257167193,0.8630959749052138,0.02034695680585351
dongubougou_1999_monthmultiple,0.2921917392007317,0.17073999016392666,0.13038640523567407,0.09423861595745166,0.6506923472111071,0.02470917658914631
ebolakounou_1997_monthmultiple,0.6858638609195971,0.3886452217302862,-0.10398602600941884,0.09180777382837431,0.8668243442164759,0.010454242841899759
koundou_1997_monthmultiple,0.5614177043381496,0.3462386846857258,0.43728547052724426,0.7472381451807503,1.3249240850644364,0.005923631221470194
matsari_1970_month10,0.39820928816459034,0.18674109376023418,0.7863094941336288,0.9256435924626562,1.3770296193627964,0.012248340369871116
matsari_1970_month2,0.6299855911450253,0.3950905744647875,0.7864003185032957,0.9932297717710127,,0.0024505860481569366
matsari_1970_month7,0.4404135744799402,0.23401638055083646,0.676475606141136,0.8707864429680627,0.9187147875941255,0.0083184951107307
ndiop_1993_monthmultiple,0.4657205735231557,0.14894292742359438,0.5214373120598216,0.795715073267172,0.6319126797626777,0.008540974359763517
ngerenya_1999_month7,0.8510846198405031,0.2561096994580539,-0.002692043148475209,0.00011484196242583909,0.9246367805158168,0.03231061623631442
rafin_marke_1970_month10,0.33576501065627096,0.14162445663845127,0.889262048689702,0.7164946161179646,0.5855068867610722,0.01670433705872292
rafin_marke_1970_month2,0.6895323478189561,0.39644790640199684,0.3791186726125504,0.9147342032022373,0.49487086565326166,0.007303359628916402
rafin_marke_1970_month7,0.36662216745724924,0.1732038206493545,0.5313418689033182,0.8040591037631534,60.7957816844913,0.010211641021033455
sotuba_1999_monthmultiple,2.484336072291313,0.18349964579147138,0.1513331198191235,0.01728434589322891,3.9181738234540444,0.008653389560842968
sugungum_1970_month10,0.46487882168073275,0.21334317162823746,0.892301300941384,0.9153345760653759,1.881581244676297,0.008059387929131905
sugungum_1970_month2,0.6236851050207368,0.3273411507035959,0.5575133570794679,0.8693862147591017,1.8861647797218364,0.009580442352786923
sugungum_1970_month7,0.2850904482414568,0.12479898222550063,0.7565180071793607,0.7648414997099265,1.7616882910570792,0.012480177680226892
all_sites,0.7060172162703156,0.26559137003721556,,,,
16 changes: 16 additions & 0 deletions report/_plots_v1.1.0/loglikelihood_prevalence_age.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
site_month,loglikelihood_new_sim,loglikelihood_benchmark_sim
dielmo_1990_monthmultiple,-3466.6023937629197,-3466.6023937629197
dongubougou_1999_monthmultiple,-84.26103051901676,-84.26103051901676
ebolakounou_1997_monthmultiple,-1363.029630690697,-1363.029630690697
koundou_1997_monthmultiple,-1245.5403763380814,-1245.5403763380814
matsari_1970_month10,-50.662599543326195,-50.662599543326195
matsari_1970_month2,-263.25804760282097,-263.25804760282097
matsari_1970_month7,-67.33292846410185,-67.33292846410185
ndiop_1993_monthmultiple,,
rafin_marke_1970_month10,-29.387106539215623,-29.387106539215623
rafin_marke_1970_month2,-145.89519905060365,-145.89519905060365
rafin_marke_1970_month7,-63.78842174861791,-63.78842174861791
sotuba_1999_monthmultiple,-272.37015246943747,-272.37015246943747
sugungum_1970_month10,-152.7494668500975,-152.7494668500975
sugungum_1970_month2,-335.01903047385656,-335.01903047385656
sugungum_1970_month7,-31.504463570505617,-31.504463570505617
16 changes: 16 additions & 0 deletions report/_plots_v1.1.0/loglikelihoods_par_dens.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
site_month,loglike_asex,benchmark_loglike_asex,loglike_gamet,benchmark_loglike_gamet
matsari_1970_month2,-388.5658647314641,-388.5658647314641,-1126.5067540609252,-1126.5067540609252
matsari_1970_month7,-622.6123330019673,-622.6123330019673,-647.0310739624263,-647.0310739624263
matsari_1970_month10,-925.2131658352293,-925.2131658352293,-1214.3526893895782,-1214.3526893895782
rafin_marke_1970_month2,-151.38873119340678,-151.38873119340678,-239.0289626836029,-239.0289626836029
rafin_marke_1970_month7,-646.3403432364206,-646.3403432364206,-661.756709133003,-661.756709133003
rafin_marke_1970_month10,-554.7327641446915,-554.7327641446915,-876.7543574963095,-876.7543574963095
sugungum_1970_month2,-547.6560613702462,-547.6560613702462,-1327.1606844138018,-1327.1606844138018
sugungum_1970_month7,-1105.657401526858,-1105.657401526858,-982.89151714405,-982.89151714405
sugungum_1970_month10,-1513.5441864504005,-1513.5441864504005,-2254.2505145215273,-2254.2505145215273
laye_2007_month7,-63.207838404281006,-63.207838404281006,-74.69789236018474,-74.69789236018474
laye_2007_month9,-85.93548761815548,-85.93548761815548,-inf,-inf
laye_2007_month1,-37.23525174199905,-37.23525174199905,-25.42118634676641,-25.42118634676641
dapelogo_2007_month7,-70.52422100003385,-70.52422100003385,-inf,-inf
dapelogo_2007_month9,-55.79528949321428,-55.79528949321428,-43.3042021524024,-43.3042021524024
dapelogo_2007_month1,-51.00728916075721,-51.00728916075721,-inf,-inf
6 changes: 6 additions & 0 deletions report/_plots_v1.1.0/summary_table_sim_benchmark.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
validation_relationship,abs_diff_new,abs_diff_bench,num_sites_better,num_sites_similar,num_sites_worse
age_incidence,0.9404107512855068,0.9404107512855068,0,8,0
age_prevalence,0.2655913700372155,0.2655913700372155,0,17,0
asexual_par_dens,0.188549310757321,0.188549310757321,0,15,0
gamet_par_dens,0.2416610186586396,0.2416610186586396,0,15,0
infectiousness,0.14141331785076117,0.14141331785076117,0,6,0
Loading

0 comments on commit d363687

Please sign in to comment.