"Añadir soporte para varios Mocks"
This commit is contained in:
@@ -52,10 +52,12 @@ server <- function(input, output) {
|
||||
table<-dades$taula[,colnames(dades$taula) != "Groups"]
|
||||
t_mean<-dcast(melt(table, id="Mice"),Mice~variable, mean, na.rm=T)
|
||||
|
||||
if (length(grep("Mock", colnames(t_mean))) == 1){
|
||||
t_substr<-data.frame("Mice"=t_mean[,1],
|
||||
as.data.frame(t(apply(t_mean[,2:ncol(table)], 1, function(x) x-x[mock])))
|
||||
)
|
||||
t_mean_group<-merge(t_mean, unique(dades$taula[c("Mice","Groups")]), id="Mice")
|
||||
t_mean_group$Groups<-as.factor(t_mean_group$Groups)
|
||||
mock_mean<-dcast(t_mean_group, Groups~., value.var=mock, mean)
|
||||
mock_mean[,2]<-mock_mean[,2]*2
|
||||
mock_mean[mock_mean$. < input$umbral_pos,2]<-input$umbral_pos
|
||||
@@ -65,6 +67,17 @@ server <- function(input, output) {
|
||||
t_substr<-t_substr[,c("Mice", "Groups", colnames(t_substr)[!colnames(t_substr) %in% c("Mice", "Groups")])]
|
||||
t_substr[,3:ncol(t_substr)]<-apply(t_substr[,3:ncol(t_substr)],2, function(x) replace(x, which(x < 0),0))
|
||||
colnames(t_substr)<-c("Mice", "Groups", colnames(t_mean)[2:ncol(t_mean)])
|
||||
}else{
|
||||
print(1)
|
||||
t_especifica<-t_mean[,grep("Mock_", colnames(t_mean), invert=T)]
|
||||
t_mock<-t_mean[,c(which(colnames(t_mean) == "Mice"),grep("Mock_", colnames(t_mean)))]
|
||||
t_temp<-melt(t_especifica, variable.name = "condition", value.name = "spots")
|
||||
t_temp["spots_mock"]<-melt(t_mock, variable.name = "condition")[,"value"]
|
||||
t_substr<-data.frame(t_temp[c("Mice","condition")], "spots"=t_temp["spots"]-t_temp["spots_mock"])
|
||||
t_substr<-dcast(t_substr, Mice~condition)
|
||||
t_substr<-merge(t_substr, unique(dades$taula[c("Mice","Groups")]), id="Mice")
|
||||
t_substr$Groups<-as.factor(t_substr$Groups)
|
||||
}
|
||||
|
||||
t_substr_gp<-t_substr
|
||||
t_substr_gp[3:ncol(t_substr)]<-apply(t_substr[3:ncol(t_substr)], 2, function(x) gsub(".",",",x, fixed=T))
|
||||
@@ -74,17 +87,6 @@ server <- function(input, output) {
|
||||
write.xlsx(doc, "data4graphpad.xlsx",rowNames=T)
|
||||
|
||||
t<-melt(t_substr[,!colnames(t_substr) %in% c(ctrl, mock)])
|
||||
if (input$test == "T-test (adj Holm)"){
|
||||
t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "ttest")
|
||||
}
|
||||
if (input$test == "Wilcoxon (adj Holm)"){
|
||||
t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "wilcox")
|
||||
}
|
||||
|
||||
dades$stats<<-t_stats
|
||||
t_stats<-t_stats %>% filter(p.signif != "ns")
|
||||
|
||||
t_maps<-generate_labstats(t_stats, t, "value", "variable", "Groups")
|
||||
|
||||
if (input$showstats == F){
|
||||
t_stats<-as.data.frame(matrix(nrow=0, ncol=6))
|
||||
@@ -98,6 +100,18 @@ server <- function(input, output) {
|
||||
|
||||
set.seed(123)
|
||||
if (input$positive == T){
|
||||
if (input$test == "T-test (adj Holm)"){
|
||||
t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "ttest")
|
||||
}
|
||||
if (input$test == "Wilcoxon (adj Holm)"){
|
||||
t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "wilcox")
|
||||
}
|
||||
|
||||
dades$stats<<-t_stats
|
||||
t_stats<-t_stats %>% filter(p.signif != "ns")
|
||||
|
||||
t_maps<-generate_labstats(t_stats, t, "value", "variable", "Groups")
|
||||
|
||||
ggplot(melt(t_substr, id=c("Mice", ctrl, "Groups")), aes(variable, value))+
|
||||
labs(x="", y="Spots/2.5*10^5 cells")+
|
||||
# geom_errorbar(stat="summary", position=position_dodge(width=0.9), width=0.5, aes(fill=Groups))+
|
||||
@@ -112,7 +126,8 @@ server <- function(input, output) {
|
||||
theme_bw()+
|
||||
theme(axis.text.x=element_text(angle=45, hjust=1))
|
||||
}else{
|
||||
ggplot(melt(t_substr, id=c("Mice", ctrl, "Groups")), aes(variable, value))+
|
||||
ids<-if(ctrl %in% colnames(t_substr)){c("Mice", ctrl, "Groups")}else{c("Mice", "Groups")}
|
||||
ggplot(melt(t_substr, id=ids), aes(variable, value))+
|
||||
labs(x="", y="Spots/2.5*10^5 cells")+
|
||||
# geom_errorbar(stat="summary", position=position_dodge(width=0.9), width=0.5, aes(fill=Groups))+
|
||||
# geom_bar(stat="summary", position="dodge", color="black", aes(fill=Groups))+
|
||||
|
||||
Reference in New Issue
Block a user