Corrección del Survival y implementación de corte de operados y eliminación de muertes.
This commit is contained in:
+59
-4
@@ -587,6 +587,20 @@ server <- function(input, output) {
|
|||||||
observeEvent(analysis$taula, {})
|
observeEvent(analysis$taula, {})
|
||||||
table<-analysis$taula
|
table<-analysis$taula
|
||||||
if (input$vacc == "Sí"){
|
if (input$vacc == "Sí"){
|
||||||
|
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||||
|
select(DayPostInoc, Side) %>% unique() %>%
|
||||||
|
group_by(Side) %>% summarise(FirstOper=min(DayPostInoc))
|
||||||
|
if (input$operated == TRUE){
|
||||||
|
for (i in 1:nrow(firstoper)){
|
||||||
|
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(input$dead == TRUE){
|
||||||
|
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||||
|
pull(Animal)
|
||||||
|
table<-table %>% filter(!Animal %in% deadmice)
|
||||||
|
}
|
||||||
|
}
|
||||||
g<-list()
|
g<-list()
|
||||||
for (side in c("L","R")){
|
for (side in c("L","R")){
|
||||||
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
|
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
|
||||||
@@ -594,7 +608,7 @@ server <- function(input, output) {
|
|||||||
endtime["Dead"]<-dcast(tableR, Cage+Animal+Side+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") > input$cutoff
|
endtime["Dead"]<-dcast(tableR, Cage+Animal+Side+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") > input$cutoff
|
||||||
table_tumor<<-endtime
|
table_tumor<<-endtime
|
||||||
|
|
||||||
g[side]<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ table_tumor$Group, data=table_tumor),
|
g[side]<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||||
pval = T, pval.method = T,
|
pval = T, pval.method = T,
|
||||||
title = side,
|
title = side,
|
||||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||||
@@ -613,13 +627,27 @@ server <- function(input, output) {
|
|||||||
do.call(grid.arrange, g)
|
do.call(grid.arrange, g)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||||
|
pull(DayPostInoc) %>% min(na.rm = T)
|
||||||
|
print(firstoper)
|
||||||
|
|
||||||
|
if (input$operated == TRUE){
|
||||||
|
table<-table %>% filter(DayPostInoc < firstoper)
|
||||||
|
}else{
|
||||||
|
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||||
|
pull(Animal)
|
||||||
|
if(input$dead == TRUE){
|
||||||
|
table<-table %>% filter(!Animal %in% deadmice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tableR<-table %>% filter(!is.na(Volume))
|
tableR<-table %>% filter(!is.na(Volume))
|
||||||
endtime<-dcast(if(length(unique(tableR$DayPostInoc)) > 1){tableR %>% filter(Volume < input$cutoff)}else{tableR}, Animal+Side+Group~.,
|
endtime<-dcast(if(length(unique(tableR$DayPostInoc)) > 1){tableR %>% filter(Volume < input$cutoff)}else{tableR}, Animal+Side+Group~.,
|
||||||
value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
||||||
endtime["Dead"]<-dcast(tableR, Animal+Side+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") >= input$cutoff
|
endtime["Dead"]<-dcast(tableR, Animal+Side+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") >= input$cutoff
|
||||||
table_tumor<<-endtime
|
table_tumor<<-endtime
|
||||||
|
|
||||||
g<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ table_tumor$Group, data=table_tumor),
|
g<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||||
pval = T, pval.method = T,
|
pval = T, pval.method = T,
|
||||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||||
ggtheme=theme_classic(base_size=15)
|
ggtheme=theme_classic(base_size=15)
|
||||||
@@ -901,6 +929,20 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (input$vacc == "Sí"){
|
if (input$vacc == "Sí"){
|
||||||
|
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||||
|
select(DayPostInoc, Side) %>% unique() %>%
|
||||||
|
group_by(Side) %>% summarise(FirstOper=min(DayPostInoc))
|
||||||
|
if (input$operated == TRUE){
|
||||||
|
for (i in 1:nrow(firstoper)){
|
||||||
|
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(input$dead == TRUE){
|
||||||
|
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||||
|
pull(Animal)
|
||||||
|
table<-table %>% filter(!Animal %in% deadmice)
|
||||||
|
}
|
||||||
|
}
|
||||||
g<-list()
|
g<-list()
|
||||||
count<-1
|
count<-1
|
||||||
for (side in c("L","R")){
|
for (side in c("L","R")){
|
||||||
@@ -914,7 +956,7 @@ server <- function(input, output) {
|
|||||||
col<-gg_color_hue(length(unique(endtime$Group)))
|
col<-gg_color_hue(length(unique(endtime$Group)))
|
||||||
}
|
}
|
||||||
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
||||||
g[[count]]<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ Group, data=table_tumor),
|
g[[count]]<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||||
pval = T, pval.method = T,
|
pval = T, pval.method = T,
|
||||||
title = side,
|
title = side,
|
||||||
ggtheme=theme_classic(base_size=input$`font-size`),
|
ggtheme=theme_classic(base_size=input$`font-size`),
|
||||||
@@ -925,6 +967,19 @@ server <- function(input, output) {
|
|||||||
g_surv_vacc<-g
|
g_surv_vacc<-g
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||||
|
pull(DayPostInoc) %>% min(na.rm = T)
|
||||||
|
print(firstoper)
|
||||||
|
|
||||||
|
if (input$operated == TRUE){
|
||||||
|
table<-table %>% filter(DayPostInoc < firstoper)
|
||||||
|
}else{
|
||||||
|
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||||
|
pull(Animal)
|
||||||
|
if(input$dead == TRUE){
|
||||||
|
table<-table %>% filter(!Animal %in% deadmice)
|
||||||
|
}
|
||||||
|
}
|
||||||
tableR<-table %>% filter(!is.na(Volume))
|
tableR<-table %>% filter(!is.na(Volume))
|
||||||
endtime<-dcast(tableR %>% filter(Volume < (input$cutoff*as.numeric(input$unit_fact))), Animal+Group~., value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
endtime<-dcast(tableR %>% filter(Volume < (input$cutoff*as.numeric(input$unit_fact))), Animal+Group~., value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
||||||
endtime["Dead"]<-dcast(tableR, Animal+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") > (input$cutoff*as.numeric(input$unit_fact))
|
endtime["Dead"]<-dcast(tableR, Animal+Group~., value.var = "Volume", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% pull(".") > (input$cutoff*as.numeric(input$unit_fact))
|
||||||
@@ -935,7 +990,7 @@ server <- function(input, output) {
|
|||||||
col<-gg_color_hue(length(unique(table_tumor$Group)))
|
col<-gg_color_hue(length(unique(table_tumor$Group)))
|
||||||
}
|
}
|
||||||
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
||||||
g<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ Group, data=table_tumor),
|
g<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||||
pval = T, pval.method = T,
|
pval = T, pval.method = T,
|
||||||
# ggtheme=theme_classic(base_size=input$`font-size`),
|
# ggtheme=theme_classic(base_size=input$`font-size`),
|
||||||
palette = col
|
palette = col
|
||||||
|
|||||||
Reference in New Issue
Block a user