mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-26 19:27:24 +01:00
details: Improve download and table
This commit is contained in:
parent
d61fc157f4
commit
045d4dd6ad
1 changed files with 12 additions and 13 deletions
25
R/details.R
25
R/details.R
|
|
@ -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
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue