Compare commits
25 Commits
fa2c784602
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0887ab933a | |||
| a3eaf3e7a9 | |||
| 1237794f62 | |||
| bbf19befaf | |||
| 3a9907c480 | |||
| cda5d7f881 | |||
| 8539caa993 | |||
| 7783dc6c4b | |||
| fe865f55e4 | |||
| b01f7bb11d | |||
| 459a8001fe | |||
| 455901a1db | |||
| 43776f80cb | |||
| d9a5689c99 | |||
| 092a788125 | |||
| 80362a28db | |||
| 9f0cda73eb | |||
| 16088aac2b | |||
| fd6493320f | |||
| 8dc0177515 | |||
| 35a73598d3 | |||
| 0e4ef399fd | |||
| 2ca8e2b212 | |||
| 54a20f10c7 | |||
| 3e6b97c546 |
+307
-108
@@ -26,6 +26,7 @@ ui <- fluidPage(
|
||||
uiOutput('ncages'),
|
||||
uiOutput('ntumors'),
|
||||
# selectInput(inputId = "measure_sys", "Sistema de medida", selected = "L-W-D", choices = c("L-W-D","Min-Max","Absorbance")),
|
||||
uiOutput('day_vol'),
|
||||
uiOutput('lowcut'),
|
||||
uiOutput('upcut'),
|
||||
uiOutput('goButton'),
|
||||
@@ -46,6 +47,8 @@ ui <- fluidPage(
|
||||
uiOutput('cutoffUI'),
|
||||
checkboxInput("filter_stats","Filtrar Estadística"),
|
||||
checkboxInput("increase_volume","Usar Incremento de Volumen"),
|
||||
checkboxInput("operated","Cortar al operar", value = TRUE),
|
||||
checkboxInput("dead","Eliminar ratones muertos", value = FALSE),
|
||||
downloadButton("downloadVolume", "Descargar Volúmenes")
|
||||
),
|
||||
mainPanel(
|
||||
@@ -64,6 +67,7 @@ ui <- fluidPage(
|
||||
h3('Seleccionar figura'),
|
||||
selectInput("fig_id", "", selected="", choices=c("Cinética Grupo", "Cinética Individual", "Survival")),
|
||||
h3('Formato'),
|
||||
selectInput("unit_fact", "Factor de unidad", choices = c("0.001","1","1000"), selected="1"),
|
||||
sliderInput("width", "Ancho", min=1000, max=20000, step=1000, value=10000),
|
||||
sliderInput("height", "Altura", min=1000, max=20000, step=1000, value=6000),
|
||||
textInput("colors", label="Colors", value=""),
|
||||
@@ -102,22 +106,39 @@ server <- function(input, output) {
|
||||
dades$db<-NULL
|
||||
observe({
|
||||
if (!is.null(input$file_sizes)){
|
||||
taula<-read.xlsx(input$file_sizes$datapath, sheet = 1, sep.names = " ")
|
||||
if ("DPV" %in% colnames(taula)){
|
||||
taula<-dcast(taula, Cage+`ID animal`+`ID tumor`+Group~DPV, value.var = "0")
|
||||
# taula$Major<-taula$Major/1000
|
||||
# taula$Minor<-taula$Minor/1000
|
||||
# taula["Volume"]<-((taula$Major*taula$Minor*taula$Minor)*(pi/6))*1000
|
||||
taula$Major<-taula$Major
|
||||
taula$Minor<-taula$Minor
|
||||
taula["Volume"]<-((taula$Major*taula$Minor*taula$Minor)*(pi/6))
|
||||
table<-read.xlsx(input$file_sizes$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T,cols=1:11)
|
||||
if("ID.animal" %in% colnames(table)){
|
||||
table<-table %>%
|
||||
rename(Animal=`ID.animal`, Side=`ID.tumor`)
|
||||
table<-table %>% gather(DayPostInoc, Value, which(!is.na(as.numeric(colnames(table))))) %>%
|
||||
relocate(DayPostInoc, .before = Group) %>% spread(DPV, Value) %>%
|
||||
rename(Long=Major, Wide=Minor) %>%
|
||||
add_column(Date="", .after = "Animal") %>%
|
||||
add_column(Weight="", .after="Group") %>%
|
||||
add_column(Volume="",Observations="") %>%
|
||||
relocate(Side, .after = "Group")
|
||||
table$DayPostInoc<-as.numeric(table$DayPostInoc)
|
||||
}
|
||||
if ("TS" %in% colnames(taula)){
|
||||
taula<-dcast(taula, Cage+`ID animal`+`ID tumor`+Group~TS, value.var = "0")
|
||||
taula["Volume"]<-taula$`TS-Deep`*taula$`TS-Length`*taula$`TS-Width`*pi/6
|
||||
table$Date<-format(table$Date, format="%d/%m/%Y")
|
||||
if ("sex" %in% colnames(table)){table<-select(table, -sex)}
|
||||
if ("Abs" %in% colnames(table)){
|
||||
table<-rename(table, "Volume"="Abs")
|
||||
}else{
|
||||
for (i in 1:nrow(table)){
|
||||
long<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Long"]),"+", fixed = T)[[1]]))
|
||||
wide<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Wide"]),"+", fixed = T)[[1]]))
|
||||
table[i,"Volume"]<-sum(sapply(1:length(long), function(x) (long[x]*wide[x]*wide[x])*(pi/6)))
|
||||
}
|
||||
table$Volume<-as.numeric(table$Volume)
|
||||
}
|
||||
dades$taula<-taula
|
||||
dades$groups<-read.xlsx(input$file_sizes$datapath, sheet = 2, colNames=F)[,1]
|
||||
|
||||
if ("Cage" %in% colnames(table)){
|
||||
table$Animal<-paste0(table$Cage, table$Animal)
|
||||
table<-table[,-which(colnames(table) == "Cage")]
|
||||
}
|
||||
|
||||
dades$taula<-table
|
||||
dades$groups<-read.xlsx(input$file_sizes$datapath, sheet = "Groups", colNames=F)[,1]
|
||||
if (readxl::excel_sheets(input$file_sizes$datapath) %>% length > 2){
|
||||
dades$sex<-read.xlsx(input$file_sizes$datapath, sheet = 3, sep.names = " ")
|
||||
}
|
||||
@@ -126,7 +147,15 @@ server <- function(input, output) {
|
||||
output$firstPlot <- renderPlot({
|
||||
observeEvent(dades$taula, {})
|
||||
if (!is.null(dades$taula)){
|
||||
ggplot(dades$taula, aes(x="1", y=Volume))+geom_hline(yintercept = c(input$lowcut, input$upcut), color="red")+geom_quasirandom(width=0.2)
|
||||
ggplot(dades$taula %>% filter(DayPostInoc == input$day_vol), aes(x="1", y=Volume))+
|
||||
geom_hline(yintercept = c(input$lowcut, input$upcut), color="red")+
|
||||
geom_quasirandom(width=0.2)
|
||||
}
|
||||
})
|
||||
|
||||
output$day_vol<-renderUI({
|
||||
if (!is.null(dades$taula)){
|
||||
selectInput("day_vol", "Día para volúmenes", choices = sort(unique(dades$taula$DayPostInoc)))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -137,15 +166,17 @@ server <- function(input, output) {
|
||||
})
|
||||
output$lowcut<-renderUI({
|
||||
if (!is.null(dades$taula)){
|
||||
cut.max<-round(max(dades$taula$Volume, na.rm = T), 2)
|
||||
step<-round(max(dades$taula$Volume, na.rm = T)/100, 2)
|
||||
taula<-dades$taula %>% filter(DayPostInoc == input$day_vol)
|
||||
cut.max<-round(max(taula$Volume, na.rm = T), 2)
|
||||
step<-round(max(taula$Volume, na.rm = T)/100, 2)
|
||||
sliderInput("lowcut", "Corte inferior", min=0, max=cut.max, step=step, value=0)
|
||||
}
|
||||
})
|
||||
output$upcut<-renderUI({
|
||||
if (!is.null(dades$taula)){
|
||||
cut.max<-round(max(dades$taula$Volume, na.rm = T), 2)+0.01
|
||||
step<-round(max(dades$taula$Volume, na.rm = T)/20, 2)
|
||||
taula<-dades$taula %>% filter(DayPostInoc == input$day_vol)
|
||||
cut.max<-round(max(taula$Volume, na.rm = T), 2)+0.01
|
||||
step<-round(max(taula$Volume, na.rm = T)/20, 2)
|
||||
sliderInput("upcut", "Corte superior", min=0, max=cut.max, step=step, value=cut.max)
|
||||
}
|
||||
})
|
||||
@@ -166,11 +197,12 @@ server <- function(input, output) {
|
||||
})
|
||||
|
||||
grafic<-eventReactive(input$goButton,{
|
||||
df<-dades$taula
|
||||
df<-dades$taula %>% filter(DayPostInoc == input$day_vol)
|
||||
df<-df[!is.na(df$Volume),]
|
||||
print(df)
|
||||
up_cuttof<-input$upcut
|
||||
low_cuttof<-input$lowcut
|
||||
# print(up_cuttof)
|
||||
|
||||
df<-df[df$Volume < up_cuttof & df$Volume >= low_cuttof,]
|
||||
if (is.null(dades$sex)){
|
||||
df<-add_column(df, sex="undefined")
|
||||
@@ -178,16 +210,14 @@ server <- function(input, output) {
|
||||
df<-merge(df, dades$sex)
|
||||
}
|
||||
|
||||
|
||||
# df["Mouse"]<-gsub("[a-zA-Z]", "", df$MouseID)
|
||||
# print(df$Volume)
|
||||
|
||||
s<-shapiro.test(df$Volume)[[2]]
|
||||
|
||||
ngroup<-length(dades$groups)
|
||||
df_def<-list()
|
||||
# print(head(df))
|
||||
|
||||
for (sex.var in unique(df$sex)){
|
||||
# print(sex.var)
|
||||
df_sex<-df %>% filter(`sex` == sex.var)
|
||||
ind.list<-list()
|
||||
pval.list<-list()
|
||||
@@ -196,8 +226,8 @@ server <- function(input, output) {
|
||||
for (data in 1:input$iterations){
|
||||
interr=T
|
||||
while(interr == T){
|
||||
ind<-sample(rep(dades$groups, each=ceiling(length(unique(df_sex$`ID animal`))/ngroup)), length(unique(df_sex$`ID animal`)))
|
||||
df_sex<-merge(df_sex[,c("ID animal", "ID tumor","Volume")], data.frame("ID animal"=unique(df_sex$`ID animal`), "group"=as.factor(ind),check.names=F))
|
||||
ind<-sample(rep(dades$groups, each=ceiling(length(unique(df_sex$Animal))/ngroup)), length(unique(df_sex$Animal)))
|
||||
df_sex<-merge(df_sex[,c("Animal", "Side","Volume")], data.frame("Animal"=unique(df_sex$Animal), "group"=as.factor(ind),check.names=F))
|
||||
if ((nrow(df_sex)/ngroup) %% 2 == 0){
|
||||
interr<-any(table(df_sex$group) < floor(nrow(df_sex)/ngroup) | table(df_sex$group) > ceiling(nrow(df_sex)/ngroup))
|
||||
}else{
|
||||
@@ -205,7 +235,7 @@ server <- function(input, output) {
|
||||
interr<-diff(range(table(ind))) > 1
|
||||
}
|
||||
}
|
||||
ind.list[[data]]<-df_sex[,c("ID animal","ID tumor","group","Volume")]
|
||||
ind.list[[data]]<-df_sex[,c("Animal","Side","group","Volume")]
|
||||
lvn.list[data]<-leveneTest(Volume ~ group, data = df_sex[,3:4])[[2]][1]
|
||||
if (s < 0.05){
|
||||
k<-kruskal.test(df_sex$Volume,df_sex$group)
|
||||
@@ -218,33 +248,36 @@ 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])]))[1]
|
||||
# print(df_sex)
|
||||
df_def[[sex.var]]<-merge(df_sex %>% select(-group), ind.list[[index]])
|
||||
}
|
||||
df_def<-do.call(rbind, c(df_def, make.row.names=F))
|
||||
# lapply(df_def, function(x) x %>% as_tibble %>% print(n=Inf))
|
||||
# df_def<-rbind(df_def[[1]], df_def[[2]], make.row.names=F)
|
||||
|
||||
if ("Group" %in% colnames(df_def)){
|
||||
df_def<-df_def %>% select(-"Group")
|
||||
}
|
||||
df_def<-merge(
|
||||
if(!is.null(dades$sex)){merge(dades$taula, dades$sex)}else{dades$taula %>% add_column(sex="undefined")} %>% select(-Group),
|
||||
df_def[,c("ID animal", "group")] %>% unique, all=T, by="ID animal")
|
||||
if("DPV" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, Major, Minor, group))}
|
||||
if("TS-Deep" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, `TS-Deep`,`TS-Length`,`TS-Width`, group))}
|
||||
|
||||
df_def[!paste0(df_def$`ID animal`, df_def$`ID tumor`) %in% paste0(df$`ID animal`, df$`ID tumor`),"group"]<-NA
|
||||
df_def<-merge(
|
||||
if(!is.null(dades$sex)){merge(dades$taula %>% filter(DayPostInoc == input$day_vol), dades$sex)%>% select(-Group)}else{
|
||||
dades$taula %>% filter(DayPostInoc == input$day_vol) %>% add_column(sex="undefined")} %>% select(-Group),
|
||||
df_def[,c("Animal", "group")] %>% unique, all=T, by="Animal")
|
||||
df_def<-df_def %>% rename(Group=group)
|
||||
|
||||
df_def<-select(df_def, Animal, sex, Date, DayPostInoc, Group, Side, Weight, Long, Wide, Volume, Observations)
|
||||
# if("DPV" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, Major, Minor, group))}
|
||||
# if("TS-Deep" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, `TS-Deep`,`TS-Length`,`TS-Width`, group))}
|
||||
|
||||
df_def[!paste0(df_def$Animal, df_def$Side) %in% paste0(df$Animal, df$Side),"Group"]<-NA
|
||||
dades$db<-df_def
|
||||
|
||||
if (is.null(dades$sex)){
|
||||
ggplot(df_def, aes(group, Volume))+
|
||||
ggplot(df_def, aes(Group, Volume))+
|
||||
geom_boxplot(outlier.alpha = F)+
|
||||
geom_jitter(width=0.25)+
|
||||
geom_point(stat="summary", color="blue", size=3)+
|
||||
theme(axis.text.x = element_text(angle=90, hjust=1, vjust=0.5))
|
||||
}else{
|
||||
ggarrange(
|
||||
ggplot(df_def, aes(group, Volume))+
|
||||
ggplot(df_def, aes(Group, Volume))+
|
||||
geom_boxplot(outlier.alpha = F)+
|
||||
geom_jitter(width=0.25, aes(color=sex))+
|
||||
geom_point(stat="summary", color="blue", size=3)+
|
||||
@@ -254,7 +287,7 @@ server <- function(input, output) {
|
||||
ggplot(df_def, aes(sex, Volume))+
|
||||
geom_boxplot(outlier.alpha = F)+
|
||||
geom_quasirandom(width=0.3),
|
||||
ggplot(df_def, aes(group, fill=sex))+
|
||||
ggplot(df_def, aes(Group, fill=sex))+
|
||||
geom_bar(stat="count", color="black", position="dodge")+
|
||||
guides(fill="none")+
|
||||
theme(axis.text.x = element_text(angle=90, hjust=1, vjust=0.5)), ncol = 1, heights = c(0.35, 0.65)),
|
||||
@@ -274,8 +307,8 @@ server <- function(input, output) {
|
||||
observeEvent(dades$db, {})
|
||||
if (!is.null(dades$db)){
|
||||
df<-dades$db
|
||||
df_sum<-dcast(df, group~., value.var = "Volume", fun.aggregate = mean, na.rm=T) %>% rename("Mean"=".")
|
||||
df_sum["SEM"]<-dcast(df, group~., value.var = "Volume", fun.aggregate = std.error, na.rm=T) %>% pull(`.`)
|
||||
df_sum<-dcast(df, Group~., value.var = "Volume", fun.aggregate = mean, na.rm=T) %>% rename("Mean"=".")
|
||||
df_sum["SEM"]<-dcast(df, Group~., value.var = "Volume", fun.aggregate = std.error, na.rm=T) %>% pull(`.`)
|
||||
df_sum
|
||||
}
|
||||
})
|
||||
@@ -283,7 +316,7 @@ server <- function(input, output) {
|
||||
observeEvent(dades$db, {})
|
||||
if (!is.null(dades$db)){
|
||||
df<-dades$db
|
||||
df %>% arrange(group)
|
||||
df %>% arrange(Group)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -299,31 +332,15 @@ server <- function(input, output) {
|
||||
# timepoint<-c(7,10,13,16,19,22,25)
|
||||
|
||||
if (!is.null(input$file_sizes)){
|
||||
# dtemplate<-dades$db %>% select(-Volume,-sex)
|
||||
# dtemplate<-melt(dtemplate, id=c("Cage", "ID animal", "ID tumor", "group"), variable.name = "DPV", value.name = "0") %>% rename("Group"="group")
|
||||
# dtemplate<-dtemplate[,c("Cage", "ID animal", "ID tumor", "Group", "DPV", "0")] %>% arrange(`ID animal`, `ID tumor`)
|
||||
# template<-expand.grid(dades$db$MouseID, timepoint)
|
||||
# colnames(template)<-c("MouseID", "Timepoint")
|
||||
# template<-template[order(template$Timepoint, template$MouseID),]
|
||||
# template<-merge(template, dades$db[c("MouseID", "group")])
|
||||
# if (input$measure_sys == "L-W-D"){
|
||||
# template<-rbind(template, template, template)
|
||||
# template<-template[order(template$Timepoint, template$MouseID),]
|
||||
# template["TS"]<-rep(c("TS-Length", "TS-Width", "TS-Deep"), nrow(template)/3)
|
||||
# dtemplate<-dcast(template, MouseID+group+TS~Timepoint)
|
||||
# dtemplate<-dtemplate[mixedorder(as.character(dtemplate$MouseID)),]
|
||||
# }
|
||||
# if (input$measure_sys == "Min-Max"){
|
||||
# template<-rbind(template, template)
|
||||
# template<-template[order(template$Timepoint, template$MouseID),]
|
||||
# template["DPV"]<-rep(c("Major", "Minor"), nrow(template)/2)
|
||||
# dtemplate<-dcast(template, MouseID+group+DPV~Timepoint)
|
||||
# dtemplate<-dtemplate[mixedorder(as.character(dtemplate$MouseID)),]
|
||||
# }
|
||||
# dtemplate<-dtemplate %>% add_column(.after="MouseID", "ID tumor"=dtemplate$MouseID)%>% rename(`ID animal`=MouseID)
|
||||
# dtemplate["ID tumor"]<-gsub("[[:digit:]]","",dtemplate$`ID tumor`)
|
||||
# dtemplate["ID animal"]<-gsub("[LR]","",dtemplate$`ID animal`)
|
||||
# dtemplate[,5:ncol(dtemplate)]<-""
|
||||
template<-dades$db %>%
|
||||
select(Animal, Group) %>% unique()
|
||||
dtemplate<-merge(dades$taula %>% select(-Group), template) %>%
|
||||
arrange(DayPostInoc, Animal, Side) %>%
|
||||
select(Animal, Date, DayPostInoc, Group, Side,
|
||||
Weight, Long, Wide, Volume, Observations)
|
||||
if ("Abs" %in% colnames(read.xlsx(input$file_sizes$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T,cols=1:11))){
|
||||
dtemplate<-rename(dtemplate, "Abs"="Volume")
|
||||
}
|
||||
}else{
|
||||
|
||||
template<-data.frame(
|
||||
@@ -339,6 +356,7 @@ server <- function(input, output) {
|
||||
Volume="",
|
||||
Observations=""
|
||||
)
|
||||
template<-template %>% mutate(Animal=paste0(Cage,Animal)) %>% select(-Cage)
|
||||
dtemplate<-template
|
||||
}
|
||||
write.xlsx(list("Measures"=dtemplate, "Groups"=NULL,"Sex"=NULL), file)
|
||||
@@ -354,8 +372,8 @@ server <- function(input, output) {
|
||||
analysis$taula_vol<-NULL
|
||||
observe({
|
||||
if (!is.null(input$file_analy)){
|
||||
table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T)
|
||||
if("ID animal" %in% colnames(table)){
|
||||
table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T,cols=1:11)
|
||||
if("ID.animal" %in% colnames(table)){
|
||||
table<-table %>%
|
||||
rename(Animal=`ID.animal`, Side=`ID.tumor`)
|
||||
table<-table %>% gather(DayPostInoc, Value, which(!is.na(as.numeric(colnames(table))))) %>%
|
||||
@@ -365,8 +383,8 @@ server <- function(input, output) {
|
||||
add_column(Weight="", .after="Group") %>%
|
||||
add_column(Volume="",Observations="") %>%
|
||||
relocate(Side, .after = "Group")
|
||||
table$DayPostInoc<-as.numeric(table$DayPostInoc)
|
||||
}
|
||||
|
||||
table$Date<-format(table$Date, format="%d/%m/%Y")
|
||||
if ("sex" %in% colnames(table)){table<-select(table, -sex)}
|
||||
for (i in 1:nrow(table)){
|
||||
@@ -374,6 +392,11 @@ server <- function(input, output) {
|
||||
wide<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Wide"]),"+", fixed = T)[[1]]))
|
||||
table[i,"Volume"]<-sum(sapply(1:length(long), function(x) (long[x]*wide[x]*wide[x])*(pi/6)))
|
||||
}
|
||||
table$Volume<-as.numeric(table$Volume)
|
||||
if ("Cage" %in% colnames(table)){
|
||||
table$Animal<-paste0(table$Cage, table$Animal)
|
||||
table<-table[,-which(colnames(table) == "Cage")]
|
||||
}
|
||||
|
||||
## Autocompletado de grupo
|
||||
table_group<-merge(
|
||||
@@ -385,14 +408,26 @@ server <- function(input, output) {
|
||||
table %>% select(-Group),
|
||||
table_group
|
||||
) %>% relocate(Group, .after = DayPostInoc) %>%
|
||||
relocate(Cage, .before = Animal) %>%
|
||||
arrange(DayPostInoc, Animal, Side)
|
||||
|
||||
if("Groups" %in% readxl::excel_sheets(input$file_analy$datapath)){
|
||||
levels<-read.xlsx(input$file_analy$datapath, sheet = "Groups", colNames=F)[,1]
|
||||
print(levels)
|
||||
table$Group<-factor(table$Group, levels=levels)
|
||||
table<-filter(table, !is.na(Group))
|
||||
}else(table$Group<-factor(table$Group))
|
||||
|
||||
|
||||
if (input$increase_volume){
|
||||
cols<-colnames(table)
|
||||
timepoints<-unique(table$DayPostInoc)
|
||||
table_old<-select(table, -Volume)
|
||||
table_vols<-table %>%
|
||||
select(-Weight, -Date, -Long, -Wide,-Observations) %>%
|
||||
spread(DayPostInoc, Volume) %>%
|
||||
mutate(across(all_of(as.character(timepoints)), function(x){(x*100/`0`)-100})) %>%
|
||||
gather(DayPostInoc, Volume, all_of(as.character(timepoints))) %>%
|
||||
mutate(Volume=case_when(Volume < 0 ~ 0, T~Volume))
|
||||
table<-merge(table_old, table_vols)[,cols]
|
||||
}
|
||||
|
||||
analysis$taula<-table
|
||||
@@ -402,7 +437,6 @@ server <- function(input, output) {
|
||||
if (!is.null(analysis$taula)){
|
||||
observeEvent(analysis$taula, {})
|
||||
max_val<-max(analysis$taula$Volume, na.rm = T)
|
||||
# print(max_val)
|
||||
sliderInput("cutoff", "Cutoff para Survival", min=0, max=round(max_val, digits=2), step=round(max_val, digits=2)/200, value=max_val)
|
||||
}
|
||||
})
|
||||
@@ -414,17 +448,10 @@ server <- function(input, output) {
|
||||
|
||||
table<-analysis$taula
|
||||
table<-table %>% filter(!is.na(Group))
|
||||
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 %>% group_by(Group, DayPostInoc, Side) %>% count() %>% spread(DayPostInoc, n)
|
||||
}
|
||||
})
|
||||
|
||||
output$cin_group<-renderPlot({
|
||||
if (!is.null(input$file_analy) & !is.null(analysis$taula)){
|
||||
observeEvent(analysis$taula, {})
|
||||
@@ -434,7 +461,6 @@ server <- function(input, output) {
|
||||
sides<-unique(table$Side)
|
||||
groups<-table %>% select(Animal, Group) %>% unique() %>% pull(Group)
|
||||
basal<-data.frame(
|
||||
Cage="",
|
||||
Animal=rep(animals, each=length(sides)),
|
||||
Date="",
|
||||
DayPostInoc=0,
|
||||
@@ -446,8 +472,27 @@ server <- function(input, output) {
|
||||
Volume=0,
|
||||
Observations=""
|
||||
)
|
||||
table<-rbind(table, basal)
|
||||
if (!(0 %in% table$DayPostInoc) | sum(table[table$DayPostInoc == 0,"Volume"],na.rm = T) == 0){
|
||||
table<-rbind(table, basal)
|
||||
}
|
||||
|
||||
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))
|
||||
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
|
||||
pull(Animal)
|
||||
|
||||
if (input$operated == TRUE & nrow(firstoper) > 0){
|
||||
for (i in 1:nrow(firstoper)){
|
||||
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))+
|
||||
geom_errorbar(stat="summary", width=0.05)+
|
||||
geom_line(stat="summary")+
|
||||
@@ -458,6 +503,21 @@ server <- function(input, output) {
|
||||
scale_x_continuous(expand = expansion(mult = c(0,0.05)), limits = c(0, (round(max(table$DayPostInoc) / 5)+1)*5))+
|
||||
theme_bw()
|
||||
}else{
|
||||
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
if (firstoper == Inf){firstoper<-c()}
|
||||
|
||||
if (input$operated == TRUE & length(firstoper) > 0){
|
||||
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))+
|
||||
geom_errorbar(stat="summary",width=0.05)+
|
||||
geom_line(stat="summary")+
|
||||
@@ -479,7 +539,6 @@ server <- function(input, output) {
|
||||
sides<-unique(table$Side)
|
||||
groups<-table %>% select(Animal, Group) %>% unique() %>% pull(Group)
|
||||
basal<-data.frame(
|
||||
Cage="",
|
||||
Animal=rep(animals, each=length(sides)),
|
||||
Date="",
|
||||
DayPostInoc=0,
|
||||
@@ -491,9 +550,25 @@ server <- function(input, output) {
|
||||
Volume=0,
|
||||
Observations=""
|
||||
)
|
||||
table<-rbind(table, basal)
|
||||
if (!(0 %in% table$DayPostInoc) | sum(table[table$DayPostInoc == 0,"Volume"],na.rm = T) == 0){
|
||||
table<-rbind(table, basal)
|
||||
}
|
||||
|
||||
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 & nrow(firstoper) > 0){
|
||||
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))+
|
||||
# geom_errorbar(stat="summary", width=0.05)+
|
||||
geom_line()+
|
||||
@@ -504,6 +579,19 @@ server <- function(input, output) {
|
||||
labs(x="Days after tumor inoculation")+
|
||||
theme_bw()
|
||||
}else{
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
if (firstoper == Inf){firstoper<-c()}
|
||||
|
||||
if (input$operated == TRUE & length(firstoper) > 0){
|
||||
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)))+
|
||||
# geom_errorbar(stat="summary", width=0.05)+
|
||||
geom_line()+
|
||||
@@ -523,14 +611,29 @@ server <- function(input, output) {
|
||||
observeEvent(analysis$taula, {})
|
||||
table<-analysis$taula
|
||||
if (input$vacc == "Sí"){
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
select(DayPostInoc, Side) %>% unique() %>%
|
||||
if (firstoper == Inf){firstoper<-c()}
|
||||
|
||||
if (input$operated == TRUE & length(firstoper) > 0){
|
||||
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()
|
||||
for (side in c("L","R")){
|
||||
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
|
||||
endtime<-dcast(tableR %>% filter(Volume < input$cutoff), Cage+Animal+Side+Group~., value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
||||
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<-dcast(tableR %>% filter(Volume < input$cutoff), Animal+Side+Group~., 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
|
||||
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,
|
||||
title = side,
|
||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||
@@ -549,13 +652,27 @@ server <- function(input, output) {
|
||||
do.call(grid.arrange, g)
|
||||
|
||||
}else{
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
if (firstoper == Inf){firstoper<-c()}
|
||||
|
||||
if (input$operated == TRUE & length(firstoper) > 0){
|
||||
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))
|
||||
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"=".")
|
||||
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
|
||||
|
||||
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,
|
||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||
ggtheme=theme_classic(base_size=15)
|
||||
@@ -579,9 +696,6 @@ server <- function(input, output) {
|
||||
for (side in c("L","R")){
|
||||
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
|
||||
if (length(unique(tableR$Volume)) > 1 & length(unique(tableR$DayPostInoc)) > 1){
|
||||
print(paste0("Side: ",side))
|
||||
# print(summary(aov(Volume~Group+DayPostInoc+Error(paste0(Animal,Cage)), data=tableR)))
|
||||
print(summary(aov(Volume~Group+DayPostInoc+Error(Animal), data=tableR)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,7 +755,6 @@ server <- function(input, output) {
|
||||
},
|
||||
content = function(file){
|
||||
dtemplate<-analysis$taula
|
||||
# print(str(dtemplate))
|
||||
write.xlsx(dtemplate,file, )
|
||||
}
|
||||
)
|
||||
@@ -660,11 +773,11 @@ server <- function(input, output) {
|
||||
observeEvent(analysis$taula, {})
|
||||
if (!is.null(input$file_analy) & !is.null(analysis$taula)){
|
||||
table<-analysis$taula
|
||||
table$Volume<-table$Volume*as.numeric(input$unit_fact)
|
||||
animals<-unique(table$Animal)
|
||||
sides<-unique(table$Side)
|
||||
groups<-table %>% select(Animal, Group) %>% unique() %>% pull(Group)
|
||||
basal<-data.frame(
|
||||
Cage="",
|
||||
Animal=rep(animals, each=length(sides)),
|
||||
Date="",
|
||||
DayPostInoc=0,
|
||||
@@ -676,10 +789,27 @@ server <- function(input, output) {
|
||||
Volume=0,
|
||||
Observations=""
|
||||
)
|
||||
table<-rbind(table, basal)
|
||||
if (!(0 %in% table$DayPostInoc) | sum(table[table$DayPostInoc == 0,"Volume"],na.rm = T) == 0){
|
||||
table<-rbind(table, basal)
|
||||
}
|
||||
if (input$fig_id %in% c("Cinética Grupo", "Cinética Individual")){
|
||||
if (input$fig_id == "Cinética Grupo"){
|
||||
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)
|
||||
}
|
||||
}
|
||||
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
||||
errbar<-table %>% group_by(Group,Side,DayPostInoc) %>%
|
||||
summarise(mean=mean(Volume, na.rm=T), std=std(Volume)) %>%
|
||||
@@ -699,6 +829,19 @@ server <- function(input, output) {
|
||||
geom_segment(data=errbar, aes(y=mean+std, yend=mean+std,
|
||||
x=x,xend=xend))
|
||||
}else{
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
std<-function(x, na.rm=T){sd(x, na.rm=na.rm)/sqrt(length(x))}
|
||||
errbar<-table %>% group_by(Group, DayPostInoc) %>%
|
||||
summarise(mean=mean(Volume, na.rm=T), std=std(Volume)) %>%
|
||||
@@ -720,6 +863,22 @@ server <- function(input, output) {
|
||||
}
|
||||
if (input$fig_id == "Cinética Individual"){
|
||||
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))+
|
||||
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
||||
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
||||
@@ -727,7 +886,20 @@ server <- function(input, output) {
|
||||
facet_grid(factor(Side, labels = c("Vaccination", "Rechallenge"))~Group, scale="free_y")+
|
||||
theme_bw()
|
||||
}else{
|
||||
g<-ggplot(table, aes(as.numeric(as.character(DayPostInoc)), Volume, color=Group, group=Animal))+
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
|
||||
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=paste0(Animal,Side)))+
|
||||
scale_x_continuous(expand = expansion(mult = c(0,0.0)),
|
||||
breaks=sort(unique(as.numeric(as.character(table$DayPostInoc)))),
|
||||
limits = c(0,max(as.numeric(as.character(table$DayPostInoc)))*1.1))+
|
||||
@@ -775,23 +947,38 @@ server <- function(input, output) {
|
||||
hues <- seq(15, 375, length=n+1)
|
||||
hcl(h=hues, l=l, c=100)[1:n]
|
||||
}
|
||||
|
||||
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()
|
||||
count<-1
|
||||
for (side in c("L","R")){
|
||||
tableR<-filter(table, Side == side) %>% filter(!is.na(Volume))
|
||||
endtime<-dcast(tableR %>% filter(Volume < input$cutoff), Cage+Animal+Side+Group~., value.var = "DayPostInoc", fun.aggregate = function(x){max(as.numeric(as.character(x)))}) %>% rename("end"=".")
|
||||
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<-dcast(tableR %>% filter(Volume < (input$cutoff*as.numeric(input$unit_fact))), Animal+Side+Group~., 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*as.numeric(input$unit_fact))
|
||||
table_tumor<-endtime
|
||||
if (input$colors != ""){
|
||||
col<-input$colors
|
||||
col<-strsplit(input$colors, ",")[[1]]
|
||||
}else{
|
||||
col<-gg_color_hue(length(unique(endtime$Group)))
|
||||
}
|
||||
g[[count]]<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ table_tumor$Group, data=table_tumor),
|
||||
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
||||
g[[count]]<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||
pval = T, pval.method = T,
|
||||
title = side,
|
||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||
ggtheme=theme_classic(base_size=input$`font-size`),
|
||||
palette = col
|
||||
)
|
||||
@@ -800,19 +987,31 @@ server <- function(input, output) {
|
||||
g_surv_vacc<-g
|
||||
|
||||
}else{
|
||||
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
|
||||
pull(DayPostInoc) %>% min(na.rm = T)
|
||||
|
||||
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))
|
||||
endtime<-dcast(tableR %>% filter(Volume < input$cutoff), 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
|
||||
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))
|
||||
table_tumor<-endtime
|
||||
if (input$colors != ""){
|
||||
col<-input$colors
|
||||
col<-strsplit(input$colors, ",")[[1]]
|
||||
}else{
|
||||
col<-gg_color_hue(length(unique(table_tumor$Group)))
|
||||
}
|
||||
g<-ggsurvplot(survfit(Surv(table_tumor$end, table_tumor$Dead) ~ table_tumor$Group, data=table_tumor),
|
||||
table_tumor$Group<-factor(table_tumor$Group, levels = levels(analysis$taula$Group))
|
||||
g<-ggsurvplot(survfit(Surv(end, Dead) ~ Group, data=table_tumor),
|
||||
pval = T, pval.method = T,
|
||||
# legend.labs = paste(c("< median", ">= median"), "MICA"),
|
||||
ggtheme=theme_classic(base_size=input$`font-size`),
|
||||
# ggtheme=theme_classic(base_size=input$`font-size`),
|
||||
palette = col
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user