Compare commits
2 Commits
fd6493320f
...
9f0cda73eb
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f0cda73eb | |||
| 16088aac2b |
+143
-5
@@ -48,6 +48,7 @@ ui <- fluidPage(
|
|||||||
checkboxInput("filter_stats","Filtrar Estadística"),
|
checkboxInput("filter_stats","Filtrar Estadística"),
|
||||||
checkboxInput("increase_volume","Usar Incremento de Volumen"),
|
checkboxInput("increase_volume","Usar Incremento de Volumen"),
|
||||||
checkboxInput("operated","Cortar al operar", value = TRUE),
|
checkboxInput("operated","Cortar al operar", value = TRUE),
|
||||||
|
checkboxInput("dead","Eliminar ratones muertos", value = FALSE),
|
||||||
downloadButton("downloadVolume", "Descargar Volúmenes")
|
downloadButton("downloadVolume", "Descargar Volúmenes")
|
||||||
),
|
),
|
||||||
mainPanel(
|
mainPanel(
|
||||||
@@ -456,11 +457,17 @@ server <- function(input, output) {
|
|||||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||||
select(DayPostInoc, Side) %>% unique() %>%
|
select(DayPostInoc, Side) %>% unique() %>%
|
||||||
group_by(Side) %>% summarise(FirstOper=min(DayPostInoc))
|
group_by(Side) %>% summarise(FirstOper=min(DayPostInoc))
|
||||||
|
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||||
|
pull(Animal)
|
||||||
|
print(deadmice)
|
||||||
if (input$operated == TRUE){
|
if (input$operated == TRUE){
|
||||||
for (i in 1:nrow(firstoper)){
|
for (i in 1:nrow(firstoper)){
|
||||||
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
|
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
if(input$dead == TRUE){
|
||||||
|
table<-table %>% filter(!Animal %in% deadmice)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Group))+
|
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Group))+
|
||||||
@@ -480,6 +487,12 @@ server <- function(input, output) {
|
|||||||
|
|
||||||
if (input$operated == TRUE){
|
if (input$operated == TRUE){
|
||||||
table<-table %>% filter(DayPostInoc < firstoper)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Group))+
|
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Group))+
|
||||||
@@ -518,6 +531,20 @@ server <- function(input, output) {
|
|||||||
table<-rbind(table, basal)
|
table<-rbind(table, basal)
|
||||||
|
|
||||||
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Animal))+
|
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=Animal))+
|
||||||
# geom_errorbar(stat="summary", width=0.05)+
|
# geom_errorbar(stat="summary", width=0.05)+
|
||||||
geom_line()+
|
geom_line()+
|
||||||
@@ -528,6 +555,19 @@ server <- function(input, output) {
|
|||||||
labs(x="Days after tumor inoculation")+
|
labs(x="Days after tumor inoculation")+
|
||||||
theme_bw()
|
theme_bw()
|
||||||
}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)
|
||||||
|
}
|
||||||
|
}
|
||||||
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=paste0(Animal, Side)))+
|
ggplot(table, aes(DayPostInoc, Volume, color=Group, group=paste0(Animal, Side)))+
|
||||||
# geom_errorbar(stat="summary", width=0.05)+
|
# geom_errorbar(stat="summary", width=0.05)+
|
||||||
geom_line()+
|
geom_line()+
|
||||||
@@ -547,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))
|
||||||
@@ -554,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"),
|
||||||
@@ -573,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)
|
||||||
@@ -713,6 +781,12 @@ server <- function(input, output) {
|
|||||||
for (i in 1:nrow(firstoper)){
|
for (i in 1:nrow(firstoper)){
|
||||||
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
||||||
errbar<-table %>% group_by(Group,Side,DayPostInoc) %>%
|
errbar<-table %>% group_by(Group,Side,DayPostInoc) %>%
|
||||||
@@ -739,7 +813,14 @@ server <- function(input, output) {
|
|||||||
|
|
||||||
if (input$operated == TRUE){
|
if (input$operated == TRUE){
|
||||||
table<-table %>% filter(DayPostInoc < firstoper)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
||||||
errbar<-table %>% group_by(Group, DayPostInoc) %>%
|
errbar<-table %>% group_by(Group, DayPostInoc) %>%
|
||||||
summarise(mean=mean(Volume, na.rm=T), std=std(Volume)) %>%
|
summarise(mean=mean(Volume, na.rm=T), std=std(Volume)) %>%
|
||||||
@@ -761,6 +842,22 @@ server <- function(input, output) {
|
|||||||
}
|
}
|
||||||
if (input$fig_id == "Cinética Individual"){
|
if (input$fig_id == "Cinética Individual"){
|
||||||
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<-ggplot(table, aes(as.numeric(as.character(DayPostInoc)), Volume, color=Group, group=Animal))+
|
g<-ggplot(table, aes(as.numeric(as.character(DayPostInoc)), Volume, color=Group, group=Animal))+
|
||||||
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
||||||
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
||||||
@@ -768,6 +865,20 @@ server <- function(input, output) {
|
|||||||
facet_grid(factor(Side, labels = c("Vaccination", "Rechallenge"))~Group, scale="free_y")+
|
facet_grid(factor(Side, labels = c("Vaccination", "Rechallenge"))~Group, scale="free_y")+
|
||||||
theme_bw()
|
theme_bw()
|
||||||
}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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g<-ggplot(table, aes(as.numeric(as.character(DayPostInoc)), Volume, color=Group, group=Animal))+
|
g<-ggplot(table, aes(as.numeric(as.character(DayPostInoc)), Volume, color=Group, group=Animal))+
|
||||||
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
||||||
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
||||||
@@ -818,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")){
|
||||||
@@ -831,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`),
|
||||||
@@ -842,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))
|
||||||
@@ -852,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