mirror of
https://github.com/johrpan/geposanui.git
synced 2025-10-25 20:07:23 +02: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",
|
||||
"",
|
||||
"Chromosome",
|
||||
"Chr.",
|
||||
"Distance",
|
||||
method_names,
|
||||
"Score",
|
||||
|
|
@ -93,15 +93,18 @@ details_server <- function(id, options, filtered_results) {
|
|||
|
||||
output$download <- downloadHandler(
|
||||
filename = "geposan_filtered_results.csv",
|
||||
content = function(file) {
|
||||
fwrite(output_data(), file = file)
|
||||
},
|
||||
content = \(file) fwrite(filtered_results()[, ..columns], file = file),
|
||||
contentType = "text/csv"
|
||||
)
|
||||
|
||||
output$genes <- DT::renderDT({
|
||||
dt <- DT::datatable(
|
||||
output_data(),
|
||||
data <- filtered_results()[, ..columns]
|
||||
data[, distance := glue::glue(
|
||||
"{format(round(distance / 1000000, digits = 2), nsmall = 2)} Mbp"
|
||||
)]
|
||||
|
||||
DT::datatable(
|
||||
data,
|
||||
rownames = FALSE,
|
||||
colnames = column_names,
|
||||
options = list(
|
||||
|
|
@ -109,13 +112,9 @@ details_server <- function(id, options, filtered_results) {
|
|||
columnDefs = list(list(visible = FALSE, targets = 2)),
|
||||
pageLength = 25
|
||||
)
|
||||
)
|
||||
|
||||
DT::formatPercentage(
|
||||
dt,
|
||||
c(method_ids, "score", "percentile"),
|
||||
digits = 2
|
||||
)
|
||||
) |>
|
||||
DT::formatRound(c(method_ids, "score"), digits = 4) |>
|
||||
DT::formatPercentage("percentile", digits = 2)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue