softwareDevelopment commited on
Commit
9e478fe
Β·
verified Β·
1 Parent(s): 76d17c2

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +139 -143
app.R CHANGED
@@ -1374,20 +1374,29 @@ server <- function(input, output, session) {
1374
  # ============================================================
1375
  # DATA LOADING
1376
  # ============================================================
 
 
 
1377
  observeEvent(input$genotype_file, {
1378
  req(input$genotype_file)
1379
  tryCatch({
1380
  all_data <- readLines(input$genotype_file$datapath)
 
 
1381
  if (length(all_data) < 4) { showNotification("Need β‰₯4 rows", type = "error"); return() }
1382
- header <- strsplit(all_data[1], ",")[[1]]
1383
- chromosome_row <- strsplit(all_data[2], ",")[[1]]
1384
- position_row <- strsplit(all_data[3], ",")[[1]]
1385
- genotype_data <- read.csv(text = paste(all_data[-(1:3)], collapse = "\n"), header = FALSE)
 
 
 
 
1386
  colnames(genotype_data) <- header
1387
- rownames(genotype_data) <- genotype_data[, 1]
1388
- genotype_data <- genotype_data[, -1]
1389
  for (col in colnames(genotype_data))
1390
- genotype_data[[col]] <- as.numeric(as.character(genotype_data[[col]]))
1391
  values$genotype_data <- genotype_data
1392
  values$chromosome_info <- chromosome_row[-1]
1393
  values$position_info <- suppressWarnings(as.numeric(position_row[-1]))
@@ -1396,6 +1405,8 @@ server <- function(input, output, session) {
1396
  Chromosome = chromosome_row[-1],
1397
  Position = suppressWarnings(as.numeric(position_row[-1])),
1398
  stringsAsFactors = FALSE)
 
 
1399
  showNotification(paste("Loaded", ncol(genotype_data), "markers,", nrow(genotype_data), "samples"), type = "message")
1400
  add_message("assistant", paste0("βœ… Genotype: **", ncol(genotype_data), " markers**, **", nrow(genotype_data), " samples**"))
1401
  }, error = function(e) showNotification(paste("Geno error:", e$message), type = "error"))
@@ -1427,52 +1438,31 @@ server <- function(input, output, session) {
1427
  observeEvent(input$test_genotype_file, {
1428
  req(input$test_genotype_file)
1429
  tryCatch({
1430
- # Read raw lines, strip Windows carriage returns
1431
  all_data <- readLines(input$test_genotype_file$datapath)
1432
  all_data <- gsub("\r", "", all_data)
1433
- all_data <- all_data[nchar(trimws(all_data)) > 0] # drop blank lines
1434
-
1435
  if (length(all_data) < 4) {
1436
- showNotification("Test genotype needs β‰₯4 rows (header + chr row + pos row + β‰₯1 sample)", type = "error")
1437
- return()
1438
  }
1439
-
1440
- # Parse header β€” strip any quotes and whitespace
1441
- header <- trimws(gsub('"', '', strsplit(all_data[1], ",")[[1]]))
1442
-
1443
- # Rows 4+ are sample data
1444
- sample_lines <- all_data[-(1:3)]
1445
- gd <- read.csv(text = paste(sample_lines, collapse = "\n"),
1446
- header = FALSE, stringsAsFactors = FALSE,
1447
- strip.white = TRUE, quote = '"')
1448
-
1449
  if (ncol(gd) != length(header)) {
1450
- showNotification(
1451
- paste0("Column count mismatch: header has ", length(header),
1452
- " cols but data has ", ncol(gd), " cols. Check CSV format."),
1453
- type = "error", duration = 10)
1454
- return()
1455
  }
1456
-
1457
  colnames(gd) <- header
1458
- rownames(gd) <- trimws(as.character(gd[, 1]))
1459
  gd <- gd[, -1, drop = FALSE]
1460
-
1461
- # Convert all to numeric
1462
  for (col in colnames(gd))
1463
  gd[[col]] <- suppressWarnings(as.numeric(as.character(gd[[col]])))
1464
-
1465
  values$test_genotype_data <- gd
1466
-
1467
  cat("TEST GENO LOADED:", nrow(gd), "samples,", ncol(gd), "markers\n")
1468
- cat("TEST GENO first 3 cols:", paste(colnames(gd)[1:3], collapse = ", "), "\n")
1469
-
1470
- showNotification(
1471
- paste0("βœ… Test genotype loaded: ", nrow(gd), " samples, ", ncol(gd), " markers"),
1472
- type = "message")
1473
  }, error = function(e) {
1474
- showNotification(paste("Test geno load error:", e$message), type = "error", duration = 10)
1475
- cat("TEST GENO LOAD ERROR:", e$message, "\n")
1476
  })
1477
  })
1478
 
@@ -1621,153 +1611,159 @@ server <- function(input, output, session) {
1621
  # PREDICT TEST PHENOTYPES
1622
  # ============================================================
1623
  observeEvent(input$predict_test_phenotype, {
1624
- req(values$model_fit, values$test_genotype_data)
1625
 
1626
- withProgress(message = "Predicting test phenotypes...", value = 0, {
 
 
 
 
 
 
 
 
1627
 
1628
- # ── Step 1: Validate inputs ──────────────────────────────────
1629
- incProgress(0.05, detail = "Validating inputs...")
1630
- Sys.sleep(0.08)
1631
 
1632
- model <- values$model_fit
1633
- test_raw <- values$test_genotype_data # data.frame, rows = samples
 
1634
 
1635
- # caret stores the exact predictor names it was trained on
1636
- train_cols <- if (!is.null(values$model_train_cols)) {
1637
- values$model_train_cols
1638
- } else if (!is.null(model$finalModel) && !is.null(model$coefnames)) {
1639
- model$coefnames
1640
- } else {
1641
- colnames(values$genotype_data)
 
 
 
 
 
1642
  }
1643
 
1644
- test_cols <- colnames(test_raw)
1645
- common_m <- intersect(train_cols, test_cols)
1646
- missing_m <- setdiff(train_cols, test_cols)
1647
- extra_m <- setdiff(test_cols, train_cols)
1648
 
1649
- cat("PREDICT DEBUG: train_cols =", length(train_cols),
1650
- "| test_cols =", length(test_cols),
1651
- "| common =", length(common_m),
1652
- "| missing =", length(missing_m), "\n")
 
 
1653
 
1654
- # ── Step 2: Check marker overlap ────────────────────────────
1655
- incProgress(0.10, detail = paste0("Matched ", length(common_m), " / ", length(train_cols), " markers..."))
1656
- Sys.sleep(0.08)
1657
 
1658
  if (length(common_m) == 0) {
1659
  showNotification(
1660
- paste0("No markers matched between test and training data. ",
1661
- "Make sure both CSVs use the same marker column names."),
1662
- type = "error", duration = 12)
1663
  add_message("assistant", paste0(
1664
- "❌ **Prediction failed β€” no marker overlap**\n\n",
1665
- "Training has ", length(train_cols), " markers, test has ", length(test_cols), " markers, 0 in common.\n\n",
1666
- "Fix: Ensure test CSV has identical marker column names to training CSV.\n",
1667
- "First 5 training markers: ", paste(head(train_cols, 5), collapse = ", ")))
1668
  return()
1669
  }
1670
 
1671
- if (length(missing_m) > 0) {
1672
- showNotification(
1673
- paste0(length(missing_m), " training markers absent from test β€” imputing with 0."),
1674
- type = "warning", duration = 6)
1675
- }
1676
-
1677
- # ── Step 3: Build aligned data.frame (caret requires data.frame) ──
1678
- incProgress(0.20, detail = paste0("Building aligned matrix (", nrow(test_raw), " samples)..."))
1679
- Sys.sleep(0.08)
1680
 
1681
- # Start with only common columns
1682
- X_test_df <- as.data.frame(test_raw[, common_m, drop = FALSE])
 
1683
 
1684
- # Add missing columns filled with 0
1685
- if (length(missing_m) > 0) {
1686
- fill_df <- as.data.frame(
1687
- matrix(0L, nrow = nrow(X_test_df), ncol = length(missing_m),
1688
- dimnames = list(rownames(X_test_df), missing_m))
1689
- )
1690
- X_test_df <- cbind(X_test_df, fill_df)
1691
- }
1692
 
1693
- # Reorder columns to exactly match training order
1694
- X_test_df <- X_test_df[, train_cols, drop = FALSE]
 
 
 
1695
 
1696
- # Replace any remaining NAs with column means from test data (or 0)
1697
- for (col in colnames(X_test_df)) {
1698
- na_idx <- is.na(X_test_df[[col]])
1699
- if (any(na_idx)) {
1700
- col_mean <- mean(X_test_df[[col]], na.rm = TRUE)
1701
- X_test_df[[col]][na_idx] <- if (is.finite(col_mean)) col_mean else 0
1702
- }
1703
  }
1704
 
1705
- # Ensure all columns are numeric
1706
- X_test_df <- as.data.frame(lapply(X_test_df, as.numeric))
1707
- rownames(X_test_df) <- rownames(test_raw)
1708
 
1709
- cat("PREDICT DEBUG: X_test_df dims =", nrow(X_test_df), "x", ncol(X_test_df), "\n")
1710
- cat("PREDICT DEBUG: First 3 cols match training:", all(colnames(X_test_df)[1:3] == train_cols[1:3]), "\n")
1711
-
1712
- # ── Step 4: Run prediction ───────────────────────────────────
1713
- incProgress(0.35, detail = paste0("Running RF model on ", nrow(X_test_df), " samples..."))
1714
  Sys.sleep(0.05)
1715
 
1716
  preds <- tryCatch({
1717
- predict(model, newdata = X_test_df)
1718
- }, error = function(e) {
1719
- cat("PREDICT ERROR (caret predict):", e$message, "\n")
1720
- # Fallback: try predicting from finalModel directly
1721
  tryCatch({
1722
- predict(model$finalModel, newdata = X_test_df)
 
1723
  }, error = function(e2) {
1724
- stop(paste("Primary:", e$message, "| Fallback:", e2$message))
 
 
 
 
 
 
 
 
 
1725
  })
1726
  })
1727
 
1728
- # ── Step 5: Assemble results ─────────────────────────────────
1729
- incProgress(0.20, detail = "Assembling results table...")
1730
  Sys.sleep(0.05)
1731
 
1732
- sample_ids <- rownames(X_test_df)
1733
- if (is.null(sample_ids) || all(sample_ids == as.character(seq_len(nrow(X_test_df))))) {
1734
- sample_ids <- paste0("Sample_", seq_len(nrow(X_test_df)))
1735
- }
1736
-
1737
- values$predicted_test_phenotype_data <- data.frame(
1738
- id = sample_ids,
1739
- Predicted_Phenotype = round(as.numeric(preds), 4),
1740
  stringsAsFactors = FALSE
1741
  )
1742
 
1743
- incProgress(0.10, detail = "Done!")
1744
- Sys.sleep(0.1)
 
 
 
 
 
1745
 
1746
  }) # end withProgress
1747
 
1748
- # ── Notify ────────────────────────────────────────────────────
1749
- n_pred <- nrow(values$predicted_test_phenotype_data)
1750
- train_cols <- if (!is.null(values$model_train_cols)) values$model_train_cols else colnames(values$genotype_data)
1751
- common_m <- intersect(train_cols, colnames(values$test_genotype_data))
1752
- missing_m <- setdiff(train_cols, colnames(values$test_genotype_data))
1753
 
1754
- showNotification(
1755
- paste0("βœ… Predicted ", n_pred, " test samples successfully."),
1756
- type = "message", duration = 5
1757
- )
1758
 
1759
  add_message("assistant", paste0(
1760
- "βœ… **Test phenotypes predicted successfully!**\n\n",
1761
- "β€’ **", n_pred, "** samples predicted\n",
1762
- "β€’ Training markers: **", length(train_cols), "** β†’ matched: **", length(common_m), "**",
1763
- if (length(missing_m) > 0) paste0(" (", length(missing_m), " imputed with 0)") else " βœ“ all matched",
1764
- "\nβ€’ Range: ", round(min(values$predicted_test_phenotype_data$Predicted_Phenotype), 3),
1765
- " to ", round(max(values$predicted_test_phenotype_data$Predicted_Phenotype), 3),
1766
- "\nβ€’ Preview: Data Upload β†’ 'Predicted Test Phenotype' tab\n",
1767
  "β€’ Save: click **Download Predicted Phenotypes (.xlsx)**"
1768
  ))
1769
  })
1770
 
 
1771
  # ============================================================
1772
  # DOMESTICATION
1773
  # ============================================================
@@ -2207,4 +2203,4 @@ server <- function(input, output, session) {
2207
  })
2208
  }
2209
 
2210
- shinyApp(ui = ui, server = server)
 
1374
  # ============================================================
1375
  # DATA LOADING
1376
  # ============================================================
1377
+ # Shared name-cleaner: strip \r, quotes, leading/trailing spaces
1378
+ cn <- function(x) trimws(gsub('[\r\n\"]', '', as.character(x)))
1379
+
1380
  observeEvent(input$genotype_file, {
1381
  req(input$genotype_file)
1382
  tryCatch({
1383
  all_data <- readLines(input$genotype_file$datapath)
1384
+ all_data <- gsub("\r", "", all_data)
1385
+ all_data <- all_data[nchar(trimws(all_data)) > 0]
1386
  if (length(all_data) < 4) { showNotification("Need β‰₯4 rows", type = "error"); return() }
1387
+ header <- cn(strsplit(all_data[1], ",")[[1]])
1388
+ chromosome_row <- cn(strsplit(all_data[2], ",")[[1]])
1389
+ position_row <- cn(strsplit(all_data[3], ",")[[1]])
1390
+ genotype_data <- read.csv(text = paste(all_data[-(1:3)], collapse = "\n"),
1391
+ header = FALSE, stringsAsFactors = FALSE, quote = '"')
1392
+ if (ncol(genotype_data) != length(header)) {
1393
+ showNotification(paste0("Header has ", length(header), " cols but data has ", ncol(genotype_data)), type = "error"); return()
1394
+ }
1395
  colnames(genotype_data) <- header
1396
+ rownames(genotype_data) <- cn(as.character(genotype_data[, 1]))
1397
+ genotype_data <- genotype_data[, -1, drop = FALSE]
1398
  for (col in colnames(genotype_data))
1399
+ genotype_data[[col]] <- suppressWarnings(as.numeric(as.character(genotype_data[[col]])))
1400
  values$genotype_data <- genotype_data
1401
  values$chromosome_info <- chromosome_row[-1]
1402
  values$position_info <- suppressWarnings(as.numeric(position_row[-1]))
 
1405
  Chromosome = chromosome_row[-1],
1406
  Position = suppressWarnings(as.numeric(position_row[-1])),
1407
  stringsAsFactors = FALSE)
1408
+ cat("TRAIN GENO LOADED:", nrow(genotype_data), "samples,", ncol(genotype_data), "markers\n")
1409
+ cat("TRAIN first 3 cols:", paste(colnames(genotype_data)[1:3], collapse="|"), "\n")
1410
  showNotification(paste("Loaded", ncol(genotype_data), "markers,", nrow(genotype_data), "samples"), type = "message")
1411
  add_message("assistant", paste0("βœ… Genotype: **", ncol(genotype_data), " markers**, **", nrow(genotype_data), " samples**"))
1412
  }, error = function(e) showNotification(paste("Geno error:", e$message), type = "error"))
 
1438
  observeEvent(input$test_genotype_file, {
1439
  req(input$test_genotype_file)
1440
  tryCatch({
 
1441
  all_data <- readLines(input$test_genotype_file$datapath)
1442
  all_data <- gsub("\r", "", all_data)
1443
+ all_data <- all_data[nchar(trimws(all_data)) > 0]
 
1444
  if (length(all_data) < 4) {
1445
+ showNotification("Test genotype needs β‰₯4 rows (header + chr + pos + β‰₯1 sample)", type = "error"); return()
 
1446
  }
1447
+ # Use SAME cn() cleaner as training loader
1448
+ header <- cn(strsplit(all_data[1], ",")[[1]])
1449
+ gd <- read.csv(text = paste(all_data[-(1:3)], collapse = "\n"),
1450
+ header = FALSE, stringsAsFactors = FALSE, quote = '"')
 
 
 
 
 
 
1451
  if (ncol(gd) != length(header)) {
1452
+ showNotification(paste0("Header has ", length(header), " cols but data has ", ncol(gd)), type = "error"); return()
 
 
 
 
1453
  }
 
1454
  colnames(gd) <- header
1455
+ rownames(gd) <- cn(as.character(gd[, 1]))
1456
  gd <- gd[, -1, drop = FALSE]
 
 
1457
  for (col in colnames(gd))
1458
  gd[[col]] <- suppressWarnings(as.numeric(as.character(gd[[col]])))
 
1459
  values$test_genotype_data <- gd
 
1460
  cat("TEST GENO LOADED:", nrow(gd), "samples,", ncol(gd), "markers\n")
1461
+ cat("TEST first 3 cols:", paste(colnames(gd)[1:3], collapse="|"), "\n")
1462
+ showNotification(paste0("βœ… Test genotype: ", nrow(gd), " samples, ", ncol(gd), " markers"), type = "message")
 
 
 
1463
  }, error = function(e) {
1464
+ showNotification(paste("Test geno error:", e$message), type = "error", duration = 10)
1465
+ cat("TEST GENO ERROR:", e$message, "\n")
1466
  })
1467
  })
1468
 
 
1611
  # PREDICT TEST PHENOTYPES
1612
  # ============================================================
1613
  observeEvent(input$predict_test_phenotype, {
 
1614
 
1615
+ # ── Guard: need model + test data ───────────────────────────
1616
+ if (is.null(values$model_fit)) {
1617
+ showNotification("❌ Run CIM Analysis first to train the model.", type = "error", duration = 8)
1618
+ return()
1619
+ }
1620
+ if (is.null(values$test_genotype_data)) {
1621
+ showNotification("❌ Upload a Test Genotype CSV first.", type = "error", duration = 8)
1622
+ return()
1623
+ }
1624
 
1625
+ withProgress(message = "Predicting test phenotypes...", value = 0, {
 
 
1626
 
1627
+ # ── Step 1: Setup ────────────────────────────────────────
1628
+ incProgress(0.05, detail = "Loading model and test data...")
1629
+ Sys.sleep(0.05)
1630
 
1631
+ model <- values$model_fit
1632
+ test_raw <- values$test_genotype_data # data.frame: rows=samples, cols=markers
1633
+
1634
+ # Get the exact predictor column names the model was trained on
1635
+ train_cols <- values$model_train_cols
1636
+ if (is.null(train_cols)) {
1637
+ # Fallback: extract from caret model object
1638
+ train_cols <- tryCatch(model$finalModel$xNames, error = function(e) NULL)
1639
+ if (is.null(train_cols))
1640
+ train_cols <- tryCatch(colnames(model$trainingData)[-ncol(model$trainingData)], error = function(e) NULL)
1641
+ if (is.null(train_cols))
1642
+ train_cols <- colnames(values$genotype_data)
1643
  }
1644
 
1645
+ cat("PREDICT: train_cols =", length(train_cols),
1646
+ "| test cols =", ncol(test_raw), "\n")
1647
+ cat("PREDICT: train[1:3] =", paste(train_cols[1:3], collapse="|"), "\n")
1648
+ cat("PREDICT: test[1:3] =", paste(colnames(test_raw)[1:3], collapse="|"), "\n")
1649
 
1650
+ # ── Step 2: Marker overlap ───────────────────────────────
1651
+ incProgress(0.10, detail = "Matching markers...")
1652
+ Sys.sleep(0.05)
1653
+
1654
+ common_m <- intersect(train_cols, colnames(test_raw))
1655
+ missing_m <- setdiff(train_cols, colnames(test_raw))
1656
 
1657
+ cat("PREDICT: common =", length(common_m), "| missing =", length(missing_m), "\n")
 
 
1658
 
1659
  if (length(common_m) == 0) {
1660
  showNotification(
1661
+ paste0("No markers matched! Train has ", length(train_cols),
1662
+ " markers, test has ", ncol(test_raw), ". Check marker names match exactly."),
1663
+ type = "error", duration = 15)
1664
  add_message("assistant", paste0(
1665
+ "❌ **Prediction failed β€” zero marker overlap**\n\n",
1666
+ "Train markers (first 5): ", paste(head(train_cols, 5), collapse=", "), "\n",
1667
+ "Test markers (first 5): ", paste(head(colnames(test_raw), 5), collapse=", "), "\n\n",
1668
+ "Both CSVs must have identical marker column names."))
1669
  return()
1670
  }
1671
 
1672
+ if (length(missing_m) > 0)
1673
+ showNotification(paste0(length(missing_m), " markers missing from test β€” imputing with 0"),
1674
+ type = "warning", duration = 5)
 
 
 
 
 
 
1675
 
1676
+ # ── Step 3: Build aligned data.frame ────────────────────
1677
+ incProgress(0.25, detail = paste0("Aligning ", nrow(test_raw), " samples Γ— ", length(train_cols), " markers..."))
1678
+ Sys.sleep(0.05)
1679
 
1680
+ # Build complete data.frame with ALL training columns in training order
1681
+ n_test <- nrow(test_raw)
1682
+ ids <- rownames(test_raw)
 
 
 
 
 
1683
 
1684
+ # Pre-allocate with zeros
1685
+ X_pred <- as.data.frame(
1686
+ matrix(0, nrow = n_test, ncol = length(train_cols),
1687
+ dimnames = list(ids, train_cols))
1688
+ )
1689
 
1690
+ # Fill in the columns we have
1691
+ for (col in common_m) {
1692
+ vals <- suppressWarnings(as.numeric(as.character(test_raw[[col]])))
1693
+ vals[is.na(vals)] <- 0
1694
+ X_pred[[col]] <- vals
 
 
1695
  }
1696
 
1697
+ cat("PREDICT: X_pred dims =", nrow(X_pred), "x", ncol(X_pred), "\n")
1698
+ cat("PREDICT: col order match =", identical(colnames(X_pred), train_cols), "\n")
1699
+ cat("PREDICT: any NA =", any(is.na(X_pred)), "\n")
1700
 
1701
+ # ── Step 4: Predict ──────────────────────────────────────
1702
+ incProgress(0.40, detail = paste0("Running model on ", n_test, " samples..."))
 
 
 
1703
  Sys.sleep(0.05)
1704
 
1705
  preds <- tryCatch({
1706
+ # Try caret predict first (works if column names exactly match)
1707
+ as.numeric(predict(model, newdata = X_pred))
1708
+ }, error = function(e1) {
1709
+ cat("PREDICT caret failed:", e1$message, "\n")
1710
  tryCatch({
1711
+ # Fallback 1: use randomForest finalModel directly
1712
+ as.numeric(predict(model$finalModel, newdata = X_pred))
1713
  }, error = function(e2) {
1714
+ cat("PREDICT finalModel failed:", e2$message, "\n")
1715
+ tryCatch({
1716
+ # Fallback 2: use randomForest finalModel with matrix
1717
+ as.numeric(predict(model$finalModel, newdata = as.matrix(X_pred)))
1718
+ }, error = function(e3) {
1719
+ stop(paste("All predict methods failed.\n",
1720
+ "caret:", e1$message, "\n",
1721
+ "finalModel df:", e2$message, "\n",
1722
+ "finalModel mat:", e3$message))
1723
+ })
1724
  })
1725
  })
1726
 
1727
+ # ── Step 5: Save results ─────────────────────────────────
1728
+ incProgress(0.15, detail = "Saving results...")
1729
  Sys.sleep(0.05)
1730
 
1731
+ result_df <- data.frame(
1732
+ Sample_ID = ids,
1733
+ Predicted_Phenotype = round(preds, 4),
 
 
 
 
 
1734
  stringsAsFactors = FALSE
1735
  )
1736
 
1737
+ values$predicted_test_phenotype_data <- result_df
1738
+
1739
+ cat("PREDICT: SUCCESS β€”", nrow(result_df), "predictions\n")
1740
+ cat("PREDICT: range", round(min(preds),3), "to", round(max(preds),3), "\n")
1741
+
1742
+ incProgress(0.05, detail = "Done!")
1743
+ Sys.sleep(0.05)
1744
 
1745
  }) # end withProgress
1746
 
1747
+ # ── Success notification ─────────────────────────────────
1748
+ res <- values$predicted_test_phenotype_data
1749
+ n <- nrow(res)
1750
+ rng <- paste0(round(min(res$Predicted_Phenotype),3), " – ", round(max(res$Predicted_Phenotype),3))
 
1751
 
1752
+ showNotification(paste0("βœ… Predicted ", n, " test samples (", rng, ")"),
1753
+ type = "message", duration = 6)
 
 
1754
 
1755
  add_message("assistant", paste0(
1756
+ "βœ… **Test phenotypes predicted!**\n\n",
1757
+ "β€’ **", n, "** samples predicted\n",
1758
+ "β€’ Predicted range: **", rng, "**\n",
1759
+ "β€’ Markers matched: **", length(intersect(values$model_train_cols, colnames(values$test_genotype_data))),
1760
+ "** / ", length(values$model_train_cols), "\n",
1761
+ "β€’ Preview: *Data Upload β†’ Predicted Test Phenotype* tab\n",
 
1762
  "β€’ Save: click **Download Predicted Phenotypes (.xlsx)**"
1763
  ))
1764
  })
1765
 
1766
+
1767
  # ============================================================
1768
  # DOMESTICATION
1769
  # ============================================================
 
2203
  })
2204
  }
2205
 
2206
+ shinyApp(ui = ui, server = server)