Skip to content

Commit

Permalink
lbommi score list updated
Browse files Browse the repository at this point in the history
  • Loading branch information
aminuldu07 committed Dec 14, 2024
1 parent c419c91 commit dda9e82
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 450 deletions.
5 changes: 3 additions & 2 deletions R/get_lb_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ get_lb_score <- function(studyid = NULL,

# # Filtering the tk animals and the recovery animals
# # Remove the TK animals and Recovery animals
# LB_tk_recovery_filtered <- max_visitdy_df %>%
# dplyr::filter(USUBJID %in% master_compiledata$USUBJID)

LB_tk_recovery_filtered <- max_visitdy_df %>%
dplyr::filter(USUBJID %in% master_compiledata$USUBJID)

# Perform a left join to match USUBJID and get ARMCD ## 020924
#-inner_join() used instead of left_join()#199
Expand Down
10 changes: 9 additions & 1 deletion R/get_liver_om_lb_mi_tox_score_list.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


#' @title get_liver_om_lb_mi_tox_score_list
#' @param selected_studies Mandatory, character \cr
#' Studyid number
Expand Down Expand Up @@ -107,14 +109,17 @@ if(output_individual_scores ) {
stringsAsFactors = FALSE)
}

#---------------------------------------------------------------------------
#---------------------------------------------------------------------------

# iterate over studyid or each xpt folder
for (studyid in selected_studies){

print(studyid)

if( multiple_xpt_folder == TRUE) {

path_db <- studyid
path_db <- studyid # giving the path of the xpt folder

print(path_db)
}
Expand Down Expand Up @@ -630,6 +635,9 @@ for (studyid in selected_studies){

}

#---------------------------------------------------------------------------
#---------------------------------------------------------------------------

if (output_individual_scores) {

# Perform the merge using full_join to keep all rows from each data frame
Expand Down
50 changes: 50 additions & 0 deletions R/get_repeat_dose_parallel_studyids.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

get_repeat_dose_parallel_studyids <- function (databasetype = NULL ) {


# #Database Load
# dbtoken <- sendigR::initEnvironment(dbType = 'sqlite',
# dbPath = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/TestDB.db",
# dbCreate = FALSE)
#
# parallel_StudyID <- sendigR::getStudiesSDESIGN(dbtoken, studyDesignFilter = "PARALLEL")
#
#
# # Filtering the Repeat dose Studies
# repeat_dose_STUDYIDs <- sendigR::genericQuery(dbtoken, queryString = "SELECT DISTINCT STUDYID
# FROM ts
# WHERE TSPARMCD = 'SSTYP'
# AND TSVAL IN ('REPEAT DOSE TOXICITY', 'REPEAT-DOSE TOXICITY', 'Repeat-Dose Toxicity', 'Repeat Dose Toxicity')",
# queryParams = NULL)
#
# # COMMON STUDYIDs from PARALLEL STUDYIDs and repeat_dose_STUDYIDs.....
# parallel_repeat_dose_intersect <- intersect(parallel_StudyID$STUDYID,repeat_dose_STUDYIDs$STUDYID)
#
# # converting "parallel_repeat_dose_intersect" to a data frame
# parallel_repeat_dose_intersec_df <- data.frame(STUDYID = parallel_repeat_dose_intersect)
#
# # convert to a vector( selected_studies should be always vector)
# #selected_studies <- as.vector(parallel_repeat_dose_intersec_df$STUDYID)
#
# # get the studies for the rat only species
# rat_STUDYID_ts_species <- sendigR::genericQuery(dbtoken, queryString = "SELECT STUDYID, TSPARMCD, TSVAL
# FROM ts
# WHERE TSPARMCD = 'SPECIES' AND UPPER(TSVAL) LIKE '%RAT%'", queryParams = NULL)
#
# selected_studies <- as.vector(rat_STUDYID_ts_species$STUDYID)
# #selected_studies <- c("2170016", "1021-9743")
# #selected_studies <- c("2170016")
# #selected_studies <- c("8514252")
#
# path_db='C:/Users/mdaminulisla.prodhan/OneDrive - FDA/TestDB.db'
# start_time <- Sys.time()
# allscore <- get_liver_om_lb_mi_tox_score_list(selected_studies,
# path_db,
# fake_study = FALSE,
# output_individual_scores = TRUE)
# end_time <- Sys.time()
# time_taken <- end_time - start_time
# print(time_taken)
# #####
#
}
52 changes: 52 additions & 0 deletions inst/test_get_liver_om_lb_mi_score_list.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
rm(list = ls())
devtools::load_all(".")

# #Database Load
# dbtoken <- sendigR::initEnvironment(dbType = 'sqlite',
# dbPath = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/TestDB.db",
# dbCreate = FALSE)


path_db='C:/Users/MdAminulIsla.Prodhan/OneDrive - FDA/Documents/DATABASES/TestDB.db'

#selected_studies <- c("2170016")



R_SQL_om_lb_mi_CD <- get_liver_om_lb_mi_tox_score_list (selected_studies = selected_studies,
path_db = path_db,
fake_study = FALSE,
use_xpt_file = FALSE,
multiple_xpt_folder = FALSE,
output_individual_scores = FALSE,
output_zscore_by_USUBJID = FALSE)

# For multiple xpt folder

selected_studies <- list.dirs(path_db , full.names = TRUE, recursive = FALSE)

R_XPT_om_lb_mi_CD <- get_liver_om_lb_mi_tox_score_list (selected_studies = selected_studies,
path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/real_xpt_dir/IND051292_1017-3581',
fake_study = FALSE,
use_xpt_file = FALSE,
multiple_xpt_folder = FALSE,
output_individual_scores = FALSE,
output_zscore_by_USUBJID = FALSE)


selected_studies <- c("10663")
fake_SQL_om_lb_mi_CD <- get_liver_om_lb_mi_tox_score_list (selected_studies = selected_studies,
path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/liver_1.db',
fake_study = FALSE,
use_xpt_file = FALSE,
multiple_xpt_folder = FALSE,
output_individual_scores = FALSE,
output_zscore_by_USUBJID = FALSE)

fake_XPT_om_lb_mi_CD <- get_liver_om_lb_mi_tox_score_list (selected_studies = NULL,
path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/all_fakedata_liver_/FAKE10663',
fake_study = FALSE,
use_xpt_file = FALSE,
multiple_xpt_folder = FALSE,
output_individual_scores = FALSE,
output_zscore_by_USUBJID = FALSE)
36 changes: 35 additions & 1 deletion inst/test_get_mi_score.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,39 @@ reat_XPT_mi_score <- get_mi_score(studyid=NULL,




# #####----mi-score--calculation-------------------------
#
# rm(list = ls())
# devtools::load_all(".")
# mi_R_SQL_mi_zscore <- get_mi_score(studyid='A2018086-T002-01',
# path_db='C:/Users/mdaminulisla.prodhan/OneDrive - FDA/TestDB.db',
# fake_study = FALSE,
# use_xpt_file = FALSE,
# master_compiledata = NULL,
# return_individual_scores = TRUE)
#
#
# mi_R_XPT_mi_zscore <- get_mi_score (studyid= NULL,
# path_db='C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/real_xpt_dir/IND051292_1017-3581',
# fake_study = FALSE,
# use_xpt_file = TRUE,
# master_compiledata = NULL,
# return_individual_scores = TRUE)
#
#
# mi_fake_SQL_mi_zscore <- get_mi_score (studyid = '10663',
# path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/liver_1.db',
# fake_study = TRUE,
# use_xpt_file = FALSE,
# master_compiledata = NULL,
# return_individual_scores = TRUE)
#
#
# mi_fake_XPT_mi_zscore <- get_mi_score (studyid = NULL,
# path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/all_fakedata_liver_/FAKE10663',
# fake_study = TRUE,
# use_xpt_file = TRUE,
# master_compiledata = NULL,
# return_individual_scores = TRUE)
#

62 changes: 62 additions & 0 deletions inst/test_random_forest_model.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@


### ###########################-randomforestmodel-#############################
# rm(list = ls())
# devtools::load_all(".")
#
# # #Database Load
# dbtoken_liver <- sendigR::initEnvironment(dbType = 'sqlite',
# #dbPath = "/opt/rstudio/users/MdAminulIslam.Prodhan/DataCentral.db",
# dbPath = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/liver_1.db",
# dbCreate = FALSE)
# # get the studies for the rat only species
# STUDYID_liver <- sendigR::genericQuery(dbtoken_liver, queryString = "SELECT DISTINCT STUDYID, DOMAIN
# FROM bw ", queryParams = NULL)
#
# selected_studies_liver <- as.vector(STUDYID_liver$STUDYID)
#
#
#
# Liver_get_liver_om_lb_mi_tox_score_list <- get_liver_om_lb_mi_tox_score_list (selected_studies = selected_studies_liver,
# path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/liver_1.db',
# fake_study = TRUE,
# use_xpt_file = FALSE,
# output_individual_scores = TRUE)
#
#
#
# dbtoken_not_liver <- sendigR::initEnvironment(dbType = 'sqlite',
# #dbPath = "/opt/rstudio/users/MdAminulIslam.Prodhan/DataCentral.db",
# dbPath = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/fake_not_liver_update.db",
# dbCreate = FALSE)
#
# # get the studies for the rat only species
# STUDYID_not_liver <- sendigR::genericQuery(dbtoken_not_liver, queryString = "SELECT DISTINCT STUDYID, DOMAIN
# FROM bw ", queryParams = NULL)
#
# selected_studies_not_liver <- as.vector(STUDYID_not_liver$STUDYID)
#
#
# not_Liver_get_liver_om_lb_mi_tox_score_list <- get_liver_om_lb_mi_tox_score_list (selected_studies = selected_studies_not_liver,
# path_db = 'C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/fake_not_liver_update.db',
# fake_study = TRUE,
# use_xpt_file = FALSE,
# output_individual_scores = TRUE)
#
#
#
# amin_get_random_forest_model <- get_random_forest_model(Liver_get_liver_om_lb_mi_tox_score_list,
# not_Liver_get_liver_om_lb_mi_tox_score_list)
#
#


#
dbPath_liver = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/liver_1.db"
dbPath_not_liver = "C:/Users/mdaminulisla.prodhan/OneDrive - FDA/2023-2024_projects/FAKE_DATABASES/fake_not_liver_update.db"

predicted_rf <- predicted_random_forest_model(dbPath_liver, dbPath_not_liver)




Loading

0 comments on commit dda9e82

Please sign in to comment.