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

Pull request for altexp functionality #16

Open
wants to merge 55 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
eb53fe1
Update landing_page.R
ArioMoniri Feb 17, 2025
5e8393e
Update observers.R
ArioMoniri Feb 17, 2025
584f2df
Update landing_page.R
ArioMoniri Feb 17, 2025
3f6b757
Update utils.R
ArioMoniri Feb 17, 2025
ff5084b
Update miaDash.R
ArioMoniri Feb 17, 2025
34416cd
Update tour.R
ArioMoniri Feb 17, 2025
043ea28
Update test-miaDash.R
ArioMoniri Feb 17, 2025
5336ce9
Update test-observers.R
ArioMoniri Feb 17, 2025
d9a0150
Update test-outputs.R
ArioMoniri Feb 17, 2025
19c1c1b
Update test-utils.R
ArioMoniri Feb 17, 2025
91e98a5
Update observers.R
ArioMoniri Feb 17, 2025
94fcd6d
Update observers.R
ArioMoniri Feb 17, 2025
db895eb
Update miaDash.R
ArioMoniri Feb 17, 2025
d43be01
Update landing_page.R
ArioMoniri Feb 18, 2025
a882b23
Update utils.R
ArioMoniri Feb 18, 2025
48a2329
Update observers.R
ArioMoniri Feb 18, 2025
770f786
Update miaDash.R
ArioMoniri Feb 18, 2025
d566fb0
Update landing_page.R
ArioMoniri Feb 18, 2025
c8f64b3
Update observers.R
ArioMoniri Feb 18, 2025
8659b5e
Update utils.R
ArioMoniri Feb 18, 2025
d346fc5
Update DESCRIPTION
ArioMoniri Feb 18, 2025
4644694
Update landing_page.R
ArioMoniri Feb 18, 2025
777d044
Update observers.R
ArioMoniri Feb 18, 2025
277a792
Update landing_page.R
ArioMoniri Feb 18, 2025
961f1f8
Update utils.R
ArioMoniri Feb 18, 2025
4001921
Update observers.R
ArioMoniri Feb 18, 2025
601d9d3
Update test-utils.R
ArioMoniri Feb 18, 2025
e1a716b
Update miaDash.R
ArioMoniri Feb 18, 2025
1f70ef9
Update landing_page.R
ArioMoniri Feb 19, 2025
734b87f
Update observers.R
ArioMoniri Feb 19, 2025
c0f3f94
Update landing_page.R
ArioMoniri Feb 19, 2025
a89c62e
Update observers.R
ArioMoniri Feb 19, 2025
bd4a9e4
Update landing_page.R
ArioMoniri Feb 19, 2025
4a14b76
Update observers.R
ArioMoniri Feb 19, 2025
19b0558
Update landing_page.R
ArioMoniri Feb 19, 2025
17b1222
Update miaDash.R
ArioMoniri Feb 19, 2025
72acfb3
Update utils.R
ArioMoniri Feb 20, 2025
cd9c86a
Update landing_page.R
ArioMoniri Feb 20, 2025
acab69f
Update miaDash.R
ArioMoniri Feb 20, 2025
200efd7
Update observers.R
ArioMoniri Feb 20, 2025
cfdf9d9
Update utils.R
ArioMoniri Feb 20, 2025
d772f48
Update observers.R
ArioMoniri Feb 20, 2025
991e38e
Update miaDash.R
ArioMoniri Feb 20, 2025
7f96dd3
Update landing_page.R
ArioMoniri Feb 21, 2025
614f519
Update observers.R
ArioMoniri Feb 21, 2025
ea617b6
Create run-rstudio.yml
ArioMoniri Feb 21, 2025
cfcf3a8
Create Dockerfile.rstudio
ArioMoniri Feb 21, 2025
4e98a14
Update run-rstudio.yml
ArioMoniri Feb 21, 2025
13f716e
Update run-rstudio.yml
ArioMoniri Feb 21, 2025
341f568
Update miaDash.R
ArioMoniri Mar 2, 2025
01de39c
Update Dockerfile
ArioMoniri Mar 2, 2025
adf0207
Update Dockerfile
ArioMoniri Mar 4, 2025
51a8e0d
Update Dockerfile
ArioMoniri Mar 4, 2025
45ea923
Update Dockerfile
ArioMoniri Mar 4, 2025
37617f3
Update Dockerfile
ArioMoniri Mar 4, 2025
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
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Imports:
SummarizedExperiment,
TreeSummarizedExperiment,
utils,
vegan
vegan,
SingleCellExperiment,
SummarizedExperiment
Suggests:
BiocStyle,
knitr,
Expand Down
73 changes: 69 additions & 4 deletions R/landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,46 @@
label = "colTree:", placeholder = "col.tree",
accept = c(".tree", ".tre")),
div(style = "margin-top: -20px")),


tabPanel(title = "Alternative Experiments", value = "altexp", br(),

fileInput(inputId = "alt_assay", label = "Alternative Assays:",
accept = ".csv", multiple = TRUE,
placeholder = "alt_assay.csv"),
div(style = "margin-top: -20px"),

fileInput(inputId = "alt_coldata", label = "Alternative colData:",
accept = ".csv", placeholder = "alt_coldata.csv"),
div(style = "margin-top: -20px"),

fileInput(inputId = "alt_rowdata", label = "Alternative rowData:",
accept = ".csv", placeholder = "alt_rowdata.csv"),
div(style = "margin-top: -20px"),

textInput(inputId = "alt_name",
label = "Alternative Experiment Name:",
placeholder = "e.g. agglomerated"),

actionButton("add_altexp", "Add Alternative Experiment",
class = "btn-primary")),


tabPanel(title = "Merged Data", value = "merged", br(),
fileInput(inputId = "merged_file", label = "Merged Dataset:",
accept = ".rds", placeholder = "merged_dataset.rds"),
selectInput(inputId = "agglomeration_levels",
label = "Auto-create experiments for taxonomic levels:",
choices = c("None", "All", "Custom"),
selected = "None"),
conditionalPanel(
condition = "input.agglomeration_levels == 'Custom'",
checkboxGroupInput(inputId = "custom_levels",
label = "Select levels:",
choices = c("Phylum", "Class", "Order", "Family", "Genus", "Species"))
)),



tabPanel(title = "Foreign", value = "foreign", br(),

Expand Down Expand Up @@ -109,6 +149,10 @@
box(id = "manipulate.panel", title = "Manipulate", width = 4,
status = "primary", solidHeader = TRUE, collapsible = TRUE,

selectInput(inputId = "target_experiment",
label = "Apply to:",
choices = c("Main Experiment" = "main")),

tabsetPanel(id = "manipulate",

tabPanel(title = "Subset", value = "subset", br(),
Expand All @@ -129,11 +173,16 @@
step = 1)),

tabPanel(title = "Agglomerate", value = "agglomerate",

br(),

selectInput(inputId = "taxrank",
label = "Taxonomic rank:", choices = NULL)),
label = "Taxonomic rank:", choices = NULL),
# Add these new inputs here
checkboxInput(inputId = "save_as_altexp",
label = "Save as Alternative Experiment",
value = FALSE),
textInput(inputId = "altexp_name",
label = "Alternative Experiment Name:",
placeholder = "e.g. genus_level")),

tabPanel(title = "Transform", value = "transform", br(),

Expand Down Expand Up @@ -203,6 +252,20 @@
width = 4, status = "primary", solidHeader = TRUE,
collapsible = TRUE,

selectInput(inputId = "experiment_choice",
label = "Select Experiment:",
choices = c("Main" = "main"),
selected = "main"),

checkboxGroupInput(inputId = "altexp_panels",
label = "Show in Panels:",
choices = c("Abundance Plot" = "AbundancePlot",
"Heatmap" = "ComplexHeatmapPlot",
"Data Table" = "RowDataTable"),
selected = "AbundancePlot"),

hr(),

selectInput(inputId = "panels", label = "Panels:",
choices = c(default_panels, other_panels),
multiple = TRUE, selected = c(default_panels)),
Expand Down Expand Up @@ -250,6 +313,8 @@
})

.create_import_observers(input, rObjects)
.create_altexp_observers(input, rObjects)
.create_merged_file_observers(input, rObjects)
.create_manipulate_observers(input, rObjects)
.create_estimate_observers(input, rObjects)
.update_observers(input, session, rObjects)
Expand All @@ -261,4 +326,4 @@

invisible(NULL)
# nocov end
}
}
72 changes: 58 additions & 14 deletions R/miaDash.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#' @importFrom iSEE iSEE
#' @importFrom utils packageVersion
#' @importFrom htmltools tags
#' @importFrom SingleCellExperiment altExp altExpNames
miaDash <- function() {

addResourcePath("assets", system.file("assets", package = "miaDash"))
Expand All @@ -34,7 +35,8 @@ miaDash <- function() {
paste0("Microbiome Analysis Dashboard - v", packageVersion("miaDash")),
tags$img(src = "assets/mia_logo.png", height = "40px", style = "margin-left: 10px"),
style = "cursor: pointer; font-weight: 500",
onclick = "window.location='https://miadash-microbiome.2.rahtiapp.fi/'")
onclick = "window.location.href='https://miadash-microbiome.2.rahtiapp.fi/'; window.location.reload(true);"
)

)

Expand All @@ -50,22 +52,64 @@ miaDash <- function() {
#' @importFrom mia taxonomyRanks
#' @importFrom SummarizedExperiment rowData colData
#' @importFrom SingleCellExperiment reducedDims
.launch_isee <- function(FUN, initial, session, rObjects) {

.launch_isee <- function(FUN, initial, session, rObjects, input) {
# nocov start
tse <- rObjects$tse
current_exp <- .get_experiment(tse, input$experiment_choice)

# Filter panels based on experiment type
if(input$experiment_choice != "main") {
initial <- .filter_panels_by_experiment(initial, altexp_panels)
}

initial <- lapply(initial, function(x) eval(parse(text = paste0(x, "()"))))
initial <- lapply(initial, function(x) {
panel <- eval(parse(text = paste0(x, "()")))

# Configure panel based on experiment type
if(inherits(panel, "DimensionReducedPanel")) {
panel$ExperimentName <- input$experiment_choice
}

# Add feature set specific configurations
if(!is.null(input$experiment_choice) &&
input$experiment_choice != "main") {
panel$DataType <- "alternative"

# Handle agglomerated data
if(grepl("^agglomerated_", input$experiment_choice)) {
panel$AggregationLevel <- sub("^agglomerated_", "",
input$experiment_choice)
}

# Configure specific panel types
if(inherits(panel, "AbundancePlot") ||
inherits(panel, "ComplexHeatmapPlot")) {
panel$ShowFeatureNames <- TRUE
panel$ShowAggregationLevel <- TRUE
}
}

return(panel)
})


initial <- .check_panel(tse, initial, "RowDataTable", rowData)
initial <- .check_panel(tse, initial, "ColumnDataTable", colData)
initial <- .check_panel(tse, initial, "RowTreePlot", rowLinks)
initial <- .check_panel(tse, initial, "AbundancePlot", taxonomyRanks)
initial <- .check_panel(tse, initial, "ReducedDimensionPlot", reducedDims)
initial <- .check_panel(tse, initial, "LoadingPlot", reducedDims)
initial <- .check_panel(tse, initial, "ColumnTreePlot", colLinks)
# Check panels for current experiment
initial <- .check_panel(tse, initial, "RowDataTable", rowData,
input$experiment_choice)
initial <- .check_panel(tse, initial, "ColumnDataTable", colData,
input$experiment_choice)
initial <- .check_panel(tse, initial, "RowTreePlot", rowLinks,
input$experiment_choice)
initial <- .check_panel(tse, initial, "AbundancePlot", taxonomyRanks,
input$experiment_choice)
initial <- .check_panel(tse, initial, "ReducedDimensionPlot", reducedDims,
input$experiment_choice)
initial <- .check_panel(tse, initial, "LoadingPlot", reducedDims,
input$experiment_choice)
initial <- .check_panel(tse, initial, "ColumnTreePlot", colLinks,
input$experiment_choice)

FUN(SE = tse, INIT = initial)#, EXTRA = initial)
FUN(SE = current_exp, INIT = initial)

enable("iSEE_INTERNAL_organize_panels") # organize panels
enable("iSEE_INTERNAL_link_graph") # link graph
Expand All @@ -74,8 +118,8 @@ miaDash <- function() {
enable("iSEE_INTERNAL_panel_settings") # panel settings
enable("iSEE_INTERNAL_open_vignette") # open vignette
enable("iSEE_INTERNAL_session_info") # session info
enable("iSEE_INTERNAL_citation_info") # citation info
enable("iSEE_INTERNAL_citation_info") # citation info

invisible(NULL)
# nocov end
}
}
Loading
Loading