#Import Supplementary 4,6,7 file with data: data <- read_excel("FILE_NAME.xlsx") data <- data[1:100,] #Chech if correct supplementary file was imported check<-names(data)==c("Variant", "Chromosome", "Position", "Alt", "Ref", "Eaf_Ref", "HR", "LCL", "UCL", "Pvalue", "BFDP") ifelse (sum(check)==length(check), {"Right file was imported"}, {"Wrong file was loaded, please change input file"} ) library(gap) T <- 0.8 #Values for the prior pi0 <- c(0.0001) #Enter the value of the OR that is the 97.5% point of the prior ORhi <- 1.3 #exp(.18) W <- (log(ORhi)/1.96)^2 #Loop over file: BFDP_Result <- list() for (i in 1:nrow(data)){ pvalue <- data$Pvalue[[i]] HR <- data$HR[[i]] logHR <- log(HR) selogHR <- log(HR)/qnorm(1-pvalue/2) q1 <- BFDP(logHR,selogHR^2,pi0,W, logscale=TRUE) BFDP_Result[[i]] <- q1$BFDP } BFDP_Result #Convert list to matrix #BFDP_Matrix <- as.matrix(BFDP_Result)