Compare commits

...

3 Commits

+12 -10
View File
@@ -148,19 +148,19 @@ server <- function(input, output) {
df<-df[!is.na(df$Volume),] df<-df[!is.na(df$Volume),]
up_cuttof<-input$upcut up_cuttof<-input$upcut
low_cuttof<-input$lowcut low_cuttof<-input$lowcut
print(up_cuttof) # print(up_cuttof)
df<-df[df$Volume < up_cuttof & df$Volume >= low_cuttof,] df<-df[df$Volume < up_cuttof & df$Volume >= low_cuttof,]
df<-merge(df, dades$sex) df<-merge(df, dades$sex)
# df["Mouse"]<-gsub("[a-zA-Z]", "", df$MouseID) # df["Mouse"]<-gsub("[a-zA-Z]", "", df$MouseID)
print(df$Volume) # print(df$Volume)
s<-shapiro.test(df$Volume)[[2]] s<-shapiro.test(df$Volume)[[2]]
ngroup<-length(dades$groups) ngroup<-length(dades$groups)
df_def<-list() df_def<-list()
print(head(df)) # print(head(df))
for (sex.var in c("male","female")){ for (sex.var in c("male","female")){
print(sex.var) # print(sex.var)
df_sex<-df %>% filter(`sex` == sex.var) df_sex<-df %>% filter(`sex` == sex.var)
ind.list<-list() ind.list<-list()
pval.list<-list() pval.list<-list()
@@ -191,7 +191,7 @@ server <- function(input, output) {
} }
} }
index<-which(unlist(lvn.list) == min(unlist(lvn.list)[which(unlist(pval.list) %in% sort(unlist(pval.list), decreasing = T)[1:20])])) index<-which(unlist(lvn.list) == min(unlist(lvn.list)[which(unlist(pval.list) %in% sort(unlist(pval.list), decreasing = T)[1:20])]))
print(df_sex) # print(df_sex)
df_def[[sex.var]]<-merge(df_sex %>% select(-group), ind.list[[index]]) df_def[[sex.var]]<-merge(df_sex %>% select(-group), ind.list[[index]])
} }
# df_def<-do.call(rbind, c(df_def, make.row.names=F)) # df_def<-do.call(rbind, c(df_def, make.row.names=F))
@@ -317,14 +317,16 @@ server <- function(input, output) {
analysis$taula_vol<-NULL analysis$taula_vol<-NULL
observe({ observe({
if (!is.null(input$file_analy)){ if (!is.null(input$file_analy)){
analysis$taula<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ") %>% select(-sex) table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ")
if ("sex" %in% colnames(table)){table<-select(table, -sex)}
analysis$taula<-table
} }
}) })
output$cutoffUI<-renderUI({ output$cutoffUI<-renderUI({
if (!is.null(analysis$taula_def)){ if (!is.null(analysis$taula_def)){
observeEvent(analysis$taula_def, {}) observeEvent(analysis$taula_def, {})
max_val<-max(analysis$taula_def$Volume, na.rm = T) max_val<-max(analysis$taula_def$Volume, na.rm = T)
print(max_val) # print(max_val)
sliderInput("cutoff", "Cutoff para Survival", min=0, max=round(max_val), step=round(max_val)/200, value=max_val) sliderInput("cutoff", "Cutoff para Survival", min=0, max=round(max_val), step=round(max_val)/200, value=max_val)
} }
}) })
@@ -345,7 +347,7 @@ server <- function(input, output) {
} }
table<-melt(table, id=colnames(table)[colnames(table) %in% col_nodays], variable.name = "Timepoint") table<-melt(table, id=colnames(table)[colnames(table) %in% col_nodays], variable.name = "Timepoint")
table$Timepoint<-gsub("[A-Za-z ]","",table$Timepoint) table$Timepoint<-gsub("[A-Za-z ]","",table$Timepoint)
print(table) # print(table)
if ("DPV" %in% colnames(table)){ if ("DPV" %in% colnames(table)){
table<-dcast(table, Cage+`ID animal`+`ID tumor`+Group+Timepoint~DPV, value.var = "value") table<-dcast(table, Cage+`ID animal`+`ID tumor`+Group+Timepoint~DPV, value.var = "value")
table$Major<-table$Major table$Major<-table$Major
@@ -396,7 +398,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
print(table , ) print(table)
if (input$vacc == "Sí"){ if (input$vacc == "Sí"){
ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=`ID animal`))+ ggplot(table, aes(as.numeric(as.character(Timepoint)), Volume, color=Group, group=`ID animal`))+
# geom_errorbar(stat="summary", width=0.05)+ # geom_errorbar(stat="summary", width=0.05)+
@@ -408,7 +410,7 @@ server <- function(input, output) {
labs(x="Days after tumor challenge")+ labs(x="Days after tumor challenge")+
theme_bw() theme_bw()
}else{ }else{
ggplot(table, aes(Timepoint, Volume, color=Group, group=`ID animal`))+ ggplot(table, aes(Timepoint, Volume, color=Group, group=paste0(`ID animal`, `ID tumor`)))+
# geom_errorbar(stat="summary", width=0.05)+ # geom_errorbar(stat="summary", width=0.05)+
geom_line()+ geom_line()+
geom_point()+ geom_point()+