Skip to content

Commit

Permalink
Fix 3 matrices data input Upload bug (#78)
Browse files Browse the repository at this point in the history
* Fix gather again (#76)

* hot fix

* load tidyr package for gather fucntion

* fixed data Upload bug; added data upload name check NEEDS to be in main!

* removed forgotten browser statment

Co-authored-by: Paul Jonas Jost <70631928+PaulJonasJost@users.noreply.github.com>
  • Loading branch information
LeaSeep and PaulJonasJost authored Nov 25, 2022
1 parent b136e75 commit 766cf52
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion program/shinyApp/R/pca/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ pca_Server <- function(id, omic_type, row_select){
entitiesToInclude <- apply(df_loadings_filtered, 1, any)

df_loadings <- df_loadings[entitiesToInclude,] %>%
gather(key = "PC", value = "loading", -entity)
tidyr::gather(key = "PC", value = "loading", -entity)

global_max <- max(df_loadings$loading)
global_min <- -global_max
Expand Down
35 changes: 26 additions & 9 deletions program/shinyApp/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,14 @@ server <- function(input,output,session){
file = input$data_matrix1$datapath,
header = T,
row.names = 1,
check.names = F
check.names = T
)
Matrix2 <- read.csv(
file = input$data_matrix1$datapath,
header = T,
row.names = 1,
check.names = F
)
output$DataMatrix_VI <- DT::renderDataTable({
DT::datatable(data = Matrix)
})
Expand Down Expand Up @@ -271,11 +277,12 @@ server <- function(input,output,session){
"
})

check1 <- ifelse(all(rownames(Matrix)==rownames(annotation_rows)),snippetYes,snippetNo)
check2 <- ifelse(all(colnames(Matrix)==rownames(sample_table)),snippetYes,snippetNo)
check3 <- ifelse(any(is.na(Matrix)==T),snippetNo,snippetYes)
check4 <- ifelse(any(is.na(sample_table)==T),snippetNo,snippetYes)
check5 <- ifelse(any(is.na(annotation_rows)==T),snippetNo,snippetYes)
check1 <- ifelse(all(rownames(Matrix) == rownames(annotation_rows)),snippetYes,snippetNo)
check2 <- ifelse(all(colnames(Matrix) == rownames(sample_table)),snippetYes,snippetNo)
check3 <- ifelse(any(is.na(Matrix) == T),snippetNo,snippetYes)
check4 <- ifelse(any(is.na(sample_table) == T),snippetNo,snippetYes)
check5 <- ifelse(any(is.na(annotation_rows) == T),snippetNo,snippetYes)
check6 <- ifelse(all(colnames(Matrix2) == colnames(Matrix)),snippetYes,snippetNo)

if(check5 == snippetNo){
# Indicate columns with NA
Expand All @@ -288,13 +295,23 @@ server <- function(input,output,session){
check5 <- paste0(snippetNo," Following columns are potentially problematic: ",paste0(colsWithNa, collapse = ", "))
}

if(check6 == snippetNo){
# add help text
check6 <- paste0(
snippetNo,
"\n\t A syntactically valid name consists of letters, numbers and the dot or underline characters \n
and starts with a letter or the dot not followed by a number.\n
Therefore '12345' is invalid, 'ID_12345' is valid \n
Remember to change the Sample ID everywhere (Matrix & Sample Table")
}
output$OverallChecks <- renderText({
paste0("Some overall Checks are running run ...\n
Rownames of Matrix are the same as rownames of entitie table ",check1,"\n
Colnames of Matrix are same as rownames of sample table ",check2," \n
Matrix has no na ",check3,"\n
Sample table no na ",check4,"\n
Entitie table no na ",check5,"\n
Sample IDs have valid names ", check6, "\n
")
})
}
Expand Down Expand Up @@ -362,19 +379,19 @@ server <- function(input,output,session){
if(isTruthy(input$data_sample_anno1)){
data_input[[input$omicType]] <- list(
type=as.character(input$omicType),
Matrix=read.csv(
Matrix = read.csv(
file = input$data_matrix1$datapath,
header = T,
row.names = 1,
check.names = F
),
sample_table <- read.csv(
sample_table = read.csv(
file = input$data_sample_anno1$datapath,
header = T,
row.names = 1,
check.names = F
),
annotation_rows <- read.csv(
annotation_rows = read.csv(
file = input$data_row_anno1$datapath,
header = T,
row.names = 1,
Expand Down
1 change: 1 addition & 0 deletions program/shinyApp/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ library(zip)
library(cicerone)
library(shinyalert)
library(msigdbr)
library(tidyr)
# library(svglite)

source("R/C.R")
Expand Down

0 comments on commit 766cf52

Please sign in to comment.