Last updated: 2025-09-15
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 3c8309c. 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/gbd/.DS_Store
Ignored: data/gbd/ihme_gbd_2019_global_disease_burden_rate_all_ages.csv
Ignored: data/gbd/ihme_gbd_2019_global_paf_rate_percent_all_ages.csv
Ignored: data/gbd/ihme_gbd_2021_global_disease_burden_rate_all_ages.csv
Ignored: data/gbd/ihme_gbd_2021_global_paf_rate_percent_all_ages.csv
Ignored: data/gwas_catalog/
Ignored: data/who/
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/
Unstaged changes:
Modified: code/get_term_descendants.R
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 |
---|---|---|---|---|
html | 30d773e | IJbeasley | 2025-09-15 | Build site. |
html | 8d64a38 | IJbeasley | 2025-09-15 | Build site. |
Rmd | b3088d8 | IJbeasley | 2025-09-15 | workflowr::wflow_publish("analysis/level_2_disease_group.Rmd") |
html | b89d661 | IJbeasley | 2025-09-10 | Build site. |
Rmd | c0fcab7 | IJbeasley | 2025-09-10 | workflowr::wflow_publish("analysis/level_2_disease_group.Rmd") |
html | ead4d8e | IJbeasley | 2025-09-10 | Build site. |
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 = "(?=,|$)|\\b"),
"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] "obsessive-compulsive disorder" "generalized anxiety disorder"
[3] "neurocirculatory asthenia" "excoriation disorder"
[5] "anxiety, separation"
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 = "(?=,|$)|\\b"),
"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 = "(?=,|$)|\\b"),
"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] "ruptured thoracoabdominal aortic aneurysm"
[2] "ruptured abdominal aortic aneurysm"
[3] "ruptured thoracic aortic aneurysm"
[4] "abdominal aortic aneurysm"
[5] "ruptured 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 = "(?=,|$)|\\b"),
"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 = "(?=,|$)|\\b"),
"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] "hepatic ascites co-occurrent with chronic active hepatitis due to toxic liver disease"
[2] "cirrhosis of liver co-occurrent and due to primary sclerosing cholangitis (disorder)"
[3] "chronic hepatitis c co-occurrent with human immunodeficiency virus infection"
[4] "primary biliary cirrhosis co-occurrent with systemic scleroderma (disorder)"
[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 = "(?=,|$)|\\b"),
"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 = "(?=,|$)|\\b"),
"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 = "(?=,|$)|\\b"),
"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] "obsessive-compulsive personality disorder"
[2] "narcissistic personality disorder"
[3] "schizotypal personality disorder"
[4] "histrionic personality disorder"
[5] "antisocial 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 = "(?=,|$)|\\b"),
"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" "advanced sleep phase syndrome 3"
[3] "advanced sleep phase syndrome 2" "advanced sleep phase syndrome 1"
[5] "advanced sleep phase syndrome 4"
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] "autosomal dominant cerebellar ataxia, deafness and narcolepsy"
[2] "hereditary sensory neuropathy-deafness-dementia syndrome"
[3] "rapid eye movement sleep disorder"
[4] "substance-induced sleep disorder"
[5] "drug induced central sleep apnea"
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 = "(?=,|$)|\\b"),
"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_2019_global_disease_burden_rate_all_ages.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] "Acute glomerulonephritis"
[3] "Acute glomerulonephritis"
[4] "Bacterial skin diseases"
[5] "Bacterial skin diseases"
[6] "Bacterial skin diseases"
[7] "Bladder cancer"
[8] "Bladder cancer"
[9] "Bladder cancer"
[10] "Brain and central nervous system cancer"
[11] "Brain and central nervous system cancer"
[12] "Brain and central nervous system cancer"
[13] "Cardiomyopathy and myocarditis"
[14] "Cardiomyopathy and myocarditis"
[15] "Cardiomyopathy and myocarditis"
[16] "Congenital birth defects"
[17] "Congenital birth defects"
[18] "Congenital birth defects"
[19] "Diabetes mellitus type 1"
[20] "Diabetes mellitus type 1"
[21] "Diabetes mellitus type 1"
[22] "Diabetes mellitus type 2"
[23] "Diabetes mellitus type 2"
[24] "Diabetes mellitus type 2"
[25] "Drug use disorders"
[26] "Drug use disorders"
[27] "Drug use disorders"
[28] "Endocrine metabolic blood and immune disorders"
[29] "Endocrine metabolic blood and immune disorders"
[30] "Endocrine metabolic blood and immune disorders"
[31] "Fungal skin diseases"
[32] "Fungal skin diseases"
[33] "Fungal skin diseases"
[34] "Gallbladder and biliary tract cancer"
[35] "Gallbladder and biliary tract cancer"
[36] "Gallbladder and biliary tract cancer"
[37] "Hemoglobinopathies and hemolytic anemias"
[38] "Hemoglobinopathies and hemolytic anemias"
[39] "Hemoglobinopathies and hemolytic anemias"
[40] "Idiopathic developmental intellectual disability"
[41] "Idiopathic developmental intellectual disability"
[42] "Idiopathic epilepsy"
[43] "Idiopathic epilepsy"
[44] "Idiopathic epilepsy"
[45] "Inguinal femoral and abdominal hernia"
[46] "Inguinal femoral and abdominal hernia"
[47] "Inguinal femoral and abdominal hernia"
[48] "Interstitial lung disease and pulmonary sarcoidosis"
[49] "Interstitial lung disease and pulmonary sarcoidosis"
[50] "Interstitial lung disease and pulmonary sarcoidosis"
[51] "Lower extremity peripheral arterial disease"
[52] "Lower extremity peripheral arterial disease"
[53] "Lower extremity peripheral arterial disease"
[54] "Malignant neoplasm of bone and articular cartilage"
[55] "Malignant neoplasm of bone and articular cartilage"
[56] "Malignant neoplasm of bone and articular cartilage"
[57] "Malignant skin melanoma"
[58] "Malignant skin melanoma"
[59] "Malignant skin melanoma"
[60] "Nasopharynx cancer"
[61] "Nasopharynx cancer"
[62] "Nasopharynx cancer"
[63] "Neuroblastoma and other peripheral nervous cell tumors"
[64] "Neuroblastoma and other peripheral nervous cell tumors"
[65] "Neuroblastoma and other peripheral nervous cell tumors"
[66] "Non-rheumatic valvular heart disease"
[67] "Non-rheumatic valvular heart disease"
[68] "Non-rheumatic valvular heart disease"
[69] "Oral disorders"
[70] "Oral disorders"
[71] "Oral disorders"
[72] "Other cardiovascular and circulatory diseases"
[73] "Other cardiovascular and circulatory diseases"
[74] "Other chronic respiratory diseases"
[75] "Other digestive diseases"
[76] "Other malignant neoplasms"
[77] "Other malignant neoplasms"
[78] "Other malignant neoplasms"
[79] "Other mental disorders"
[80] "Other mental disorders"
[81] "Other mental disorders"
[82] "Other musculoskeletal disorders"
[83] "Other musculoskeletal disorders"
[84] "Other neoplasms"
[85] "Other neoplasms"
[86] "Other neoplasms"
[87] "Other neurological disorders"
[88] "Other neurological disorders"
[89] "Other neurological disorders"
[90] "Other sense organ diseases"
[91] "Other sense organ diseases"
[92] "Other sense organ diseases"
[93] "Other skin and subcutaneous diseases"
[94] "Other skin and subcutaneous diseases"
[95] "Other skin and subcutaneous diseases"
[96] "Paralytic ileus and intestinal obstruction"
[97] "Paralytic ileus and intestinal obstruction"
[98] "Paralytic ileus and intestinal obstruction"
[99] "Pulmonary Arterial Hypertension"
[100] "Pulmonary Arterial Hypertension"
[101] "Pulmonary Arterial Hypertension"
[102] "Scabies"
[103] "Scabies"
[104] "Scabies"
[105] "Soft tissue and other extraosseous sarcomas"
[106] "Soft tissue and other extraosseous sarcomas"
[107] "Soft tissue and other extraosseous sarcomas"
[108] "Sudden infant death syndrome"
[109] "Total burden related to Non-alcoholic fatty liver disease (NAFLD)"
[110] "Total burden related to Non-alcoholic fatty liver disease (NAFLD)"
[111] "Total burden related to Non-alcoholic fatty liver disease (NAFLD)"
[112] "Upper digestive system diseases"
[113] "Upper digestive system diseases"
[114] "Upper digestive system diseases"
[115] "Urinary diseases and male infertility"
[116] "Urinary diseases and male infertility"
[117] "Urinary diseases and male infertility"
[118] "Vascular intestinal disorders"
[119] "Vascular intestinal disorders"
[120] "Vascular intestinal disorders"
[121] "Viral skin diseases"
[122] "Viral skin diseases"
[123] "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)`
Warning in left_join(gwas_disease_traits, gbd_data): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 3 of `x` matches multiple rows in `y`.
ℹ Row 19 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
"many-to-many"` to silence this warning.
cause measure
1 idiopathic cardiomyopathy <NA>
2 cleft lip <NA>
3 tracheal bronchus and lung cancer DALYs (Disability-Adjusted Life Years)
4 tracheal bronchus and lung cancer Prevalence
5 tracheal bronchus and lung cancer Incidence
6 tracheal bronchus and lung 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.36100 627.79984 532.74652
4 Global Both All ages Rate 2019 40.27440 43.51721 37.12978
5 Global Both All ages Rate 2019 28.16826 30.49575 25.77712
6 Global Both All ages Rate 2019 580.36100 627.79984 532.74652
gwas_study_info |> select(cause = l2_all_disease_terms) |>
distinct() |>
left_join(gbd_data) |>
head()
Joining with `by = join_by(cause)`
cause measure
<char> <char>
1: <NA>
2: idiopathic cardiomyopathy <NA>
3: cleft lip <NA>
4: tracheal bronchus and lung cancer DALYs (Disability-Adjusted Life Years)
5: tracheal bronchus and lung cancer Prevalence
6: tracheal bronchus and lung cancer Incidence
location sex age metric year val upper lower
<char> <char> <char> <char> <int> <num> <num> <num>
1: <NA> <NA> <NA> <NA> NA NA NA NA
2: <NA> <NA> <NA> <NA> NA NA NA NA
3: <NA> <NA> <NA> <NA> NA NA NA NA
4: Global Both All ages Rate 2019 580.36100 627.79984 532.74652
5: Global Both All ages Rate 2019 40.27440 43.51721 37.12978
6: Global Both All ages Rate 2019 28.16826 30.49575 25.77712
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] 1748
# 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 7089
type 2 diabetes mellitus depressive disorders
922 513
alzheimer's disease and other dementias ischemic heart disease
509 501
benign neoplasm schizophrenia
434 368
breast cancer asthma
355 348
gwas_study_info <- fwrite(gwas_study_info,
here::here("output/gwas_cat/gwas_study_info_trait_group_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