Last updated: 2025-12-29
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 5bf8942. 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: .venv/
Ignored: analysis/.DS_Store
Ignored: ancestry_dispar_env/
Ignored: data/.DS_Store
Ignored: data/cdc/
Ignored: data/cohort/
Ignored: data/gbd/.DS_Store
Ignored: data/gbd/IHME-GBD_2021_DATA-d8cf695e-1.csv
Ignored: data/gbd/IHME-GBD_2023_DATA-73cc01fd-1.csv
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/icd/.DS_Store
Ignored: data/icd/2025AA/
Ignored: data/icd/IHME_GBD_2019_COD_CAUSE_ICD_CODE_MAP_Y2020M10D15.XLSX
Ignored: data/icd/IHME_GBD_2019_NONFATAL_CAUSE_ICD_CODE_MAP_Y2020M10D15.XLSX
Ignored: data/icd/IHME_GBD_2021_COD_CAUSE_ICD_CODE_MAP_Y2024M05D16.XLSX
Ignored: data/icd/IHME_GBD_2021_NONFATAL_CAUSE_ICD_CODE_MAP_Y2024M05D16.XLSX
Ignored: data/icd/UK_Biobank_master_file.tsv
Ignored: data/icd/cdc_valid_icd10_Sep_23_2025.xlsx
Ignored: data/icd/cdc_valid_icd9_Sep_23_2025.xlsx
Ignored: data/icd/hp_umls_mapping.csv
Ignored: data/icd/lancet_conditions_icd10.xlsx
Ignored: data/icd/manual_disease_icd10_mappings.xlsx
Ignored: data/icd/mondo_umls_mapping.csv
Ignored: data/icd/phecode_international_version_unrolled.csv
Ignored: data/icd/phecode_to_icd10_manual_mapping.xlsx
Ignored: data/icd/semiautomatic_ICD-pheno.txt
Ignored: data/icd/semiautomatic_ICD-pheno_UKB_subset.txt
Ignored: data/icd/umls-2025AA-mrconso.zip
Ignored: figures/
Ignored: human_dictionary/
Ignored: igsr_populations.tsv
Ignored: output/.DS_Store
Ignored: output/abstracts/
Ignored: output/doccano/
Ignored: output/fulltexts/
Ignored: output/gwas_cat/
Ignored: output/gwas_cohorts/
Ignored: output/icd_map/
Ignored: output/trait_ontology/
Ignored: pubmedbert-cohort-ner-model/
Ignored: pubmedbert-cohort-ner/
Ignored: r-spacyr/
Ignored: renv/
Ignored: venv/
Ignored: visualization.Rdata
Unstaged changes:
Modified: .gitignore
Modified: analysis/disease_inves_by_ancest.Rmd
Modified: analysis/get_full_text.Rmd
Modified: analysis/gwas_to_gbd.Rmd
Modified: analysis/index.Rmd
Modified: analysis/missing_cohort_info.Rmd
Modified: analysis/replication_ancestry_bias.Rmd
Modified: analysis/text_for_cohort_labels.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/grouping_infectious_diseases.Rmd) and HTML
(docs/grouping_infectious_diseases.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 | 5bf8942 | IJbeasley | 2025-12-29 | Archiving old GWAS trait conversion |
| html | 2722d2d | IJbeasley | 2025-10-08 | Build site. |
| Rmd | 81a7bd1 | IJbeasley | 2025-10-08 | No longer removing many infectious diseases |
library(dplyr)
library(data.table)
library(stringr)
source(here::here("code/get_term_descendants.R"))
gwas_study_info <- fread(here::here("output/gwas_cat/gwas_study_info_disease_trait_simplified.csv"))
diseases <- stringr::str_split(pattern = ", ",
gwas_study_info$collected_all_disease_terms[gwas_study_info$collected_all_disease_terms != ""]) |>
unlist() |>
stringr::str_trim()
length(unique(diseases))
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("hiv-1 infection"),
"hiv infection"
))
tb_terms <- c("mycobacterium tuberculosis infection",
"pulmonary tuberculosis",
"extrapulmonary tuberculosis",
"meningeal tuberculosis")
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
pattern = vec_to_grep_pattern(tb_terms),
"tuberculosis"
))
# in the case of acute / chronic bronchitis, we will remove only acute
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute bronchitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("bronchitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("bronchitis"),
"acute bronchitis"),
collected_all_disease_terms
))
# if bronchitis is specified as chronic in DISEASE/TRAIT, replace bronchitis with chronic bronchitis
# in to collected_all_disease_terms
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("chronic bronchitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("bronchitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("bronchitis"),
"chronic bronchitis"),
collected_all_disease_terms
))
# similar, for bronchiolitis, remove if acute
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute bronchiolitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("bronchiolitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("bronchiolitis"),
"acute bronchiolitis"),
collected_all_disease_terms
))
# remove larygitis, if acute
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute laryngitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("laryngitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("laryngitis"),
"acute laryngitis"),
collected_all_disease_terms
))
# if laryngitis is specified as acute in DISEASE/TRAIT, remove disease from collected_all_disease_terms
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute laryngitis", `DISEASE/TRAIT`, ignore.case = T) &
collected_all_disease_terms == "disease",
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("disease"),
"acute laryngitis"),
collected_all_disease_terms
))
# if laryngitis is specified as chronic in DISEASE/TRAIT, replace laryngitis with chronic laryngitis
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("chronic laryngitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("laryngitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("laryngitis"),
"chronic laryngitis"),
collected_all_disease_terms
))
# for tonsillitis, remove if acute
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute tonsillitis|ICD10 J03", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("tonsillitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("tonsillitis"),
"acute tonsillitis"),
collected_all_disease_terms
))
# remove disease, if DISEASE/TRAIT contains acute tonsillitis
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("acute tonsillitis", `DISEASE/TRAIT`, ignore.case = T) &
collected_all_disease_terms == "disease",
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("disease"),
"acute tonsillitis"),
collected_all_disease_terms
))
# for tonsillitis, if chronic in DISEASE/TRAIT, replace tonsillitis with chronic tonsillitis
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("chronic tonsillitis", `DISEASE/TRAIT`, ignore.case = T) &
grepl(vec_to_grep_pattern("tonsillitis"),
collected_all_disease_terms,
ignore.case = T,
perl = T),
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("tonsillitis"),
"chronic tonsillitis"),
collected_all_disease_terms
))
url <- "http://www.ebi.ac.uk/ols4/api/ontologies/doid/terms/http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FDOID_10754/descendants"
otitis_media_terms <- get_descendants(url)
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
pattern = vec_to_grep_pattern(otitis_media_terms),
"otitis media"
))
# where collected_all_disease_terms==disease, and otitis media in DISEASE/TRAIT, remove disease
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("otitis media", `DISEASE/TRAIT`, ignore.case = T) &
collected_all_disease_terms == "disease",
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("disease"),
"otitis media"),
collected_all_disease_terms
))
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("influenza a \\(h1n1\\)"),
"influenza"
))
# if diarrhea is caused by IBS, add ibs to collected_all_disease_terms
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(grepl("IBS", `DISEASE/TRAIT`, ignore.case = T) &
grepl("diarrhea", collected_all_disease_terms, ignore.case = T),
paste0(collected_all_disease_terms, ", irritable bowel syndrome"),
collected_all_disease_terms
)
)
# remove dysentery
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_remove_all(collected_all_disease_terms,
pattern = vec_to_grep_pattern("dysentery")
)
)
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern(
c("plasmodium falciparum malaria",
"plasmodium vivax malaria"
)),
"malaria"
))
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
pattern = vec_to_grep_pattern(c(
"visceral leishmaniasis",
"cutaneous leishmaniasis")
),
"leishmaniasis"
)
)
gwas_study_info =
gwas_study_info |>
mutate(collected_all_disease_terms =
stringr::str_replace_all(collected_all_disease_terms,
vec_to_grep_pattern("dengue hemorrhagic fever"),
"dengue"
))
gwas_study_info |>
filter(grepl("dengue", collected_all_disease_terms, ignore.case = T)) |>
select(`DISEASE/TRAIT`, collected_all_disease_terms)
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms =
ifelse(`DISEASE/TRAIT` == "Acute hepatitis A infection",
stringr::str_replace_all(collected_all_disease_terms,
pattern = vec_to_grep_pattern("hepatitis a infection"),
"acute hepatitis a infection"
),
collected_all_disease_terms
)
)
gwas_study_info =
gwas_study_info |>
rowwise() |>
mutate(collected_all_disease_terms = paste0(sort(unique(unlist(strsplit(collected_all_disease_terms, ", ")))),
collapse = ", ")
) |>
ungroup()
gwas_study_info = gwas_study_info |>
mutate(collected_all_disease_terms = stringr::str_remove_all(collected_all_disease_terms, "^,|,$")
) |>
mutate(collected_all_disease_terms = stringr::str_trim(collected_all_disease_terms)
)
n_studies_trait = gwas_study_info |>
dplyr::filter(DISEASE_STUDY == T) |>
dplyr::select(collected_all_disease_terms, PUBMED_ID) |>
dplyr::distinct() |>
dplyr::group_by(collected_all_disease_terms) |>
dplyr::summarise(n_studies = dplyr::n()) |>
dplyr::arrange(desc(n_studies))
head(n_studies_trait)
dim(n_studies_trait)
diseases <- stringr::str_split(pattern = ", ",
gwas_study_info$collected_all_disease_terms[gwas_study_info$collected_all_disease_terms != ""]) |>
unlist() |>
stringr::str_trim()
length(unique(diseases))
fwrite(gwas_study_info,
here::here("output/gwas_cat/gwas_study_info_disease_trait_filtered.csv"))
sessionInfo()