Skip to content

Commit

Permalink
update file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
amertens committed Jun 3, 2021
1 parent 129da9d commit c6f2e29
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 48 deletions.
175 changes: 175 additions & 0 deletions 0-config.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
#-------------------------------------
# ki longitudinal analysis manuscripts

# configure data directories
# source base functions
# load libraries
#-------------------------------------
kiPath <- c("/data/KI/R/x86_64-pc-linux-gnu-library/4.0/" , .libPaths())
.libPaths(kiPath)

library(tidyverse)
library(here)
library(ggplot2)
library(ggpubr)
#library(dplyr)
library(gridExtra)
library(reshape2)
library(metafor)
library(data.table)
library(viridis)
library(ggthemes)
library(maps)
library(FField)
library(ggridges)
library(ggridges)
library(RColorBrewer)
library(gridExtra)
library(assertthat)
# library(haven)
library(tidyselect)
# options(repos = c(CRAN = "http://cran.rstudio.com/",
# deltarho = "http://packages.deltarho.org"))
library(stringr)
library(mgcv)
library(grid)
library(lazyeval)
library(rlang)
library(scales)
library(xtable)


# for parallel computing
# (will need to configure in each script)
library(foreach)
library(doParallel)
library(survey)
# install.packages("bit64")
library(bit64)
library(zoo)



# Define directories
# results that can be pushed to github:
#res_dir = here::here("results/")
res_dir = "data/KI/ki-manuscript-output/results/"


# results that cannot be pushed to github:
res_bluevelvet_dir = "/data/KI/UCB-SuperLearner/ki-results/"

#dhs_res_dir = here::here("results", "dhs")
dhs_res_dir = "/data/KI/ki-manuscript-output/results/dhs/"

#data_dir = here::here("data")
data_dir = "/data/KI/ki-manuscript-output/data/"
res_dir = "/data/KI/ki-manuscript-output/results/"

metadata_dir = "U:/results/Metadata/"


#ghapdata_dir = "/home/andrew.mertens/data/KI/UCB-SuperLearner/Manuscript analysis data/"
ghapdata_dir = "/data/KI/UCB-SuperLearner/Manuscript analysis data/"

#Bluevelvet directory
BV_dir = "/data/KI/ki-manuscript-output/"


project_functions_dir = here::here("0-project-functions")
data_cleaning_dir = here::here("1-data-cleaning")
descriptive_outcomes_dir = here::here("2-descriptive-outcomes")
prep_tmle_analysis_dir = here::here("3-prep-tmle-analysis")
longbow_tmle_analysis_dir = here::here("4-longbow-tmle-analysis")
visualizations_dir = here::here("5-visualizations")
shiny_app_dir = here::here("6-shiny-app")
cc_shiny_app_dir = here::here("7-cc-shiny-app")

#Set cohort data file path
cohortdata_dir = paste0(ghapdata_dir, "cleaned individual study datasets/")
deriveddata_dir = paste0(ghapdata_dir, "covariate creation intermediate datasets/derived covariate datasets/")

# note: figures must be saved in same directory
# as shiny app in order to publish it
# fig_dir = paste0(here::here(),"/figures/")
# figdata_dir_stunting = paste0(here::here(),"/figures/stunting/figure-data/")
# figdata_dir_wasting = paste0(here::here(),"/figures/wasting/figure-data/")
BV_dir = "/data/KI/ki-manuscript-output"
fig_dir = "/data/KI/ki-manuscript-output/figures/"
figdata_dir_stunting = paste0(fig_dir,"stunting/figure-data/")
figdata_dir_wasting = paste0(fig_dir,"wasting/figure-data/")


#################################
# Data Cleaning Scripts
included_studies_path = paste0(ghapdata_dir, "FINAL_only_included_studies.rds")
temp_clean_covariates_path = paste0(ghapdata_dir, "FINAL_temp_clean_covariates.rds")
clean_covariates_path = paste0(ghapdata_dir,"FINAL_clean_covariates.rds")
ki_manuscript_dataset_path = paste0(ghapdata_dir,"ki-manuscript-dataset.rds")
mortality_path = paste0(ghapdata_dir,"mortality.rds")
mortality_age_path = paste0(ghapdata_dir,"mortality_age.rds")
rf_stunting_data_path = paste0(ghapdata_dir, "rf_stunting_data.rds")
rf_wasting_data_path = paste0(ghapdata_dir, "rf_wasting_data.rds")
rf_underweight_path = paste0(ghapdata_dir, "rf_underweight_data.rds")
rf_co_occurrence_path = paste0(ghapdata_dir, "rf_co_occurrence_data.rds")
stunting_data_path = paste0(ghapdata_dir, "stunting_data.rds")
wasting_data_path = paste0(ghapdata_dir, "wasting_data.rds")
underweight_data_path = paste0(ghapdata_dir, "underweight_data.rds")
co_occurrence_data_path = paste0(ghapdata_dir, "co_occurrence_data.rds")
clean_DHS_haz_path = paste0(dhs_res_dir, "clean-DHS-haz.rds")
clean_DHS_waz_path = paste0(dhs_res_dir, "clean-DHS-waz.rds")
clean_DHS_whz_path = paste0(dhs_res_dir, "clean-DHS-whz.rds")
dhs_quantiles_path = paste0(dhs_res_dir, "/dhs_quantiles.rds")
seasonality_data_path = paste0(ghapdata_dir,"seasonality_data.rds")
HBDGki_CONSORT_inclusion_Ns_path = paste0(res_dir, "HBGDki_CONSORT_inclusion_Ns.rds")
metadata_GHAP_metadata_wasting_path = paste0(metadata_dir, "GHAP_metadata_wasting.RDS")
results_GHAP_metadata_wasting_path = paste0(res_dir, "GHAP_metadata_wasting.RDS")
metadata_GHAP_metadata_stunting_path = paste0(metadata_dir, "GHAP_metadata_stunting.RDS")
results_GHAP_metadata_stunting_path = paste0(res_dir, "GHAP_metadata_stunting.RDS")
metadata_GHAP_metadata_stunting_xlsx_path = paste0(metadata_dir, "GHAP_metadata_stunting.xlsx")
icc_res_path = paste0(res_dir,"icc_res.rds")
test_data_path = "C:/Users/andre/Documents/HBGDki/ki-longitudinal-manuscripts/data/simulated test data/testdata.rds"
asset_PCA_allstudies_path = paste0(project_functions_dir, "1_assetPCA-allstudies.R")

filenames = paste0(here::here(), "/ki-filenames.csv")

##################################



#list of monthy and monthly+quarterly cohorts
monthly_cohorts <- c("CMC-V-BCS-2002", "CMIN Peru95", "CMIN Peru89",
"CMIN Bangladesh93","CONTENT", "EE",
"GMS-Nepal", "Guatemala BSC", "IRC",
"Keneba", "MAL-ED", "PROVIDE" , "ResPak",
"TanzaniaChild2", "TDC")


monthly_and_quarterly_cohorts <- c("CMC-V-BCS-2002", "CMIN Peru95", "CMIN Brazil89",
"CMIN GB94", "CMIN Peru89", "CMIN Bangladesh93",
"CONTENT", "EE", "GMS-Nepal",
"Guatemala BSC", "IRC",
"JiVitA-3", "JiVitA-4", "Keneba",
"LCNI-5", "MAL-ED", "PROBIT",
"ResPak", "SAS-CompFeed", "SAS-FoodSuppl",
"TanzaniaChild2", "ZVITAMBO", "TDC", "NIH-Birth",
"NIH-Crypto", "PROVIDE" )

monthly_and_quarterly_cohorts_cc <- c("CMC-V-BCS-2002", "CMIN Peru95", "CMIN Brazil89",
"CMIN GB94", "CMIN Peru89", "CMIN Bangladesh93",
"CONTENT", "EE", "GMS-Nepal",
"Guatemala BSC", "iLiNS-Zinc", "IRC",
"JiVitA-3", "JiVitA-4", "Keneba",
"LCNI-5", "MAL-ED", "PROBIT",
"ResPak", "SAS-CompFeed", "SAS-FoodSuppl",
"TanzaniaChild2", "ZVITAMBO", "TDC", "NIH-Birth",
"NIH-Crypto", "PROVIDE" )

ki_countries <- c( "India", "Peru", "Brazil", "Guinea-Bissau","Bangladesh", "Pakistan",
"Nepal", "Guatemala", "Burkina Faso", "Gambia", "Malawi", "South Africa",
"Tanzania", "Belarus", "Zimbabwe" )





6 changes: 3 additions & 3 deletions 01-quality-assurance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ To check for outliers in length measurements, we plotted the distribution of raw
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
# setwd("../../")
# source("0-config.R")
source(paste0(here::here(), "/0-config.R"))
```

```{r qa, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/laz_QA.png"))
include_graphics(paste0(fig_dir, "/shared/laz_QA.png"))
#include_graphics("figure-copies/laz_QA.png")
```


```{r qa-cohort, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/laz_QA_cohort.png"))
include_graphics(paste0(fig_dir, "/shared/laz_QA_cohort.png"))
#include_graphics("figure-copies/laz_QA_cohort.png")
```

5 changes: 3 additions & 2 deletions 02-severe-stunting.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ Below, we display plots for the age-specific prevalence and cumulative incidence
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
source(paste0(here::here(), "/0-config.R"))
```


## Age-specific severe stunting prevalence
```{r prev, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/stunting/fig-stunt-3-prev-overall_region--allage-primary.png"))
include_graphics(paste0(fig_dir, "/stunting/fig-stunt-3-prev-overall_region--allage-primary.png"))
#include_graphics("figure-copies/fig-stunt-3-prev-overall_region--allage-primary.png")
```


## Age-specific severe stunting incidence
```{r inc, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/stunting/fig-stunt-3-inc-overall_region--allage-primary.png"))
include_graphics(paste0(fig_dir, "/stunting/fig-stunt-3-inc-overall_region--allage-primary.png"))
#include_graphics("figure-copies/fig-stunt-3-inc-overall_region--allage-primary.png")
```
3 changes: 2 additions & 1 deletion 03-secular-trends.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ This study included cohorts that measured child growth from 1969 to 2014. To ass
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
source(paste0(here::here(), "/0-config.R"))
```


```{r prev-re, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/laz_secular_trend.png"))
include_graphics(paste0(fig_dir, "/shared/laz_secular_trend.png"))
#include_graphics("figure-copies/laz_secular_trend.png")
```

Expand Down
9 changes: 5 additions & 4 deletions 04-age-at-first-measurement.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ Our analyses of stunting incidence assumed that children whose first measurement
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
source(paste0(here::here(), "/0-config.R"))
```

## Histogram of first measurement within age 0-30 days

### All cohorts
```{r age-first, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/age_histogram_first_month.png"))
include_graphics(paste0(fig_dir, "/shared/age_histogram_first_month.png"))
#include_graphics("figure-copies/age_histogram_first_month.png")
```

### Cohort-stratified
```{r age-first-cohort, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/age_histogram_first_month_cohort.png"))
include_graphics(paste0(fig_dir, "/shared/age_histogram_first_month_cohort.png"))
#include_graphics("figure-copies/age_histogram_first_month_cohort.png")
```

Expand All @@ -37,13 +38,13 @@ include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shar

### All cohorts
```{r age-enr, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/enrollment_age_histogram_over_7d.png"))
include_graphics(paste0(fig_dir, "/shared/enrollment_age_histogram_over_7d.png"))
#include_graphics("figure-copies/enrollment_age_histogram_over_7d.png")
```

### Cohort-stratified
```{r age-enr-cohort, echo = FALSE}
include_graphics(paste0(here::here(), "/ki-longitudinal-manuscripts/figures/shared/enrollment_age_histogram_over_7d_cohort.png"))
include_graphics(paste0(fig_dir, "/shared/enrollment_age_histogram_over_7d_cohort.png"))
#include_graphics("figure-copies/enrollment_age_histogram_over_7d_cohort.png")
```

Expand Down
2 changes: 2 additions & 0 deletions 05-DHS-ki-countries.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ In the manuscript, we compared the mean length-for-age Z-score by age and region
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
source(paste0(here::here(), "/0-config.R"))
```


Expand Down
Loading

0 comments on commit c6f2e29

Please sign in to comment.