Skip to content

Commit

Permalink
Adding demo files download to the app
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Aug 16, 2024
1 parent 143fab0 commit e7174ea
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# tima 2.11.0

* Added demo files download to the app
* Better packaging
* Improved documentation
* Fixed all CRAN warnings
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
"SystemRequirements": null
},
"keywords": ["metaboliteannotation", "chemotaxonomy", "scoringsystem", "naturalproducts", "computationalmetabolomics", "taxonomicdistance", "specializedmetabolome"],
"fileSize": "3284.67KB",
"fileSize": "3298.849KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
51 changes: 39 additions & 12 deletions inst/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ ui <- shiny::fluidPage(
shiny::tabPanel(
title = "Files",
shiny::h3("Required files"),
shiny::h5("They SHOULD be located in `data/source`"),
shiny::div(
shiny::fileInput(
inputId = "fil_spe_raw",
label = .label_mandatory("MGF file"),
accept = ".mgf"
)
),
shiny::downloadButton(outputId = "demo_spe", "Download example spectra")
) |>
shinyhelper::helper(
type = "inline",
Expand All @@ -78,10 +78,13 @@ ui <- shiny::fluidPage(
# "If you have a GNPS job ID, the spectra will be stored there."
)
),
shiny::fileInput(
inputId = "fil_fea_raw",
label = .label_mandatory("Features table"),
accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip")
shiny::div(
shiny::fileInput(
inputId = "fil_fea_raw",
label = .label_mandatory("Features table"),
accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip")
),
shiny::downloadButton(outputId = "demo_fea", "Download example features")
) |>
shinyhelper::helper(
type = "inline",
Expand All @@ -92,10 +95,13 @@ ui <- shiny::fluidPage(
# "If you have a GNPS job ID, the spectra will be stored there."
)
),
shiny::fileInput(
inputId = "fil_met_raw",
label = "Metadata table (mandatory if no taxon name)",
accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip")
shiny::div(
shiny::fileInput(
inputId = "fil_met_raw",
label = "Metadata table (mandatory if no taxon name)",
accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip")
),
shiny::downloadButton(outputId = "demo_met", "Download example metadata")
) |>
shinyhelper::helper(
type = "inline",
Expand Down Expand Up @@ -1787,8 +1793,8 @@ ui <- shiny::fluidPage(
yaml_small$organisms$taxon <- org_tax
yaml_small$options$high_confidence <- hig_con
yaml_small$options$summarise <- summarise
create_dir("params")
yaml::write_yaml(x = yaml_small, file = get_default_paths()$params$prepare_params)
tima:::create_dir("params")
yaml::write_yaml(x = yaml_small, file = tima:::get_default_paths()$params$prepare_params)

message(x = "... Advanced")
yaml_advanced <- yamls_params[["params/prepare_params_advanced"]]
Expand Down Expand Up @@ -2111,6 +2117,27 @@ server <- function(input, output, session) {
## Observe helpers
shinyhelper::observe_helpers()

output$demo_spe <- downloadHandler(
filename = basename(tima:::get_default_paths()$urls$examples$spectra),
content = function(file) {
writeLines(readLines(tima:::get_default_paths()$urls$examples$spectra_mini), file)
}
)

output$demo_fea <- downloadHandler(
filename = basename(tima:::get_default_paths()$urls$examples$features),
content = function(file) {
writeLines(readLines(tima:::get_default_paths()$urls$examples$features), file)
}
)

output$demo_met <- downloadHandler(
filename = basename(tima:::get_default_paths()$urls$examples$metadata),
content = function(file) {
writeLines(readLines(tima:::get_default_paths()$urls$examples$metadata), file)
}
)

## Mandatory fields
fields_mandatory <- c("fil_fea_raw", "fil_spe_raw", "fil_pat")

Expand Down

0 comments on commit e7174ea

Please sign in to comment.