if (FALSE) {
# First, parse the individual databases
drugbank <- parseDrugBank("path/to/drugbank.xml")
onsides <- parseOnSIDES("path/to/onsides_csvs/")
# Now, merge them into a single, powerful object
merged_db <- merge_drugbank_onsides(drugbank, onsides)
# --- Example Analysis: Find the protein targets of all drugs known to ---
# --- cause the side effect "Hepatitis" with high confidence. ---
# 1. Find the MedDRA ID for "Hepatitis"
hepatitis_id <- merged_db$onsides$vocab_meddra_adverse_effect %>%
filter(meddra_name == "Hepatitis") %>%
pull(meddra_id)
# 2. Find all drug ingredients linked to this effect in the high_confidence table
drug_ids_causing_hepatitis <- merged_db$onsides$high_confidence_enriched %>%
filter(effect_meddra_id == hepatitis_id) %>%
pull(drugbank_id) %>%
na.omit() %>%
unique()
# 3. Look up the targets for these DrugBank IDs
targets_of_interest <- merged_db$targets %>%
filter(parent_key %in% drug_ids_causing_hepatitis) %>%
select(drug_id = parent_key, target_name = name, gene_name)
head(targets_of_interest)
}
Run the code above in your browser using DataLab