Last updated: 2025-09-10
Checks: 7 0
Knit directory:
genomics_ancest_disease_dispar/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20220216)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 3964f77. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rproj.user/
Ignored: data/.DS_Store
Ignored: data/gwas_catalog/
Ignored: output/gwas_cat/
Ignored: output/gwas_study_info_cohort_corrected.csv
Ignored: output/gwas_study_info_trait_corrected.csv
Ignored: output/gwas_study_info_trait_ontology_info.csv
Ignored: output/gwas_study_info_trait_ontology_info_l1.csv
Ignored: output/gwas_study_info_trait_ontology_info_l2.csv
Ignored: output/trait_ontology/
Ignored: renv/
Untracked files:
Untracked: code/get_term_descendants.R
Untracked: data/gbd/
Untracked: data/who/
Unstaged changes:
Modified: analysis/disease_inves_by_ancest.Rmd
Modified: analysis/index.Rmd
Deleted: analysis/level_1_disease_group.Rmd
Deleted: analysis/non_ontology_trait_collapse.Rmd
Deleted: analysis/trait_ontology_collapse.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/level_2_disease_group.Rmd
)
and HTML (docs/level_2_disease_group.html
) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote
),
click on the hyperlinks in the table below to view the files as they
were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 3964f77 | IJbeasley | 2025-09-10 | workflowr::wflow_publish("analysis/level_2_disease_group.Rmd") |
html | 8fb639d | IJbeasley | 2025-09-10 | Build site. |
Rmd | edeb6f5 | IJbeasley | 2025-09-10 | workflowr::wflow_publish("analysis/level_2_disease_group.Rmd") |
html | fe91704 | IJbeasley | 2025-09-09 | Build site. |
Rmd | 9c64867 | IJbeasley | 2025-09-09 | Minor fixing of disease trait categorisation |
html | fa509c0 | IJbeasley | 2025-09-08 | Build site. |
Rmd | c9602c7 | IJbeasley | 2025-09-08 | More grouping to match GBD |
library(dplyr)
library(data.table)
library(ggplot2)
library(stringr)
source(here::here("code/get_term_descendants.R"))
gwas_study_info <- fread(here::here("output/gwas_cat/gwas_study_info_group_l1_v2.csv"))
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms = l1_all_disease_terms)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "acne",
"acne vulgaris"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "adhd",
"attention-deficit/hyperactivity disorder"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "alcohol-related disorders|alcohol and nicotine codependence",
"alcohol use disorders"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "alcohol use disorder",
"alcohol use disorders"
)
)
dementia <- c("alzheimers disease biomarker measurement",
"alzheimers disease neuropathologic change",
"aids dementia",
"dementia",
"frontotemporal dementia",
"lewy body dementia",
"vascular dementia",
"alzheimers disease"
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = paste0(dementia, collapse = "|"),
"alzheimer's disease and other dementias"
)
)
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/mesh/terms/http%253A%252F%252Fid.nlm.nih.gov%252Fmesh%252FD001008/descendants"
anxiety_terms <- get_descendants(url)
[1] "Number of terms collected:"
[1] 15
[1] "\n Some example terms"
[1] "panic disorder" "phobic disorders"
[3] "obsessive-compulsive disorder" "neurotic disorders"
[5] "neurocirculatory asthenia"
anxiety_terms <- c(anxiety_terms, "obsessive-compulsive symptom measurement")
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = paste0(anxiety_terms, collapse = "|"),
"anxiety disorders"
)
) |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "anxiety disorder|anxiety measurement",
"anxiety disorders"
)
) |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "anxiety",
"anxiety disorders"
)
)
afib_terms <- c("atrial fibrillation",
"atrial flutter",
"post-operative atrial fibrillation")
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = paste0(afib_terms, collapse = "|"),
"atrial fibrillation and flutter"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "methamphetamine",
"amphetamine"
)
)
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/cvdo/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FDOID_3627/descendants"
aortic_aneurysm_terms <- get_descendants(url)
[1] "Number of terms collected:"
[1] 6
[1] "\n Some example terms"
[1] "abdominal aortic aneurysm" "ruptured aortic aneurysm"
[3] "thoracic aortic aneurysm" "ruptured thoracic aortic aneurysm"
[5] "ruptured abdominal aortic aneurysm"
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = paste0(aortic_aneurysm_terms, collapse = "|"),
"aortic aneurysm"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = "autism",
"autism spectrum disorders"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "blindness|color vision disorder|vision disorder|myopia|refractive error|hyperopia|astigmatism|corneal astigmatism|presbyopia|anisometropia|esotropia|on-accomodative esotropia|ccommodative esotropia",
"blindness and vision loss"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "cannabis dependence",
"cannabis use disorders"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "urinary bladder cancer, disease progression measurement|b;adder tumor",
"bladder cancer"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "colorectal cancer",
"colon and rectum cancer"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "ocular melanoma|ocular cancer",
"eye cancer"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "hodgkins lymphoma",
"hodgkin lymphoma"
)
)
skin_melanoma <- c("cutaneous melanoma",
"melanoma")
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "non-hodgkins lymphoma",
"non-hodgkin lymphoma"
)
)
resp_cancer_terms = c("lung cancer",
"bronchus cancer",
"respiratory system cancer"
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = paste0(resp_cancer_terms, collapse = "|"),
"tracheal bronchus and lung cancer"
)
)
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/snomed/terms/http%253A%252F%252Fsnomed.info%252Fid%252F328383001/descendants"
chronic_liver_disease_terms <- get_descendants(url)
[1] "Number of terms collected:"
[1] 114
[1] "\n Some example terms"
[1] "chronic necrosis of liver"
[2] "chronic nonalcoholic liver disease"
[3] "chronic hepatitis"
[4] "progressive intrahepatic cholestasis"
[5] "pulmonary fibrosis, hepatic hyperplasia, bone marrow hypoplasia syndrome"
chronic_liver_disease_terms <- c("primary biliary cirrhosis",
"alcoholic liver cirrhosis",
"chronic hepatitis B virus infection",
"acute-on-chronic liver failure",
chronic_liver_disease_terms)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = paste0(chronic_liver_disease_terms, collapse = "|"),
"cirrhosis and other chronic liver diseases"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = "liver disease",
"cirrhosis and other chronic liver diseases"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "cocaine-related disorders",
"cocaine use disorders"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "depressive symptom measurement|major depressive disorder",
"depressive disorders"
)
) |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "depressive disorder",
"depressive disorders"
)
)
gal_bile_terms = c("gallbladder disease",
"bile duct disorder",
"biliary tract disease")
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = paste0(gal_bile_terms, collapse = "|"),
"gallbladder and biliary diseases"
)
)
diseases <- stringr::str_split(pattern = ", ",
gwas_study_info$l2_all_disease_terms) |>
unlist() |>
stringr::str_trim()
pregnancy_terms <- grep("pregnancy", diseases, value = T)
gyno_terms <- c("endometriosis","placenta disease", pregnancy_terms)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = paste0(gyno_terms, collapse = "|"),
"gynecological diseases"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "bulimia nervosa|anorexia nervosa|binge eating|eating disorder",
"eating disorders"
)
) |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "anorexia",
"eating disorders"
)
)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = "headache disorder|cluster headache|migraine",
"headache disorders"
)
)
== coronary artery disease (https://www.ncbi.nlm.nih.gov/books/NBK209964/)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = "coronary artery disease",
"ischemic heart disease"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "opioid dependence|opioid use disorder",
"opioid use disorders"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "parkinsons disease",
"parkinson's disease"
)
)
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/mondo/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FMONDO_0002028/descendants"
personality_disorders <- get_descendants(url)
[1] "Number of terms collected:"
[1] 10
[1] "\n Some example terms"
[1] "histrionic personality disorder" "narcissistic personality disorder"
[3] "avoidant personality disorder" "antisocial personality disorder"
[5] "paranoid personality disorder"
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = paste0(personality_disorders, collapse = "|"),
"personality disorders"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "heroin dependence|drug dependence|nictone dependence|substance abuse|drug misuse|alcohol use disorders delirium",
"other drug use disorders"
)
)
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/doid/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FDOID_535/descendants"
sleep_disorders <- get_descendants(url)
[1] "Number of terms collected:"
[1] 16
[1] "\n Some example terms"
[1] "periodic limb movement disorder" "rem sleep behavior disorder"
[3] "recurrent hypersomnia" "narcolepsy"
[5] "bruxism"
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/efo/terms/http%253A%252F%252Fwww.ebi.ac.uk%252Fefo%252FEFO_0008568/descendants"
other_sleep_disorders <- get_descendants(url)
[1] "Number of terms collected:"
[1] 26
[1] "\n Some example terms"
[1] "substance-induced sleep disorder" "insomnia"
[3] "sleepiness" "sleep-wake disorder"
[5] "fatal familial insomnia"
sleep_disorders <- c(sleep_disorders,
other_sleep_disorders)
gwas_study_info = gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms,
pattern = paste0(sleep_disorders, collapse = "|"),
"sleep disorders"
)
)
and remove alz, parks, dementia
other_mental_disorders <- c("schizophrenia",
"manic or hypomanic episode",
"mental or behavioural disorder",
"mental disorder"
)
other_neuro <- c("mild neurocognitive disorder",
"hiv-associated neurocognitive disorder")
disturbances of sensation of smell and taste
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "disorderss",
"disorders"
)
)
gwas_study_info =
gwas_study_info |>
mutate(l2_all_disease_terms =
stringr::str_replace_all(l2_all_disease_terms ,
pattern = "anxiety disorders disorderss",
"anxiety disorders"
)
)
gbd_data <- data.table::fread(here::here("data/gbd/IHME-GBD_2021_DATA-aa22a7fd-1.csv"))
gbd_data$cause <- stringr::str_remove_all(gbd_data$cause, ",")
diseases <- stringr::str_split(pattern = ", ",
gwas_study_info$l2_all_disease_terms[gwas_study_info$l2_all_disease_terms != ""]) |>
unlist() |>
stringr::str_trim()
gbd_data$cause[!tolower(gbd_data$cause) %in% unique(diseases)] |> sort()
[1] "Acute glomerulonephritis"
[2] "Bacterial skin diseases"
[3] "Bladder cancer"
[4] "Brain and central nervous system cancer"
[5] "Cardiomyopathy and myocarditis"
[6] "Drug use disorders"
[7] "Endocrine metabolic blood and immune disorders"
[8] "Fungal skin diseases"
[9] "Gallbladder and biliary tract cancer"
[10] "Hemoglobinopathies and hemolytic anemias"
[11] "Idiopathic developmental intellectual disability"
[12] "Idiopathic epilepsy"
[13] "Inguinal femoral and abdominal hernia"
[14] "Interstitial lung disease and pulmonary sarcoidosis"
[15] "Low back pain"
[16] "Lower extremity peripheral arterial disease"
[17] "Malignant neoplasm of bone and articular cartilage"
[18] "Malignant skin melanoma"
[19] "Nasopharynx cancer"
[20] "Neuroblastoma and other peripheral nervous cell tumors"
[21] "Non-rheumatic valvular heart disease"
[22] "Oral disorders"
[23] "Other cardiovascular and circulatory diseases"
[24] "Other chronic respiratory diseases"
[25] "Other digestive diseases (internal)"
[26] "Other malignant neoplasms"
[27] "Other mental disorders"
[28] "Other musculoskeletal disorders"
[29] "Other neoplasms"
[30] "Other neurological disorders"
[31] "Other sense organ diseases"
[32] "Other skin and subcutaneous diseases"
[33] "Paralytic ileus and intestinal obstruction"
[34] "Pulmonary Arterial Hypertension"
[35] "Scabies"
[36] "Soft tissue and other extraosseous sarcomas"
[37] "Sudden infant death syndrome"
[38] "Upper digestive system diseases"
[39] "Urinary diseases and male infertility"
[40] "Vascular intestinal disorders"
[41] "Viral skin diseases"
gbd_data =
gbd_data |>
mutate(cause = tolower(cause))
gwas_disease_traits = data.frame(cause = diseases)
# gwas_study_info |>
# filter(DISEASE_STUDY == T) |>
# select(all_disease_terms, l1_all_disease_terms, cause = l2_all_disease_terms) |>
# distinct()
left_join(gwas_disease_traits,
gbd_data) |>
head()
Joining with `by = join_by(cause)`
cause measure
1 idiopathic dilated cardiomyopathy <NA>
2 cleft lip <NA>
3 tracheal bronchus and lung cancer DALYs (Disability-Adjusted Life Years)
4 tracheal bronchus and lung cancer DALYs (Disability-Adjusted Life Years)
5 tracheal bronchus and lung cancer DALYs (Disability-Adjusted Life Years)
6 breast cancer DALYs (Disability-Adjusted Life Years)
location sex age metric year val upper lower
1 <NA> <NA> <NA> <NA> NA NA NA NA
2 <NA> <NA> <NA> <NA> NA NA NA NA
3 Global Both All ages Rate 2019 580.361 627.7998 532.7465
4 Global Both All ages Rate 2019 580.361 627.7998 532.7465
5 Global Both All ages Rate 2019 580.361 627.7998 532.7465
6 Global Both All ages Rate 2019 257.319 273.2295 242.2097
diseases <- stringr::str_split(pattern = ", ",
gwas_study_info$l2_all_disease_terms[gwas_study_info$l2_all_disease_terms != ""]) |>
unlist() |>
stringr::str_trim()
length(unique(diseases))
[1] 1812
# make frequency table
freq <- table(as.factor(diseases))
# sort in decreasing order
freq_sorted <- sort(freq, decreasing = TRUE)
# show top N, e.g. top 10
head(freq_sorted, 10)
chronic kidney disease hypertension
10835 7093
type 2 diabetes mellitus ischemic heart disease
922 514
depressive disorders alzheimer's disease and other dementias
513 509
benign neoplasm breast cancer
430 404
asthma schizophrenia
357 356
gwas_study_info <- fwrite(gwas_study_info,
here::here("output/gwas_study_info_trait_ontology_info_l2.csv"))
sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS 15.6.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] jsonlite_2.0.0 httr_1.4.7 stringr_1.5.1 ggplot2_3.5.2
[5] data.table_1.17.8 dplyr_1.1.4 workflowr_1.7.1
loaded via a namespace (and not attached):
[1] gtable_0.3.6 compiler_4.3.1 renv_1.0.3 promises_1.3.3
[5] tidyselect_1.2.1 Rcpp_1.1.0 git2r_0.36.2 callr_3.7.6
[9] later_1.4.2 jquerylib_0.1.4 scales_1.4.0 yaml_2.3.10
[13] fastmap_1.2.0 here_1.0.1 R6_2.6.1 generics_0.1.4
[17] curl_6.4.0 knitr_1.50 tibble_3.3.0 rprojroot_2.1.0
[21] RColorBrewer_1.1-3 bslib_0.9.0 pillar_1.11.0 rlang_1.1.6
[25] cachem_1.1.0 stringi_1.8.7 httpuv_1.6.16 xfun_0.52
[29] getPass_0.2-4 fs_1.6.6 sass_0.4.10 cli_3.6.5
[33] withr_3.0.2 magrittr_2.0.3 ps_1.9.1 grid_4.3.1
[37] digest_0.6.37 processx_3.8.6 rstudioapi_0.17.1 lifecycle_1.0.4
[41] vctrs_0.6.5 evaluate_1.0.4 glue_1.8.0 farver_2.1.2
[45] whisker_0.4.1 rmarkdown_2.29 tools_4.3.1 pkgconfig_2.0.3
[49] htmltools_0.5.8.1