Browse Source

Incorporar la opción de mostrar incremento de volumen.

master
marcelcosta 2 years ago
parent
commit
549a963928
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      invivos/app.R

+ 11
- 0
invivos/app.R

@ -42,6 +42,7 @@ ui <- fluidPage(
selectInput(inputId = "vacc", "Experimento de Vacunación", selected = "No", choices = c("Sí","No")), selectInput(inputId = "vacc", "Experimento de Vacunación", selected = "No", choices = c("Sí","No")),
uiOutput('cutoffUI'), uiOutput('cutoffUI'),
checkboxInput("filter_stats","Filtrar Estadística"), checkboxInput("filter_stats","Filtrar Estadística"),
checkboxInput("increase_volume","Usar Incremento de Volumen"),
downloadButton("downloadVolume", "Descargar Volúmenes") downloadButton("downloadVolume", "Descargar Volúmenes")
), ),
mainPanel( mainPanel(
@ -380,6 +381,15 @@ server <- function(input, output) {
if (!"Volume" %in% colnames(table)){table<-rename(table, "Volume"=value)} if (!"Volume" %in% colnames(table)){table<-rename(table, "Volume"=value)}
table<-table %>% filter(!is.na(Group)) table<-table %>% filter(!is.na(Group))
table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint))))) table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint)))))
if (input$increase_volume){
timepoints<-unique(table$Timepoint)
table<-table %>% select(-Major, -Minor) %>%
spread(Timepoint, Volume) %>%
mutate(across(all_of(timepoints), function(x){(x*100/`0`)-100})) %>%
gather(Timepoint, Volume, -Cage, -`ID animal`, -`ID tumor`, -Group) %>%
mutate(Volume=case_when(Volume < 0 ~ 0, T~Volume))
}
table$Timepoint<-factor(table$Timepoint, levels=mixedsort(as.numeric(as.character(unique(table$Timepoint)))))
analysis$taula_def<-table analysis$taula_def<-table
analysis$taula_vol<-dcast(table, Cage+`ID animal`+`ID tumor`~Timepoint,value.var = "Volume") analysis$taula_vol<-dcast(table, Cage+`ID animal`+`ID tumor`~Timepoint,value.var = "Volume")
table_plot<-dcast(dcast(table %>% filter(!is.na(Volume)), `ID animal`+Group+Timepoint~., value.var = "Volume", fun.aggregate = mean), Group~Timepoint) table_plot<-dcast(dcast(table %>% filter(!is.na(Volume)), `ID animal`+Group+Timepoint~., value.var = "Volume", fun.aggregate = mean), Group~Timepoint)
@ -390,6 +400,7 @@ server <- function(input, output) {
if (!is.null(input$file_analy) & !is.null(analysis$taula_def)){ if (!is.null(input$file_analy) & !is.null(analysis$taula_def)){
observeEvent(analysis$taula_def, {}) observeEvent(analysis$taula_def, {})
table<-analysis$taula_def table<-analysis$taula_def
if (input$vacc == "Sí"){ if (input$vacc == "Sí"){
ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=Group))+ ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=Group))+
geom_errorbar(stat="summary", width=0.05)+ geom_errorbar(stat="summary", width=0.05)+

Loading…
Cancel
Save