Skip to content

Commit

Permalink
added new ontologies to simulate bff/pxf
Browse files Browse the repository at this point in the history
  • Loading branch information
IvoLeist committed Feb 21, 2024
1 parent 94e3402 commit b4fcce7
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 75 deletions.
11 changes: 0 additions & 11 deletions data/diseases_onts.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions data/phenos_onts.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions data/treatments_onts.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions data/weights_defaults.yaml

This file was deleted.

100 changes: 90 additions & 10 deletions phenoRankeR/R/mod_sim_mode.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ mod_sim_mode_ui <- function(id){
height = "200px"
)
),
tabPanel(
title = "exposures",
aceEditor(
ns("yamlEditor_expos"),
value = onts_defaults_phenos,
mode = "yaml",
theme = "github",
height = "200px"
)
),
tabPanel(
title = "phenotypicFeatures",
aceEditor(
Expand All @@ -117,6 +127,16 @@ mod_sim_mode_ui <- function(id){
height = "200px"
)
),
tabPanel(
title = "procedures",
aceEditor(
ns("yamlEditor_procedures"),
value = onts_defaults_procedures,
mode = "yaml",
theme = "github",
height = "200px"
)
),
tabPanel(
title = "treatments",
aceEditor(
Expand Down Expand Up @@ -212,10 +232,29 @@ onts_defaults_treatments <- loadOntologyDefaults(
"treatments"
)

writeYAMLDataToFile <- function(yaml_diseases, yaml_phenos, yaml_treatments) {
onts_defaults_procedures <- loadOntologyDefaults(
"inst/extdata/defaults/procedures_onts.yaml",
"procedures"
)

onts_defaults_exposures <- loadOntologyDefaults(
"inst/extdata/defaults/exposures_onts.yaml",
"exposures"
)

writeYAMLDataToFile <- function(
yaml_diseases,
yaml_expos,
yaml_phenos,
yaml_procedures,
yaml_treatments
) {

yaml_data <- list()
yaml_data$diseases <- yaml.load(yaml_diseases)
yaml_data$exposures <- yaml.load(yaml_expos)
yaml_data$phenotypicFeatures <- yaml.load(yaml_phenos)
yaml_data$procedures <- yaml.load(yaml_procedures)
yaml_data$treatments <- yaml.load(yaml_treatments)

timestamp <- format(Sys.time(), "%Y%m%d%H%M%S")
Expand Down Expand Up @@ -245,19 +284,32 @@ simulate_data <- function(outputFormat, simulationId, simSettings) {
".json"
)

print("simSettings")
print(simSettings)

settings_diseases <- paste0(
"-diseases ", simSettings[1],
" -max-diseases-pool ", simSettings[2]
)

settings_exposures <- paste0(
"-exposures ", simSettings[3],
" -max-exposures-pool ", simSettings[4]
)

settings_phenos <- paste0(
"-phenotypicFeatures ", simSettings[3],
" -max-phenotypicFeatures-pool ", simSettings[4]
"-phenotypicFeatures ", simSettings[5],
" -max-phenotypicFeatures-pool ", simSettings[6]
)

settings_procedures <- paste0(
"-procedures ", simSettings[7],
" -max-procedures-pool ", simSettings[8]
)

settings_treatments <- paste0(
"-treatments ", simSettings[5],
" -max-treatments-pool ", simSettings[6]
"-treatments ", simSettings[9],
" -max-treatments-pool ", simSettings[10]
)

#normalizePath probably not needed
Expand All @@ -271,11 +323,15 @@ simulate_data <- function(outputFormat, simulationId, simSettings) {
)),
settings_diseases,
" ",
settings_exposures,
" ",
settings_phenos,
" ",
settings_procedures,
" ",
settings_treatments,
" -n ",
simSettings[7],
simSettings[11],
" -f ", outputFormat,
" -o ", fn
)
Expand Down Expand Up @@ -310,9 +366,15 @@ mod_sim_mode_server <- function(id, session, db_conn, db_driver, rv_sim){
iv$enable()

data <- data.frame(
ontologies = c("diseases", "phenotypicFeatures", "treatments"),
count = c(3, 3, 3),
max_pool_size = c(5, 5, 5)
ontologies = c(
"diseases",
"exposures",
"phenotypicFeatures",
"procedures",
"treatments"
),
count = c(3, 3, 3, 3, 3),
max_pool_size = c(5, 5, 5, 5, 5)
)

# Render the DataTable with input fields for count and max_pool_size
Expand Down Expand Up @@ -367,6 +429,8 @@ mod_sim_mode_server <- function(id, session, db_conn, db_driver, rv_sim){
updateAceEditor(session, "yamlEditor_diseases", value = "")
updateAceEditor(session, "yamlEditor_phenos", value = "")
updateAceEditor(session, "yamlEditor_treatments", value = "")
updateAceEditor(session, "yamlEditor_procedures", value = "")
updateAceEditor(session, "yamlEditor_expos", value = "")
return()
}
output$errorOutput <- renderText(yamlValid)
Expand All @@ -390,12 +454,26 @@ mod_sim_mode_server <- function(id, session, db_conn, db_driver, rv_sim){
"yamlEditor_treatments",
value = as.yaml(yaml_data$treatments)
)

updateAceEditor(
session,
"yamlEditor_procedures",
value = as.yaml(yaml_data$procedures)
)

updateAceEditor(
session,
"yamlEditor_expos",
value = as.yaml(yaml_data$exposures)
)
})

editors <- c(
"yamlEditor_diseases",
"yamlEditor_phenos",
"yamlEditor_treatments"
"yamlEditor_treatments",
"yamlEditor_procedures",
"yamlEditor_expos"
)

# TODO
Expand Down Expand Up @@ -425,7 +503,9 @@ mod_sim_mode_server <- function(id, session, db_conn, db_driver, rv_sim){

simulationId <- writeYAMLDataToFile(
input$yamlEditor_diseases,
input$yamlEditor_expos,
input$yamlEditor_phenos,
input$yamlEditor_procedures,
input$yamlEditor_treatments
)

Expand Down
20 changes: 10 additions & 10 deletions phenoRankeR/inst/extdata/defaults/diseases_onts.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diseases:
- id: "HP:0000020"
label: "Urinary incontinence"
- id: "HP:0000055"
label: "Abnormality of female external genitalia"
- id: "HP:0000141"
label: "Amenorrhea"
- id: "HP:0000553"
label: "Abnormal uvea morphology"
- id: "HP:0000630"
label: "Abnormal retinal artery morphology"
- id: OMIM:101000
label: Neurofibromatosis, type 2
- id: OMIM:102578
label: Leukemia, acute promyelocytic, somatic
- id: OMIM:103050
label: Adenylosuccinase deficiency
- id: OMIM:103900
label: Aldosteronism, glucocorticoid-remediable
- id: OMIM:104200
label: Alport syndrome, autosomal dominant
11 changes: 11 additions & 0 deletions phenoRankeR/inst/extdata/defaults/exposures_onts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exposures:
- id: NCIT:C194
label: 4-Nitroquinoline-1-Oxide
- id: NCIT:C196
label: Benzo(a)pyrene-7,8-diol 9,10-Epoxide
- id: NCIT:C197
label: Dimethylbenzanthracene
- id: NCIT:C213
label: Aflatoxin
- id: NCIT:C251
label: Anthracene
20 changes: 10 additions & 10 deletions phenoRankeR/inst/extdata/defaults/phenos_onts.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
phenotypicFeatures:
- id: "OMIM:101000"
label: "Neurofibromatosis, type 2"
- id: "OMIM:102578"
label: "Leukemia, acute promyelocytic, somatic"
- id: "OMIM:103050"
label: "Adenylosuccinase deficiency"
- id: "OMIM:103900"
label: "Aldosteronism, glucocorticoid-remediable"
- id: "OMIM:104200"
label: "Alport syndrome, autosomal dominant"
- id: HP:0000020
label: Urinary incontinence
- id: HP:0000055
label: Abnormality of female external genitalia
- id: HP:0000141
label: Amenorrhea
- id: HP:0000553
label: Abnormal uvea morphology
- id: HP:0000630
label: Abnormal retinal artery morphology
11 changes: 11 additions & 0 deletions phenoRankeR/inst/extdata/defaults/procedures_onts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
procedures:
- id: NCIT:C1447
label: Barium Enema Injection
- id: NCIT:C15189
label: Biopsy
- id: NCIT:C15190
label: Needle Biopsy
- id: NCIT:C15193
label: Bone Marrow Biopsy
- id: NCIT:C15220
label: Diagnosis
24 changes: 14 additions & 10 deletions phenoRankeR/inst/extdata/defaults/treatments_onts.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
treatments:
- id: "RxNorm:1000000"
label: "amlodipine 5 MG / hydrochlorothiazide 12.5 MG / olmesartan medoxomil 40 MG Oral Tablet [Tribenzor]"
- id: "RxNorm:1000001"
label: "amlodipine 5 MG / hydrochlorothiazide 25 MG / olmesartan medoxomil 40 MG Oral Tablet"
- id: "RxNorm:1000005"
label: "amlodipine 5 MG / hydrochlorothiazide 25 MG / olmesartan medoxomil 40 MG Oral Tablet [Tribenzor]"
- id: "RxNorm:1000009"
label: "dimethicone 100 MG/ML / miconazole nitrate 20 MG/ML / zinc oxide 100 MG/ML Topical Spray"
- id: "RxNorm:1000048"
label: "doxepin 10 MG Oral Capsule"
- id: RxNorm:1000000
label: amlodipine 5 MG / hydrochlorothiazide 12.5 MG / olmesartan medoxomil 40 MG
Oral Tablet [Tribenzor]
- id: RxNorm:1000001
label: amlodipine 5 MG / hydrochlorothiazide 25 MG / olmesartan medoxomil 40 MG
Oral Tablet
- id: RxNorm:1000005
label: amlodipine 5 MG / hydrochlorothiazide 25 MG / olmesartan medoxomil 40 MG
Oral Tablet [Tribenzor]
- id: RxNorm:1000009
label: dimethicone 100 MG/ML / miconazole nitrate 20 MG/ML / zinc oxide 100 MG/ML
Topical Spray
- id: RxNorm:1000048
label: doxepin 10 MG Oral Capsule

0 comments on commit b4fcce7

Please sign in to comment.