Browse code

Import data UI modified

nida pervaiz authored on 10/06/2022 08:55:33
Showing 3 changed files

... ...
@@ -22,17 +22,22 @@ nonLinearWorkflow <- function(input, output, session, parent,
22 22
   ns <- session$ns
23 23
   
24 24
   output$ui <- renderUI({
25
-    bsCollapsePanel(tagList(icon("chevron-circle-down"), "Downstream Analysis"), 
26
-                    uiOutput(ns("de")),
27
-                    uiOutput(ns("pa")),
28
-                    uiOutput(ns("qcf")),
29
-                    uiOutput(ns("nbc")),
30
-                    uiOutput(ns("cw")),
31
-                    uiOutput(ns("dr")),
32
-                    uiOutput(ns("fs")),
33
-                    uiOutput(ns("cl")),
34
-                    uiOutput(ns("cv")),
35
-                    style = "success")
25
+    bsCollapse(
26
+      open = "Next Steps",
27
+      bsCollapsePanel("Next Steps", 
28
+                               uiOutput(ns("de")),
29
+                               uiOutput(ns("pa")),
30
+                               uiOutput(ns("qcf")),
31
+                               uiOutput(ns("nbc")),
32
+                               uiOutput(ns("cw")),
33
+                               uiOutput(ns("dr")),
34
+                               uiOutput(ns("fs")),
35
+                               uiOutput(ns("cl")),
36
+                               uiOutput(ns("cv")),
37
+                               style = "success"
38
+                      )
39
+      )
40
+    
36 41
   })
37 42
   
38 43
   if(de){
... ...
@@ -142,11 +142,32 @@ shinyServer(function(input, output, session) {
142 142
   }
143 143
 
144 144
   updateFeatureAnnots <- function(){
145
+    
145 146
     selectRowData <- colnames(rowData(vals$counts))
147
+    my_list <- data.frame()
148
+    for(i in selectRowData) {
149
+      my_list[i,1] <- paste0(i, " (e.g. ", paste(head(rowData(vals$counts)[,i], n = 3), collapse = ","), ")")    
150
+    }
151
+    selectRowDataWithExamples <- as.character(my_list[,1])
152
+    
153
+    
154
+    selectNonNARowData <- names(apply(rowData(vals$counts), 2, anyNA)[apply(rowData(vals$counts), 2, anyNA) == FALSE])
155
+    my_list2 <- data.frame()
156
+    for(j in selectNonNARowData) {
157
+      my_list2[j,1] <- paste0(j, " (e.g. ", paste(head(rowData(vals$counts)[,j], n = 3), collapse = ","), ")")    
158
+    }
159
+    selectNonNARowDataWithExamples <- as.character(my_list2[,1])
160
+    
161
+    Default <- paste0("Default (e.g. ", paste(head(rownames(vals$counts), n = 3), collapse = ","), ")")
162
+    
146 163
     updateSelectInput(session, "gsByParam",
147 164
                       choices = c("rownames", selectRowData))
148 165
     updateSelectInput(session, "importFeatureDispOpt",
149
-                      choices = c("Rownames (Default)", selectRowData))
166
+                      choices = c(Default, 
167
+                                  selectRowDataWithExamples))
168
+    updateSelectInput(session, "importFeatureNamesOpt",
169
+                      choices = c(Default, 
170
+                                  selectNonNARowDataWithExamples))
150 171
     updateSelectInput(session, "filteredFeature",
151 172
                       choices = c("none", selectRowData))
152 173
     updateSelectInput(session, "hvgPlotFeatureDisplay",
... ...
@@ -441,7 +462,7 @@ shinyServer(function(input, output, session) {
441 462
         count <- 0
442 463
         if (!is.na(path)) {
443 464
           # Add Reference selection for cellRangerV2
444
-          if (input$algoChoice == "cellRanger2") {
465
+          if (input$uploadChoice == "cellRanger2") {
445 466
             ## Identify available reference
446 467
             firstSampleDir <- list.dirs(path, recursive = FALSE)[1]
447 468
             refPath <- file.path(firstSampleDir, "outs/filtered_gene_bc_matrices")
... ...
@@ -498,7 +519,7 @@ shinyServer(function(input, output, session) {
498 519
                                                  collapse = .Platform$file.sep))
499 520
         path <- dirPaths$sDirectory
500 521
         if (!is.na(path)) {
501
-          if (input$algoChoice == "cellRanger2") {
522
+          if (input$uploadChoice == "cellRanger2") {
502 523
             ## Identify available reference
503 524
             refPath <- file.path(path, "outs/filtered_gene_bc_matrices")
504 525
             refList <- basename(list.dirs(refPath, recursive = FALSE))
... ...
@@ -588,7 +609,7 @@ shinyServer(function(input, output, session) {
588 609
     } else {
589 610
       allDirs <- list.dirs(basePath, recursive = FALSE)
590 611
       # if we are adding a new CellRangerV2 sample
591
-      if (input$algoChoice == "cellRanger2") {
612
+      if (input$uploadChoice == "cellRanger2") {
592 613
         allUI <- vector()
593 614
         allIDs <- vector()
594 615
         count <- 0
... ...
@@ -677,6 +698,7 @@ shinyServer(function(input, output, session) {
677 698
       )
678 699
       removeModal()
679 700
     }
701
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
680 702
   })
681 703
 
682 704
   # event listeners for Cell Ranger import modals' OK buttons
... ...
@@ -688,7 +710,7 @@ shinyServer(function(input, output, session) {
688 710
       showModal(importCRSDir(failed = TRUE))
689 711
     } else {
690 712
       # add the files to the appropriate reactiveValues
691
-      if (input$algoChoice == "cellRanger2") {
713
+      if (input$uploadChoice == "cellRanger2") {
692 714
         id <- paste0("snewSampleCR2", allImportEntries$id_count)
693 715
         entry <- list(type="cellRanger2", id=id, 
694 716
                       params=list(cellRangerDirs = dirname(samplePath), 
... ...
@@ -704,7 +726,7 @@ shinyServer(function(input, output, session) {
704 726
         allImportEntries$id_count <- allImportEntries$id_count + 1
705 727
       }
706 728
       # add new row to table
707
-      addToGeneralSampleTable(input$algoChoice, id, samplePath, input$sSampleID)
729
+      addToGeneralSampleTable(input$uploadChoice, id, samplePath, input$sSampleID)
708 730
       # handler to remove the sample that was just added
709 731
       observeEvent(input[[paste0("remove", id)]],{
710 732
         removeUI(
... ...
@@ -722,6 +744,8 @@ shinyServer(function(input, output, session) {
722 744
       })
723 745
       removeModal()
724 746
     }
747
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
748
+    
725 749
   })
726 750
 
727 751
   # data directory
... ...
@@ -730,7 +754,7 @@ shinyServer(function(input, output, session) {
730 754
     if ((!nzchar(input$dSampleID)) || (identical(dataPath, character(0)))) {
731 755
       showModal(importCRDDir(failed = TRUE))
732 756
     } else {
733
-      if (input$algoChoice == "cellRanger2") {
757
+      if (input$uploadChoice == "cellRanger2") {
734 758
         id <- paste0("dnewSampleCR2", allImportEntries$id_count)
735 759
         entry <- list(type="cellRanger2", id=id, 
736 760
                       params=list(dataDir = dataPath, 
... ...
@@ -744,7 +768,7 @@ shinyServer(function(input, output, session) {
744 768
         allImportEntries$id_count <- allImportEntries$id_count + 1
745 769
       }
746 770
       # add new row to table
747
-      addToGeneralSampleTable(input$algoChoice, id, dataPath, input$dSampleID)
771
+      addToGeneralSampleTable(input$uploadChoice, id, dataPath, input$dSampleID)
748 772
       observeEvent(input[[paste0("remove", id)]],{
749 773
         removeUI(
750 774
           selector = paste0("#", id)
... ...
@@ -761,6 +785,8 @@ shinyServer(function(input, output, session) {
761 785
       })
762 786
       removeModal()
763 787
     }
788
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
789
+    
764 790
   })
765 791
 
766 792
   # event handler for pressing OK on the import modal
... ...
@@ -771,29 +797,29 @@ shinyServer(function(input, output, session) {
771 797
       showModal(importModal(failed = TRUE))
772 798
     } else {
773 799
       entry <- list()
774
-      if (input$algoChoice == "starSolo") {
800
+      if (input$uploadChoice == "starSolo") {
775 801
         id <- paste0("newSampleSS", allImportEntries$id_count)
776 802
         entry <- list(type="starSolo", id = id, params=list(STARsoloDirs = basePath, samples = input$sampleName))
777 803
         allImportEntries$samples <- c(allImportEntries$samples, list(entry))
778 804
         allImportEntries$id_count <- allImportEntries$id_count+1
779
-      } else if (input$algoChoice == "busTools") {
805
+      } else if (input$uploadChoice == "busTools") {
780 806
         id <- paste0("newSampleBUS", allImportEntries$id_count)
781 807
         entry <- list(type="busTools", id = id, params=list(BUStoolsDirs = basePath, samples = input$sampleName))
782 808
         allImportEntries$samples <- c(allImportEntries$samples, list(entry))
783 809
         allImportEntries$id_count <- allImportEntries$id_count+1
784
-      } else if (input$algoChoice == "seqc") {
810
+      } else if (input$uploadChoice == "seqc") {
785 811
         id <- paste0("newSampleSEQ", allImportEntries$id_count)
786 812
         entry <- list(type="seqc", id = id, params=list(seqcDirs = basePath, prefix = input$sampleID, samples = input$sampleName))
787 813
         updateTextInput(session, "sampleID", value = "")
788 814
         allImportEntries$samples <- c(allImportEntries$samples, list(entry))
789 815
         allImportEntries$id_count <- allImportEntries$id_count+1
790
-      } else if (input$algoChoice == "optimus") {
816
+      } else if (input$uploadChoice == "optimus") {
791 817
         id <- paste0("newSampleOpt", allImportEntries$id_count)
792 818
         entry <- list(type="optimus", id = id, params=list(OptimusDirs = basePath, samples = input$sampleName))
793 819
         allImportEntries$samples <- c(allImportEntries$samples, list(entry))
794 820
         allImportEntries$id_count <- allImportEntries$id_count+1
795 821
       }
796
-      addToGeneralSampleTable(input$algoChoice, id, basePath, input$sampleName)
822
+      addToGeneralSampleTable(input$uploadChoice, id, basePath, input$sampleName)
797 823
       observeEvent(input[[paste0("remove", id)]],{
798 824
         removeUI(
799 825
           selector = paste0("#", id)
... ...
@@ -810,6 +836,8 @@ shinyServer(function(input, output, session) {
810 836
       })
811 837
       removeModal()
812 838
     }
839
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
840
+    
813 841
   })
814 842
 
815 843
   # Event handler to import a file input
... ...
@@ -850,6 +878,8 @@ shinyServer(function(input, output, session) {
850 878
       }
851 879
       allImportEntries$samples <- allImportEntries$samples[toRemove]
852 880
     })
881
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
882
+    
853 883
   })
854 884
 
855 885
   # Event handler to import an example input
... ...
@@ -885,6 +915,8 @@ shinyServer(function(input, output, session) {
885 915
       }
886 916
       allImportEntries$samples <- allImportEntries$samples[toRemove]
887 917
     })
918
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
919
+    
888 920
   })
889 921
 
890 922
   # Event handler to import an RDS input
... ...
@@ -910,6 +942,8 @@ shinyServer(function(input, output, session) {
910 942
       }
911 943
       allImportEntries$samples <- allImportEntries$samples[toRemove]
912 944
     })
945
+    updateCollapse(session = session, "importUI", style = list("1. Add sample to import:" = "success"))
946
+    
913 947
   })
914 948
 
915 949
   # Event handler for "Upload" button on import page
... ...
@@ -1018,6 +1052,8 @@ shinyServer(function(input, output, session) {
1018 1052
       # datasets. Otherwise, errors may pop out when Shiny listens to the new
1019 1053
       # object but cannot find the old result.
1020 1054
     })
1055
+    updateCollapse(session = session, "importUI", style = list("2. Create dataset:" = "success"))
1056
+    
1021 1057
     callModule(module = nonLinearWorkflow, id = "nlw-import", parent = session, qcf = TRUE)
1022 1058
   
1023 1059
     .loadClose() # close the notification spinner and console log
... ...
@@ -1343,13 +1379,20 @@ shinyServer(function(input, output, session) {
1343 1379
     if (!is.null(vals$counts)) {
1344 1380
       withBusyIndicatorServer("importFeatureDipSet", {
1345 1381
         selected <- NULL
1346
-        if (!input$importFeatureDispOpt == "Rownames (Default)") {
1347
-          selected <- input$importFeatureDispOpt
1382
+        
1383
+        if (!stringr::word(input$importFeatureDispOpt, 1) == "Default") {
1384
+          featureName <- word(input$importFeatureDispOpt, 1) 
1385
+          selected <- featureName
1386
+        }
1387
+        if (!stringr::word(input$importFeatureNamesOpt, 1) == "Default") {
1388
+          featureID <- word(input$importFeatureNamesOpt, 1) 
1389
+          rownames(vals$counts) <- rowData(vals$counts)[[featureID]]
1348 1390
         }
1349 1391
         vals$counts <- setSCTKDisplayRow(vals$counts, selected)
1350 1392
         updateFeatureDisplaySelect(selected = selected)
1351 1393
       })
1352 1394
     }
1395
+    updateCollapse(session = session, "importUI", style = list("3. Data summary:" = "success"))
1353 1396
   })
1354 1397
   updateFeatureDisplaySelect <- function(selected = NULL, updateOptions = FALSE) 
1355 1398
   {
... ...
@@ -2144,7 +2187,7 @@ shinyServer(function(input, output, session) {
2144 2187
   }, striped = TRUE, border = TRUE, align = "c", spacing = "l")
2145 2188
 
2146 2189
   #Render summary table
2147
-  output$summarycontents <- renderTable({
2190
+  output$summarycontents <- DT::renderDataTable({
2148 2191
       req(vals$counts)
2149 2192
       if ("Sample" %in% names(colData(vals$counts))) {
2150 2193
         sampleVar <- "Sample"
... ...
@@ -2157,7 +2200,7 @@ shinyServer(function(input, output, session) {
2157 2200
       singleCellTK::summarizeSCE(inSCE = vals$counts,
2158 2201
                                  useAssay = NULL,
2159 2202
                                  sampleVariableName = sampleVar)
2160
-  }, striped = TRUE, border = TRUE, align = "c", spacing = "l")
2203
+  })
2161 2204
 
2162 2205
 
2163 2206
   #Reset the data to the original uploaded dataset
... ...
@@ -16,6 +16,7 @@ if ("scRNAseq" %in% rownames(installed.packages())){
16 16
                        "NestorowaHSC (Nestorowa et al, 2016)" = "NestorowaHSCData")
17 17
 }
18 18
 
19
+# User Interface for import Workflow ---
19 20
 shinyPanelImport <- fluidPage(
20 21
   useShinyjs(),
21 22
   tags$style(appCSS),
... ...
@@ -33,26 +34,36 @@ shinyPanelImport <- fluidPage(
33 34
     )
34 35
   ),
35 36
   tags$br(),
36
-  tags$div(
37
-    class = "container",
38
-    h1("Import"),
39
-    h5(tags$a(href = paste0(docs.artPath, "import_data.html"),
40
-              "(help)", target = "_blank")),
41
-    tags$hr(),
42
-    h3("1. Choose data source:"),
43
-    radioButtons("uploadChoice", label = NULL, c("Import from a preprocessing tool" = 'directory',
44
-                                                 "Import from flat files (.csv, .txt, .mtx)" = "files",
45
-                                                 "Upload SingleCellExperiment or Seurat object stored in an RDS File" = "rds",
46
-                                                 "Import example datasets" = "example")
47
-    ),
48
-    tags$hr(),
49
-    conditionalPanel(condition = sprintf("input['%s'] == 'files'", "uploadChoice"),
50
-                     h3("2. Upload data in tab separated text format:"),
51
-                     fluidRow(
52
-                       column(width = 4,
53
-                              wellPanel(
54
-                                h4("Example count file:"),
55
-                                HTML('<table class="table"><thead><tr class="header"><th>Gene</th>
37
+  
38
+  h1("Import"),
39
+  h5(tags$a(href = paste0(docs.artPath, "import_data.html"),
40
+            "(help)", target = "_blank")),
41
+  tags$hr(),
42
+  
43
+  bsCollapse(
44
+    id = "importUI", 
45
+    open = "1. Add sample to import:",
46
+    bsCollapsePanel(
47
+      "1. Add sample to import:",
48
+      radioButtons("uploadChoice", label = NULL, c("Cell Ranger (Version 3 or above)" = "cellRanger3",
49
+                                                   "Cell Ranger (Version 2)" = "cellRanger2",
50
+                                                   "STARsolo" = "starSolo",
51
+                                                   "BUStools" = "busTools",
52
+                                                   "SEQC" = "seqc",
53
+                                                   "Optimus" = "optimus",
54
+                                                   #"Import from a preprocessing tool" = 'directory',
55
+                                                   "Import from flat files (.csv, .txt, .mtx)" = "files",
56
+                                                   "Upload SingleCellExperiment or Seurat object stored in an RDS File" = "rds",
57
+                                                   "Import example datasets" = "example")
58
+      ),
59
+      tags$hr(),
60
+      conditionalPanel(condition = sprintf("input['%s'] == 'files'", "uploadChoice"),
61
+                       h3("Upload data in tab separated text format:"),
62
+                       fluidRow(
63
+                         column(width = 4,
64
+                                wellPanel(
65
+                                  h4("Example count file:"),
66
+                                  HTML('<table class="table"><thead><tr class="header"><th>Gene</th>
56 67
                  <th>Cell1</th><th>Cell2</th><th>&#x2026;</th><th>CellN</th>
57 68
                  </tr></thead><tbody><tr class="odd"><td>Gene1</td><td>0</td>
58 69
                  <td>0</td><td>&#x2026;</td><td>0</td></tr><tr class="even">
... ...
@@ -63,257 +74,264 @@ shinyPanelImport <- fluidPage(
63 74
                  <td>&#x2026;</td><td>&#x2026;</td></tr><tr class="odd">
64 75
                  <td>GeneM</td><td>10</td><td>10</td><td>&#x2026;</td><td>10</td>
65 76
                  </tr></tbody></table>'),
66
-            tags$a(href = "https://drive.google.com/open?id=1n0CtM6phfkWX0O6xRtgPPg6QuPFP6pY8",
67
-                   "Download an example count file here.", target = "_blank"),
68
-            tags$br(),
69
-            tags$br(),
70
-            fileInput(
71
-              "countsfile",
72
-              HTML(
73
-                paste("Input assay (eg. counts, required):",
74
-                tags$span(style = "color:red", "*", sep = ""))
75
-              ),
76
-              accept = c(
77
-                "text/csv", "text/comma-separated-values", "mtx",
78
-                "text/tab-separated-values", "text/plain", ".csv", ".tsv"
79
-              )
80
-            )
81
-          ),
82
-          h4("Input Assay Type:"),
83
-          selectInput("inputAssayType", label = NULL,
84
-                      c("counts", "normcounts", "logcounts", "cpm",
85
-                        "logcpm", "tpm", "logtpm")
86
-          )
87
-        ),
88
-        column(width = 4,
89
-          wellPanel(
90
-            h4("Example cell annotation file:"),
91
-            HTML('<table class="table"><thead><tr class="header"><th>Cell</th>
77
+                                  tags$a(href = "https://drive.google.com/open?id=1n0CtM6phfkWX0O6xRtgPPg6QuPFP6pY8",
78
+                                         "Download an example count file here.", target = "_blank"),
79
+                                  tags$br(),
80
+                                  tags$br(),
81
+                                  fileInput(
82
+                                    "countsfile",
83
+                                    HTML(
84
+                                      paste("Input assay (eg. counts, required):",
85
+                                            tags$span(style = "color:red", "*", sep = ""))
86
+                                    ),
87
+                                    accept = c(
88
+                                      "text/csv", "text/comma-separated-values", "mtx",
89
+                                      "text/tab-separated-values", "text/plain", ".csv", ".tsv"
90
+                                    )
91
+                                  )
92
+                                ),
93
+                                h4("Input Assay Type:"),
94
+                                selectInput("inputAssayType", label = NULL,
95
+                                            c("counts", "normcounts", "logcounts", "cpm",
96
+                                              "logcpm", "tpm", "logtpm")
97
+                                )
98
+                         ),
99
+                         column(width = 4,
100
+                                wellPanel(
101
+                                  h4("Example cell annotation file:"),
102
+                                  HTML('<table class="table"><thead><tr class="header"><th>Cell</th>
92 103
                  <th>Annot1</th><th>&#x2026;</th></tr></thead><tbody><tr class="odd">
93 104
                  <td>Cell1</td><td>a</td><td>&#x2026;</td></tr><tr class="even">
94 105
                  <td>Cell2</td><td>a</td><td>&#x2026;</td></tr><tr class="odd">
95 106
                  <td>Cell3</td><td>b</td><td>&#x2026;</td></tr><tr class="even">
96 107
                  <td>&#x2026;</td><td>&#x2026;</td><td>&#x2026;</td></tr><tr class="odd"><td>CellN</td>
97 108
                  <td>b</td><td>&#x2026;</td></tr></tbody></table>'),
98
-                                tags$a(href = "https://drive.google.com/open?id=10IDmZQUiASN4wnzO4-WRJQopKvxCNu6J",
99
-                                       "Download an example annotation file here.", target = "_blank"),
100
-                                tags$br(),
101
-                                tags$br(),
102
-                                fileInput(
103
-                                  "annotFile", "Cell annotations (optional):",
104
-                                  accept = c(
105
-                                    "text/csv", "text/comma-separated-values",
106
-                                    "text/tab-separated-values", "text/plain", ".csv", ".tsv"
109
+                                  tags$a(href = "https://drive.google.com/open?id=10IDmZQUiASN4wnzO4-WRJQopKvxCNu6J",
110
+                                         "Download an example annotation file here.", target = "_blank"),
111
+                                  tags$br(),
112
+                                  tags$br(),
113
+                                  fileInput(
114
+                                    "annotFile", "Cell annotations (optional):",
115
+                                    accept = c(
116
+                                      "text/csv", "text/comma-separated-values",
117
+                                      "text/tab-separated-values", "text/plain", ".csv", ".tsv"
118
+                                    )
107 119
                                   )
108 120
                                 )
109
-                              )
110
-                       ),
111
-                       column(width = 4,
112
-                              wellPanel(
113
-                                h4("Example feature file:"),
114
-                                HTML('<table class="table"><thead><tr class="header"><th>Gene</th>
121
+                         ),
122
+                         column(width = 4,
123
+                                wellPanel(
124
+                                  h4("Example feature file:"),
125
+                                  HTML('<table class="table"><thead><tr class="header"><th>Gene</th>
115 126
                <th>Annot2</th><th>&#x2026;</th></tr></thead><tbody><tr class="odd">
116 127
                  <td>Gene1</td><td>a</td><td>&#x2026;</td></tr><tr class="even">
117 128
                  <td>Gene2</td><td>a</td><td>&#x2026;</td></tr><tr class="odd">
118 129
                  <td>Gene3</td><td>b</td><td>&#x2026;</td></tr><tr class="even">
119 130
                  <td>&#x2026;</td><td>&#x2026;</td><td>&#x2026;</td></tr><tr class="odd"><td>GeneM</td>
120 131
                  <td>b</td><td>&#x2026;</td></tr></tbody></table>'),
121
-                                tags$a(href = "https://drive.google.com/open?id=1gxXaZPq5Wrn2lNHacEVaCN2a_FHNvs4O",
122
-                                       "Download an example feature file here.", target = "_blank"),
123
-                                tags$br(),
124
-                                tags$br(),
125
-                                fileInput(
126
-                                  "featureFile", "Feature annotations (optional):",
127
-                                  accept = c(
128
-                                    "text/csv", "text/comma-separated-values",
129
-                                    "text/tab-separated-values", "text/plain", ".csv", ".tsv"
132
+                                  tags$a(href = "https://drive.google.com/open?id=1gxXaZPq5Wrn2lNHacEVaCN2a_FHNvs4O",
133
+                                         "Download an example feature file here.", target = "_blank"),
134
+                                  tags$br(),
135
+                                  tags$br(),
136
+                                  fileInput(
137
+                                    "featureFile", "Feature annotations (optional):",
138
+                                    accept = c(
139
+                                      "text/csv", "text/comma-separated-values",
140
+                                      "text/tab-separated-values", "text/plain", ".csv", ".tsv"
141
+                                    )
130 142
                                   )
131 143
                                 )
132
-                              )
133
-                       )
134
-                     ),
135
-        actionButton("addFilesImport", "Add To Sample List")
136
-    ),
137
-    conditionalPanel(
138
-      condition = sprintf("input['%s'] == 'example'", "uploadChoice"),
139
-      h3("2. Choose Example Dataset:"),
140
-      selectInput("selectExampleData", label = NULL, exampleDatasets),
141
-      conditionalPanel(
142
-        condition = sprintf("input['%s'] == 'fluidigm_pollen'", "selectExampleData"),
143
-        h3(tags$a(href = "http://dx.doi.org/10.1038/nbt.2967", "130 cells from (Pollen et al. 2014), 65 at high coverage and 65 at low coverage", target = "_blank")),
144
-        "Transcriptomes of cell populations in both of low-coverage (~0.27 million reads per cell) and high-coverage (~5 million reads per cell) to identify cell-type-specific biomarkers, and to compare gene expression across samples specifically for cells of a given type as well as to reconstruct developmental lineages of related cell types. Data was loaded from the 'scRNASeq' package.",
145
-        tags$br(),
146
-        tags$br()
147
-      ),
148
-      conditionalPanel(
149
-        condition = sprintf("input['%s'] == 'allen_tasic'", "selectExampleData"),
150
-        h3(tags$a(href = "http://dx.doi.org/10.1038/nn.4216", "Mouse visual cortex cells from (Tasic et al. 2016)", target = "_blank")),
151
-        "Subset of 379 cells from the mouse visual cortex. Data was loaded from the 'scRNASeq' package.",
152
-        tags$br(),
153
-        tags$br()
154
-      ),
155
-      conditionalPanel(
156
-        condition = sprintf("input['%s'] == 'NestorowaHSCData'", "selectExampleData"),
157
-        h3(tags$a(href = "https://www.nature.com/articles/nbt.2967", "1920 Mouse haematopoietic stem cells from (Nestorowa et al. 2015).", target= "_blank")),
158
-        "Data was loaded from the 'scRNASeq' package.",
159
-        tags$br(),
160
-        tags$br()
161
-      ),
162
-      conditionalPanel(
163
-        condition = sprintf("input['%s'] == 'pbmc3k'", "selectExampleData"),
164
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "2,700 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
165
-        "Data was loaded with the 'TENxPBMCData' package.",
166
-        tags$br(),
167
-        tags$br()
168
-      ),
169
-      conditionalPanel(
170
-        condition = sprintf("input['%s'] == 'pbmc4k'", "selectExampleData"),
171
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "4,430 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
172
-        "Data was loaded with the 'TENxPBMCData' package.",
173
-        tags$br(),
174
-        tags$br()
175
-      ),
176
-      conditionalPanel(
177
-        condition = sprintf("input['%s'] == 'pbmc6k'", "selectExampleData"),
178
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "5,419 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
179
-        "Data was loaded with the 'TENxPBMCData' package.",
180
-        tags$br(),
181
-        tags$br()
182
-      ),
183
-      conditionalPanel(
184
-        condition = sprintf("input['%s'] == 'pbmc8k'", "selectExampleData"),
185
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "8,381 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
186
-        "Data was loaded with the 'TENxPBMCData' package.",
187
-        tags$br(),
188
-        tags$br()
144
+                         )
145
+                       ),
146
+                       actionButton("addFilesImport", "Add To Dataset List")
189 147
       ),
190 148
       conditionalPanel(
191
-        condition = sprintf("input['%s'] == 'pbmc33k'", "selectExampleData"),
192
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "33,148 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
193
-        "Data was loaded with the 'TENxPBMCData' package.",
194
-        tags$br(),
195
-        tags$br()
149
+        condition = sprintf("input['%s'] == 'example'", "uploadChoice"),
150
+        h3("Choose Example Dataset:"),
151
+        selectInput("selectExampleData", label = NULL, exampleDatasets),
152
+        conditionalPanel(
153
+          condition = sprintf("input['%s'] == 'fluidigm_pollen'", "selectExampleData"),
154
+          h3(tags$a(href = "http://dx.doi.org/10.1038/nbt.2967", "130 cells from (Pollen et al. 2014), 65 at high coverage and 65 at low coverage", target = "_blank")),
155
+          "Transcriptomes of cell populations in both of low-coverage (~0.27 million reads per cell) and high-coverage (~5 million reads per cell) to identify cell-type-specific biomarkers, and to compare gene expression across samples specifically for cells of a given type as well as to reconstruct developmental lineages of related cell types. Data was loaded from the 'scRNASeq' package.",
156
+          tags$br(),
157
+          tags$br()
158
+        ),
159
+        conditionalPanel(
160
+          condition = sprintf("input['%s'] == 'allen_tasic'", "selectExampleData"),
161
+          h3(tags$a(href = "http://dx.doi.org/10.1038/nn.4216", "Mouse visual cortex cells from (Tasic et al. 2016)", target = "_blank")),
162
+          "Subset of 379 cells from the mouse visual cortex. Data was loaded from the 'scRNASeq' package.",
163
+          tags$br(),
164
+          tags$br()
165
+        ),
166
+        conditionalPanel(
167
+          condition = sprintf("input['%s'] == 'NestorowaHSCData'", "selectExampleData"),
168
+          h3(tags$a(href = "https://www.nature.com/articles/nbt.2967", "1920 Mouse haematopoietic stem cells from (Nestorowa et al. 2015).", target= "_blank")),
169
+          "Data was loaded from the 'scRNASeq' package.",
170
+          tags$br(),
171
+          tags$br()
172
+        ),
173
+        conditionalPanel(
174
+          condition = sprintf("input['%s'] == 'pbmc3k'", "selectExampleData"),
175
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "2,700 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
176
+          "Data was loaded with the 'TENxPBMCData' package.",
177
+          tags$br(),
178
+          tags$br()
179
+        ),
180
+        conditionalPanel(
181
+          condition = sprintf("input['%s'] == 'pbmc4k'", "selectExampleData"),
182
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "4,430 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
183
+          "Data was loaded with the 'TENxPBMCData' package.",
184
+          tags$br(),
185
+          tags$br()
186
+        ),
187
+        conditionalPanel(
188
+          condition = sprintf("input['%s'] == 'pbmc6k'", "selectExampleData"),
189
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "5,419 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
190
+          "Data was loaded with the 'TENxPBMCData' package.",
191
+          tags$br(),
192
+          tags$br()
193
+        ),
194
+        conditionalPanel(
195
+          condition = sprintf("input['%s'] == 'pbmc8k'", "selectExampleData"),
196
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "8,381 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
197
+          "Data was loaded with the 'TENxPBMCData' package.",
198
+          tags$br(),
199
+          tags$br()
200
+        ),
201
+        conditionalPanel(
202
+          condition = sprintf("input['%s'] == 'pbmc33k'", "selectExampleData"),
203
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "33,148 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
204
+          "Data was loaded with the 'TENxPBMCData' package.",
205
+          tags$br(),
206
+          tags$br()
207
+        ),
208
+        conditionalPanel(
209
+          condition = sprintf("input['%s'] == 'pbmc68k'", "selectExampleData"),
210
+          h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "68,579 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
211
+          "Data was loaded with the 'TENxPBMCData' package.",
212
+          tags$br(),
213
+          tags$br()
214
+        ),
215
+        actionButton("addExampleImport", "Add To Sample List")
196 216
       ),
197 217
       conditionalPanel(
198
-        condition = sprintf("input['%s'] == 'pbmc68k'", "selectExampleData"),
199
-        h3(tags$a(href = "https://doi.org/10.1038/ncomms14049", "68,579 peripheral blood mononuclear cells (PBMCs) from 10X Genomics", target = "_blank")),
200
-        "Data was loaded with the 'TENxPBMCData' package.",
201
-        tags$br(),
202
-        tags$br()
203
-      ),
204
-      actionButton("addExampleImport", "Add To Sample List")
205
-    ),
206
-    conditionalPanel(
207
-      condition = sprintf("input['%s'] == 'rds'", "uploadChoice"),
208
-      h3("2. Choose an RDS file that contains a SingleCellExperiment or Seurat object:"),
209
-      fileInput(
210
-        "rdsFile", "SingleCellExperiment or Seurat RDS file:", accept = c(".rds", ".RDS")
211
-      ),
212
-      actionButton("addRDSImport", "Add To Sample List")
213
-    ),
214
-    conditionalPanel(
215
-      condition = sprintf("input['%s'] == 'directory'", "uploadChoice"),
216
-      tags$style(HTML("
217
-      div {
218
-        word-wrap: break-word;
219
-      }
220
-      ")),
221
-      h3("2. Choose a Preprocessing Tool:"),
222
-      radioButtons("algoChoice", label = NULL, c("Cell Ranger v2" = "cellRanger2",
223
-                                                 "Cell Ranger v3" = "cellRanger3",
224
-                                                 "STARsolo" = "starSolo",
225
-                                                 "BUStools" = "busTools",
226
-                                                 "SEQC" = "seqc",
227
-                                                 "Optimus" = "optimus")
218
+        condition = sprintf("input['%s'] == 'rds'", "uploadChoice"),
219
+        h3("Choose an RDS file that contains a SingleCellExperiment or Seurat object:"),
220
+        fileInput(
221
+          "rdsFile", "SingleCellExperiment or Seurat RDS file:", accept = c(".rds", ".RDS")
222
+        ),
223
+        actionButton("addRDSImport", "Add To Sample List")
228 224
       ),
229
-      tags$br(),
225
+      #conditionalPanel(
226
+      #condition = sprintf("input['%s'] == 'directory'", "uploadChoice"),
227
+      #tags$style(HTML("
228
+      #div {
229
+      #  word-wrap: break-word;
230
+      #}
231
+      #")),
232
+      #h3("2. Choose a Preprocessing Tool:"),
233
+      #radioButtons("algoChoice", label = NULL, c("Cell Ranger v2" = "cellRanger2",
234
+      #                                          "Cell Ranger v3" = "cellRanger3",
235
+      #                                         "STARsolo" = "starSolo",
236
+      #                                        "BUStools" = "busTools",
237
+      #                                       "SEQC" = "seqc",
238
+      #                                      "Optimus" = "optimus")
239
+      #),
240
+      #tags$br(),
230 241
       conditionalPanel(
231
-        condition = sprintf("input['%s'] == 'cellRanger2'", "algoChoice"),
242
+        condition = sprintf("input['%s'] == 'cellRanger2'", "uploadChoice"),
232 243
         actionButton("addCR2Sample", "Add a Sample"),
233 244
       ),
234 245
       conditionalPanel(
235
-        condition = sprintf("input['%s'] == 'cellRanger3'", "algoChoice"),
246
+        condition = sprintf("input['%s'] == 'cellRanger3'", "uploadChoice"),
236 247
         actionButton("addCR3Sample", "Add a Sample"),
237 248
       ),
238 249
       conditionalPanel(
239
-        condition = sprintf("input['%s'] == 'starSolo'", "algoChoice"),
250
+        condition = sprintf("input['%s'] == 'starSolo'", "uploadChoice"),
240 251
         wellPanel(
241 252
           h5("Please select the directory that contains your /Gene directory as your base directory. ")
242 253
         ),
243 254
         actionButton("addSSSample", "Add a Sample"),
244 255
       ),
245 256
       conditionalPanel(
246
-        condition = sprintf("input['%s'] == 'busTools'", "algoChoice"),
257
+        condition = sprintf("input['%s'] == 'busTools'", "uploadChoice"),
247 258
         wellPanel(
248 259
           h5("Please select your /genecount directory as your base directory.")
249 260
         ),
250 261
         actionButton("addBUSSample", "Add a Sample"),
251 262
       ),
252 263
       conditionalPanel(
253
-        condition = sprintf("input['%s'] == 'seqc'", "algoChoice"),
264
+        condition = sprintf("input['%s'] == 'seqc'", "uploadChoice"),
254 265
         wellPanel(
255 266
           h5("Please select the directory that contains your sample files as your base directory.")
256 267
         ),
257 268
         actionButton("addSEQSample", "Add a Sample"),
258 269
       ),
259 270
       conditionalPanel(
260
-        condition = sprintf("input['%s'] == 'optimus'", "algoChoice"),
271
+        condition = sprintf("input['%s'] == 'optimus'", "uploadChoice"),
261 272
         wellPanel(
262 273
           h5("Please select the directory that contains the following four directories - call-MergeCountFiles, call-MergeCellMetrics, call-MergeGeneMetrics, call-RunEmptyDrops - as your base directory.")
263 274
         ),
264 275
         actionButton("addOptSample", "Add a Sample"),
265 276
       ),
277
+      style = "primary"
266 278
     ),
267
-    tags$hr(),
268
-    h3("3. Import:"),
269
-    wellPanel(
270
-      h4("Samples to Import:"),
271
-      fluidRow(
272
-        column(3, tags$b("Type")),
273
-        column(3, tags$b("Location")),
274
-        column(3, tags$b("Sample Name")),
275
-        column(3, tags$b("Remove"))
279
+    
280
+    bsCollapsePanel(
281
+      "2. Create dataset:",
282
+      wellPanel(
283
+        h4("Samples to Import:"),
284
+        fluidRow(
285
+          column(3, tags$b("Type")),
286
+          column(3, tags$b("Location")),
287
+          column(3, tags$b("Sample Name")),
288
+          column(3, tags$b("Remove"))
289
+        ),
290
+        tags$div(id = "newSampleImport"),
291
+        tags$br(),
292
+        tags$br(),
293
+        actionButton("clearAllImport", "Clear Samples")
294
+      ),
295
+      shinyjs::hidden(
296
+        tags$div(
297
+          id = "combineOptions",
298
+          radioButtons("combineSCEChoice", label = NULL, c("Add to existing dataset" = 'addToExistingSCE',
299
+                                                           "Overwrite existing dataset" = "overwriteSCE")
300
+          )
301
+        )
276 302
       ),
277
-      tags$div(id = "newSampleImport"),
303
+      actionButton("uploadData", "Create"),
304
+      
278 305
       tags$br(),
279 306
       tags$br(),
280
-      actionButton("clearAllImport", "Clear Samples")
307
+      style = "primary"
281 308
     ),
282
-    shinyjs::hidden(
283
-      tags$div(
284
-        id = "combineOptions",
285
-        radioButtons("combineSCEChoice", label = NULL, c("Add to existing SCE object" = 'addToExistingSCE',
286
-                                                         "Overwrite existing SCE object" = "overwriteSCE")
309
+    
310
+    bsCollapsePanel(
311
+      "3. Data summary:",
312
+      hidden(
313
+        wellPanel(
314
+          id = "annotationData",
315
+          h3("Data summary"),
316
+          DT::dataTableOutput("summarycontents"),
317
+          
318
+          tags$hr(),
319
+          
320
+          h3("Dataset options:"),
321
+          selectInput("importFeatureNamesOpt",
322
+                      "Set feature ID (only showing annotations without the NAs)",
323
+                      c("Default", featureChoice)),
324
+          selectInput("importFeatureDispOpt",
325
+                      "Set feature names to be displayed in downstream visualization",
326
+                      c("Default", featureChoice)),
327
+          
328
+          withBusyIndicatorUI(actionButton("importFeatureDipSet", "Set")),
287 329
         )
288
-      )
289
-    ),
290
-    actionButton("uploadData", "Import"),
291
-  
292
-    tags$br(),
293
-    tags$br(),
294
-    hidden(
295
-      wellPanel(
296
-        id = "annotationData",
297
-        h3("Data summary"),
298
-        tableOutput("summarycontents"),
299
-
300
-        tags$hr(),
301
-
302
-        h3("Set Feature for Display:"),
303
-        selectInput("importFeatureDispOpt",
304
-                    "Select the feature ID type that should be displayed in downstream visualization",
305
-                    c("Rownames (Default)", featureChoice)),
306
-        withBusyIndicatorUI(actionButton("importFeatureDipSet", "Set")),
307
-      )
308
-    ),
309
-
310
-    tags$div(
311
-      class = "container",
312
-      p("")
313
-    ),
314
-
315
-    nonLinearWorkflowUI(id = "nlw-import")
316
-  )
317
-  #includeHTML("www/footer.html")
330
+      ),
331
+     
332
+      style = "primary"
333
+    )
334
+  ),
335
+  nonLinearWorkflowUI(id = "nlw-import")
318 336
 )
319 337