diff --git a/ASGA/bin/Packages/Analysis/A_KMT_Minus_End_Seeds.R b/ASGA/bin/Packages/Analysis/A_KMT_Minus_End_Seeds.R index 1fb4e9f..2df3409 100644 --- a/ASGA/bin/Packages/Analysis/A_KMT_Minus_End_Seeds.R +++ b/ASGA/bin/Packages/Analysis/A_KMT_Minus_End_Seeds.R @@ -11,5 +11,72 @@ # Set-up analysis -------------------------------------------------------------- A_KMT_Minus_End_Seeds <- function (input, output, session){ +# Analyze (-) ends nucleation from the KMT for Pole1 --------------------------- + total <- as.numeric(length(which(colnames(Segments) == "Pole1_00") : as.numeric(which(colnames(Segments) == "Pole2_00"))) - 1) + + progressSweetAlert( + session = session, id = "P_nucleation1", + title = "Calculating (-) nucleated from the KMT for Pole1...", + display_pct = TRUE, value = 0 + ) + + KMTs_minus_seed_P1 <- Minus_end_seed(which(colnames(Segments) == "Pole1_00")) + + for(m in as.numeric(which(colnames(Segments) == "Pole1_00")+1):as.numeric(which(colnames(Segments) == "Pole2_00") - 1)){ + tryCatch({ + assign("DF", + Minus_end_seed(m)) + KMTs_minus_seed_P1 <- rbind(KMTs_minus_seed_P1, + DF) + }, + error = function(e){}) + + updateProgressBar( + session = session, + id = "P_nucleation1", + value = round((i - 1) / total * 100, + 0) + ) + Sys.sleep(0.1) + } + KMTs_minus_seed_P1 <<- KMTs_minus_seed_P1 + closeSweetAlert(session = session) + +# Analyze (-) ends nucleation from the KMT for Pole2 --------------------------- + total <- which(colnames(Segments) == colnames(Segments %>% select(starts_with("Pole")))[ncol(Segments %>% select(starts_with("Pole")))]) - + as.numeric(which(colnames(Segments) == "Pole2_00") - 1) + + progressSweetAlert( + session = session, id = "P_nucleation2", + title = "Calculating (-) nucleated from the KMT for Pole2...", + display_pct = TRUE, value = 0 + ) + + if(nrow(Pole2_00) == 0){ + KMTs_minus_seed_P2 <- data.frame() + + } else { + KMTs_minus_seed_P2 <- Minus_end_seed(which(colnames(Segments) == "Pole2_00")) + + } + + for(i in as.numeric(which(colnames(Segments) == "Pole2_00")+1) : as.numeric(ncol(Segments) - 4)){ + tryCatch({ + assign("DF", + Minus_end_seed(i)) + KMTs_minus_seed_P2 <- rbind(KMTs_minus_seed_P2, + DF) + }, + error = function(e){}) + updateProgressBar( + session = session, + id = "P_nucleation2", + value = round((i - as.numeric(which(colnames(Segments) == "Pole2_00") - 1)) / total * 100, + 0) + ) + Sys.sleep(0.1) + } + KMTs_minus_seed_P2 <<- KMTs_minus_seed_P2 + closeSweetAlert(session = session) } \ No newline at end of file diff --git a/ASGA/server.r b/ASGA/server.r index 3d0293f..92bc8c2 100644 --- a/ASGA/server.r +++ b/ASGA/server.r @@ -71,38 +71,38 @@ function(input, output, session) { # Relativity for Pre-Analysis ----------------------------------------------- observeEvent(input$`Submit`,{ callModule(PreAnalysis, "Home") - - if(input$`Home-All_Anaysis` == TRUE){ - callModule(A_KMT_number, "Home") - callModule(A_IKD, "Home") - callModule(A_Curvature, "Home") - callModule(A_End_Morphology, "Home") - callModule(A_Fiber_Area, "Home") - # callModule(A_KMT_Minus_End_Seeds, "Home") - } - - if(input$`Home-KMT_number` == TRUE){ - callModule(A_KMT_number, "Home") - } - - if(input$`Home-IKD` == TRUE){ - callModule(A_IKD, "Home") - } - - if(input$`Home-Curvature` == TRUE){ - callModule(A_Curvature, "Home") - } - - if(input$`Home-End_Morphology` == TRUE){ - callModule(A_End_Morphology, "Home") - } - - if(input$`Home-Fiber_Area` == TRUE){ - callModule(A_Fiber_Area, "Home") - } - - # if(input$`Home-KMT_Minus_End_Seeds` == TRUE){ - # callModule(A_KMT_Minus_End_Seeds, "Home") - # } -}) - } \ No newline at end of file + + if(input$`Home-All_Anaysis` == TRUE){ + callModule(A_KMT_number, "Home") + callModule(A_IKD, "Home") + callModule(A_Curvature, "Home") + callModule(A_End_Morphology, "Home") + callModule(A_Fiber_Area, "Home") + callModule(A_KMT_Minus_End_Seeds, "Home") + } + + if(input$`Home-KMT_number` == TRUE){ + callModule(A_KMT_number, "Home") + } + + if(input$`Home-IKD` == TRUE){ + callModule(A_IKD, "Home") + } + + if(input$`Home-Curvature` == TRUE){ + callModule(A_Curvature, "Home") + } + + if(input$`Home-End_Morphology` == TRUE){ + callModule(A_End_Morphology, "Home") + } + + if(input$`Home-Fiber_Area` == TRUE){ + callModule(A_Fiber_Area, "Home") + } + + if(input$`Home-KMT_Minus_End_Seeds` == TRUE){ + callModule(A_KMT_Minus_End_Seeds, "Home") + } + }) +} \ No newline at end of file