details: Improve download and table

This commit is contained in:
Elias Projahn 2022-08-18 09:54:59 +02:00
parent d61fc157f4
commit 045d4dd6ad

View file

@ -71,7 +71,7 @@ details_server <- function(id, options, filtered_results) {
"", "",
"Gene", "Gene",
"", "",
"Chromosome", "Chr.",
"Distance", "Distance",
method_names, method_names,
"Score", "Score",
@ -93,15 +93,18 @@ details_server <- function(id, options, filtered_results) {
output$download <- downloadHandler( output$download <- downloadHandler(
filename = "geposan_filtered_results.csv", filename = "geposan_filtered_results.csv",
content = function(file) { content = \(file) fwrite(filtered_results()[, ..columns], file = file),
fwrite(output_data(), file = file)
},
contentType = "text/csv" contentType = "text/csv"
) )
output$genes <- DT::renderDT({ output$genes <- DT::renderDT({
dt <- DT::datatable( data <- filtered_results()[, ..columns]
output_data(), data[, distance := glue::glue(
"{format(round(distance / 1000000, digits = 2), nsmall = 2)} Mbp"
)]
DT::datatable(
data,
rownames = FALSE, rownames = FALSE,
colnames = column_names, colnames = column_names,
options = list( options = list(
@ -109,13 +112,9 @@ details_server <- function(id, options, filtered_results) {
columnDefs = list(list(visible = FALSE, targets = 2)), columnDefs = list(list(visible = FALSE, targets = 2)),
pageLength = 25 pageLength = 25
) )
) ) |>
DT::formatRound(c(method_ids, "score"), digits = 4) |>
DT::formatPercentage( DT::formatPercentage("percentile", digits = 2)
dt,
c(method_ids, "score", "percentile"),
digits = 2
)
}) })
}) })
} }