Skip to content

Commit

Permalink
Merge pull request #12 from manszamore/master
Browse files Browse the repository at this point in the history
Fixes error that occurred when column names referred to in a design matrix began with numbers
  • Loading branch information
flevander authored Feb 9, 2023
2 parents 8fbb856 + dc2b73a commit 0f41a08
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: OmicLoupe
Title: OmicLoupe: Taking a closer look at omics
Version: 1.1.6
Version: 1.1.7
Maintainer: Jakob Willforss <[email protected]>
Author: Jakob Willforss
Authors@R: c(person("Jakob", "Willforss", email="[email protected]", role=c("aut", "cre")))
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version 1.1.7

* Fixes error that occurred when column names referred to in a design matrix began with numbers or other disallowed characters
* Silences warning on startup about useShinyalert

# Version 1.1.6

* Add Dockerfile
Expand Down
1 change: 0 additions & 1 deletion R/module_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ setup_panel_ui <- function(id) {
fluidPage(
id = "outer_area",
shinyjs::useShinyjs(),
shinyalert::useShinyalert(),
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap")
),
Expand Down
18 changes: 11 additions & 7 deletions R/reactive_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,35 @@ setup_reactive_values_obj <- function(input) {
stringi::stri_extract_first(str = infile$name, regex = ".*")
}

load_data <- function(in_file, two_datasets=NULL) {
load_data <- function(in_file, two_datasets=NULL, is_design_file = FALSE) {
infile <- in_file
if (is.null(infile) || (is.logical(two_datasets) && two_datasets==FALSE)) {
return(NULL)
}
raw_df <- read_tsv(infile$datapath, col_types = cols())

original_colnames <- colnames(raw_df)
corrected_colnames <- make.names(colnames(raw_df))

colnames(raw_df) <- make.names(colnames(raw_df))
if (is_design_file) {
raw_df <- raw_df %>%
mutate_all(make.names) # Run make.names on all variables of the design matrix
} else {
colnames(raw_df) <- make.names(colnames(raw_df))
}

raw_df
}

rv <- list()
rv$setup_input <- reactive(input)
rv$filedata_1 <- reactive(load_data(input$data_file_1))
rv$filedata_2 <- reactive(load_data(input$data_file_2, input$two_datasets))
rv$design_1 <- reactive(load_data(input$design_file_1))
rv$design_1 <- reactive(load_data(input$design_file_1, is_design_file = TRUE))
rv$design_2 <- reactive({
if (!input$matched_samples) {
load_data(input$design_file_2)
load_data(input$design_file_2, is_design_file = TRUE)
}
else {
load_data(input$design_file_1)
load_data(input$design_file_1, is_design_file = TRUE)
}
})
rv$design_samplecol_1 <- reactive(input$design_sample_col_1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ After installation, you can immediately run the program.
You can subsequently navigate to the browser to access the software.

```{r}
> OmicLoupe::runApp()
OmicLoupe::runApp()
```

## Dependencies
Expand Down

0 comments on commit 0f41a08

Please sign in to comment.