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

Added cards inside PlotModule #253

Merged
merged 27 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f90f338
feat: beta version of cards
ESCRI11 Mar 7, 2023
3edbe73
feat: individual download for each card element
ESCRI11 Mar 8, 2023
bc12bc2
style: cards transparency
ESCRI11 Mar 8, 2023
1e1d4d4
feat: we can have cards with different plotlibs
ESCRI11 Mar 21, 2023
da98222
Squashed commit of the following:
ESCRI11 Mar 21, 2023
62630d6
fix: added missing code (?)
ESCRI11 Mar 21, 2023
dd6046f
Revert "fix: added missing code (?)"
ESCRI11 Mar 21, 2023
f47cb89
Merge branch 'master' into dev-`PlotModule_cards`
ESCRI11 Apr 30, 2023
be7b520
feat: merged properly inside cards
ESCRI11 Apr 30, 2023
1828cdc
feat: added static heatmap
ESCRI11 Apr 30, 2023
8e323c5
fix: handle single outputFunc
ESCRI11 May 1, 2023
c20e707
tab/spacing rollback
ESCRI11 May 1, 2023
4b927dc
further rollback
ESCRI11 May 1, 2023
9118921
/idem
ESCRI11 May 1, 2023
81ead4f
tabs
ESCRI11 May 1, 2023
ed0e149
feat: change to `navs_bar`
ESCRI11 May 1, 2023
d7c17cb
feat: nav_bar also in modal
ESCRI11 May 1, 2023
d72b41c
fix: correct static plotlib
ESCRI11 May 1, 2023
8d1b84f
feat: put card navigation on the header
ESCRI11 May 4, 2023
11c03ba
style: added style for in plot cards
ESCRI11 May 5, 2023
8fe76af
fix: merge nav inside of title
ESCRI11 May 5, 2023
6401ae4
style: proper height of heatmaps
ESCRI11 May 5, 2023
2d84f06
simplify PlotModuleServer
mauromiguelm May 5, 2023
77ed64a
fix: editor works for cards
ESCRI11 May 5, 2023
914bf3d
style: matching heights all around
ESCRI11 May 5, 2023
d9378ba
Merge branch 'dev-`PlotModule_cards`' of https://github.com/bigomics/…
mauromiguelm May 6, 2023
ce1a513
reduce size of tabs in card
mauromiguelm May 6, 2023
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
44 changes: 27 additions & 17 deletions components/board.clustering/R/clustering_plot_splitmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ clustering_plot_splitmap_ui <- function(
ns("pltmod"),
title = title,
label = label,
plotlib = "plotly",
plotlib = c("plotly", "base"),
info.text,
caption,
options = splitmap_opts,
download.fmt = c("png", "pdf", "csv"),
width = width,
height = height
height = height,
cards = TRUE,
card_names = c("Dynamic", "Static")
)
}

Expand Down Expand Up @@ -271,11 +273,11 @@ clustering_plot_splitmap_server <- function(id,
hm2_splitmap.RENDER <- function() {
## iHeatmap based splitted heatmap #########

dbg("[clustering_plot_splitmap.R] hm2_splitmap.RENDER called!")
dbg("[clustering_plot_splitmap.R] hm2_splitmap.RENDER called!")
shiny::req(pgx$genes)

dbg("[clustering_plot_splitmap.R] hm2_splitmap.RENDER : 1 ")

## -------------- variable to split samples
## scale = ifelse(input$hm_scale=="relative","row.center","none")
scale <- "none"
Expand All @@ -289,7 +291,7 @@ clustering_plot_splitmap_server <- function(id,
shiny::req(filt)

dbg("[clustering_plot_splitmap.R] hm2_splitmap.RENDER : 2 ")

## if(input$hm_group) {
X <- filt$mat
annot <- filt$annot
Expand All @@ -301,14 +303,14 @@ clustering_plot_splitmap_server <- function(id,

## iheatmapr needs factors for sharing between groups
annotF <- data.frame(as.list(annot), stringsAsFactors = TRUE)

rownames(annotF) <- rownames(annot)
if (length(selected_phenotypes()) == 0) {
annotF = NULL
} else {
annotF <- annotF[,selected_phenotypes(), drop=FALSE]
}

colcex <- as.numeric(input$hm_cexCol)
rowcex <- as.numeric(input$hm_cexRow)

Expand Down Expand Up @@ -342,19 +344,27 @@ clustering_plot_splitmap_server <- function(id,
plotly::layout(
margin = list(l=0,r=0,t=0,b=0)
)

return(plt)
}

PlotModuleServer(
"pltmod",
plotlib = "plotly",
func = hm2_splitmap.RENDER,
csvFunc = plot_data_hm1,
res = c(80, 95), ## resolution of plots
pdf.width = 10, pdf.height = 8,
add.watermark = watermark
)
plot_grid <- list(
list(plotlib = "plotly", func = hm2_splitmap.RENDER, card = 1),
list(plotlib = "base", func = hm1_splitmap.RENDER, card = 2)
)

lapply(plot_grid, function(x) {
PlotModuleServer(
"pltmod",
plotlib = x$plotlib,
func = x$func,
csvFunc = plot_data_hm1,
res = c(80, 95), # resolution of plots
pdf.width = 10, pdf.height = 8,
add.watermark = watermark,
card = x$card
)
})

return(list(
hm_ntop = shiny::reactive(input$hm_ntop),
Expand Down
26 changes: 14 additions & 12 deletions components/board.clustering/R/clustering_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ ClusteringInputs <- function(id) {
ClusteringUI <- function(id) {
ns <- shiny::NS(id) ## namespace

fullH <- 800 ## full height of page
rowH <- 350

fullH <- "80vh" ## full height of full page
rowH <- "40vh"
fullH = "calc(100vh - 183px)"

div(
class = "row",
Expand All @@ -104,14 +102,18 @@ ClusteringUI <- function(id) {
id = ns("tabs1"),
shiny::tabPanel(
"Heatmap",
clustering_plot_splitmap_ui(
id = ns("splitmap"),
label = "a",
title = "Clustered Heatmap",
caption = "Heatmap showing gene expression sorted by 2-way hierarchical clustering.",
info.text = "In the heatmap, red corresponds to overexpression, blue to underexpression of the gene. Gene clusters are also functionally annotated in the 'Annotate clusters' panel on the right. Hierarchical clustering can be performed on gene level or gene set level expression in which users have to specify it under the {Level} dropdown list. Under the plot settings, users can split the samples by a phenotype class (e.g., tissue, cell type, or gender) using the {split by} setting. In addition, users can specify the top N = (50, 150, 500) features to be used in the heatmap. The ordering of top features is selected under {top mode}. The criteria to select the top features are: SD - features with the highest standard deviation across all the samples,specific - features that are overexpressed in each phenotype class compared to the rest, or by PCA - by principal components. Users can also choose between 'relative' or 'absolute' expression scale. Under the {cexCol} and {cexRow} settings, it is also possible to adjust the cex for the column and row labels.",
height = c("calc(100vh - 183px)", TABLE_HEIGHT_MODAL),
width = "100%"
bslib::layout_column_wrap(
height = fullH,
width = 1,
clustering_plot_splitmap_ui(
id = ns("splitmap"),
label = "a",
title = "Clustered Heatmap",
caption = "Heatmap showing gene expression sorted by 2-way hierarchical clustering.",
info.text = "In the heatmap, red corresponds to overexpression, blue to underexpression of the gene. Gene clusters are also functionally annotated in the 'Annotate clusters' panel on the right. Hierarchical clustering can be performed on gene level or gene set level expression in which users have to specify it under the {Level} dropdown list. Under the plot settings, users can split the samples by a phenotype class (e.g., tissue, cell type, or gender) using the {split by} setting. In addition, users can specify the top N = (50, 150, 500) features to be used in the heatmap. The ordering of top features is selected under {top mode}. The criteria to select the top features are: SD - features with the highest standard deviation across all the samples,specific - features that are overexpressed in each phenotype class compared to the rest, or by PCA - by principal components. Users can also choose between 'relative' or 'absolute' expression scale. Under the {cexCol} and {cexRow} settings, it is also possible to adjust the cex for the column and row labels.",
height = c("calc(100vh - 270px)", TABLE_HEIGHT_MODAL),
width = "100%"
)
)
),
shiny::tabPanel(
Expand All @@ -122,7 +124,7 @@ ClusteringUI <- function(id) {
info.text = "The PCA/tSNE panel visualizes unsupervised clustering obtained by the principal components analysis ( PCA), t-distributed stochastic embedding ( tSNE) or the Uniform Manifold Approximation and Projection (UMAP) algorithms. This plot shows the relationship (or similarity) between the samples for visual analytics, where similarity is visualized as proximity of the points. Samples that are ‘similar’ will be placed close to each other. Users can select from three different clustering approaches (default=t-SNE).",
caption = "Clustering plot of the dataset samples.",
label = "",
height = c("calc(100vh - 183px)", TABLE_HEIGHT_MODAL),
height = c(fullH, TABLE_HEIGHT_MODAL),
width = c("auto", "100%"),
parent = ns
)
Expand Down
Loading