Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotly plots Design Experiments | MSstatsTMT Plotly plots adaptation for Shiny #89

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 2 additions & 48 deletions R/module-expdes-server.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,54 +48,8 @@ expdesServer <- function(input, output, session,parent_session, loadpage_input,
power= power_x)
}

# plot output
designSampleSizePlots_ggplotly <- function(data) {
index <- if (length(unique(data$numSample)) > 1) {
"numSample"
} else if (length(unique(data$power)) > 1) {
"power"
} else if (length(unique(data$numSample)) == 1 & length(unique(data$power)) == 1) {
"numSample"
} else {
stop("Invalid input")
}

text.size <- 12
axis.size <- 13
lab.size <- 17

if (index == "numSample") {
p <- plot_ly(data, x = ~desiredFC, y = ~numSample, type = "scatter", mode = "lines")
p <- layout(p, xaxis = list(title = "Desired fold change"),
yaxis = list(title = "Minimal number of biological replicates"),
showlegend = TRUE,
annotations = list(text = paste("FDR is", unique(data$FDR),
"<br>Statistical power is", unique(data$power))),
font = list(size = text.size, family = "Arial"),
title = "")
}

if (index == "power") {
p <- plot_ly(data, x = ~desiredFC, y = ~power, type = "scatter", mode = "lines")
p <- layout(p, xaxis = list(title = "Desired fold change"),
yaxis = list(title = "Power"),
showlegend = TRUE,
annotations = list(text = paste("Number of replicates is", unique(data$numSample),
"<br>FDR is", unique(data$FDR))),
font = list(size = text.size, family = "Arial"),
title = "")
}

return(p)
}






output$result_plot = renderPlotly({
designSampleSizePlots_ggplotly(future_exp())
designSampleSizePlots(future_exp(), isPlotly = TRUE)
})

#download
Expand All @@ -117,4 +71,4 @@ expdesServer <- function(input, output, session,parent_session, loadpage_input,
})
})

}
}
2 changes: 1 addition & 1 deletion R/module-qc-server.R
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,4 @@ qcServer <- function(input, output, session,parent_session, loadpage_input,get_d
preprocessData = preprocess_data
)
)
}
}