Skip to content

Commit 438d827

Browse files
committed
Merge branch 'alex_dev' of github.com:omnideconv/deconvExplorer into alex_dev
2 parents 432b72e + 836b6d9 commit 438d827

11 files changed

Lines changed: 77 additions & 45 deletions

DESCRIPTION

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Authors@R:
77
person(
88
given = "Constantin", family = "Zackl", role = c("aut", "cre"),
99
email = "zacklcon@uni-mainz.de", comment = c(ORCID = "0000-0003-1991-6943")
10+
),
11+
person(
12+
given = "Alexander", family = "Dietrich", role = c("aut"),
13+
email = "alex.dietrich@tum.de", comment = c(ORCID = "0000-0002-8661-0453")
14+
),
15+
person(
16+
given = "Lorenzo", family = "Merotto", role = c("aut"),
17+
email = "lorenzo.merotto@uibk.ac.at", comment = c(ORCID = "0009-0006-0637-8436")
1018
),
1119
person(
1220
given = "Federico", family = "Marini", role = c("aut"),

NAMESPACE

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export(returnSelectedDeconvolutions)
1818
export(selectGenesByScore)
1919
import(omnideconv)
2020
import(shiny, except = c(renderDataTable, dataTableOutput))
21-
import(shinyBS)
21+
importFrom(BioQC,entropySpecificity)
22+
importFrom(BioQC,gini)
2223
importFrom(ComplexHeatmap,Heatmap)
2324
importFrom(ComplexHeatmap,UpSet)
2425
importFrom(ComplexHeatmap,comb_size)
@@ -56,6 +57,7 @@ importFrom(ggplot2,geom_rect)
5657
importFrom(ggplot2,geom_text)
5758
importFrom(ggplot2,geom_tile)
5859
importFrom(ggplot2,ggplot)
60+
importFrom(ggplot2,ggsave)
5961
importFrom(ggplot2,guide_colorbar)
6062
importFrom(ggplot2,guides)
6163
importFrom(ggplot2,labs)
@@ -67,6 +69,8 @@ importFrom(ggplot2,theme_minimal)
6769
importFrom(ggplot2,ylim)
6870
importFrom(ggpubr,stat_cor)
6971
importFrom(grDevices,colorRampPalette)
72+
importFrom(grDevices,dev.off)
73+
importFrom(grDevices,pdf)
7074
importFrom(grid,gpar)
7175
importFrom(grid,unit)
7276
importFrom(plotly,config)
@@ -82,6 +86,7 @@ importFrom(rintrojs,readCallback)
8286
importFrom(rlang,.data)
8387
importFrom(shiny,addResourcePath)
8488
importFrom(shinyWidgets,actionBttn)
89+
importFrom(shinyBS,bsPopover)
8590
importFrom(shinycssloaders,withSpinner)
8691
importFrom(shinydashboard,box)
8792
importFrom(shinydashboard,dashboardBody)
@@ -100,7 +105,10 @@ importFrom(shinydashboard,valueBoxOutput)
100105
importFrom(shinyjs,hide)
101106
importFrom(shinyjs,show)
102107
importFrom(shinyjs,useShinyjs)
108+
importFrom(stats,complete.cases)
103109
importFrom(stats,cor.test)
110+
importFrom(stats,dist)
111+
importFrom(stats,hclust)
104112
importFrom(stats,sd)
105113
importFrom(stringr,str_split)
106114
importFrom(stringr,str_to_title)
@@ -109,3 +117,7 @@ importFrom(utils,read.delim)
109117
importFrom(utils,write.csv)
110118
importFrom(utils,write.table)
111119
importFrom(waiter,Waitress)
120+
importFrom(waiter,waiter_hide)
121+
importFrom(waiter,waiter_show)
122+
importFrom(waiter,waiter_show_on_load)
123+
importFrom(waiter,waiter_update)

R/DeconvExplorer-pkg.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,26 @@
1313
#' geom_tile ggplot guide_colorbar guides labs scale_fill_gradient theme geom_text element_blank
1414
#' geom_hline scale_colour_brewer scale_fill_brewer ylim theme_minimal geom_rect element_rect
1515
#' @importFrom shinycssloaders withSpinner
16-
#' @importFrom waiter Waitress
16+
#' @importFrom waiter Waitress waiter_hide waiter_show waiter_show_on_load
17+
#' waiter_update
1718
#' @importFrom rlang .data
1819
#' @importFrom rintrojs introBox introjs introjsUI readCallback
19-
#' @importFrom DT datatable dataTableOutput renderDataTable formatRound formatPercentage
20+
#' @importFrom DT datatable dataTableOutput renderDataTable formatRound
21+
#' formatPercentage
2022
#' @importFrom shinyjs useShinyjs hide show
2123
#' @importFrom utils write.csv write.table read.delim
2224
#' @importFrom stringr str_to_title str_split
2325
#' @importFrom tidyr pivot_longer
24-
#' @importFrom stats sd cor.test
25-
#' @importFrom ComplexHeatmap Heatmap make_comb_mat UpSet comb_size upset_top_annotation extract_comb
26+
#' @importFrom stats sd cor.test complete.cases dist hclust
27+
#' @importFrom ComplexHeatmap Heatmap make_comb_mat UpSet comb_size
28+
#' upset_top_annotation extract_comb
2629
#' @importFrom grid gpar unit
27-
#' @importFrom InteractiveComplexHeatmap InteractiveComplexHeatmapOutput makeInteractiveComplexHeatmap
30+
#' @importFrom InteractiveComplexHeatmap InteractiveComplexHeatmapOutput
31+
#' makeInteractiveComplexHeatmap
2832
#' @importFrom RColorBrewer brewer.pal
2933
#' @importFrom circlize colorRamp2
3034
#' @importFrom ggforce facet_grid_paginate
31-
#' @importFrom grDevices colorRampPalette
35+
#' @importFrom grDevices colorRampPalette dev.off pdf
3236
#' @importFrom ggpubr stat_cor
3337
#' @importFrom corrplot corrplot
3438
#' @importFrom SummarizedExperiment assays

R/DeconvExplorer.R

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
201201
column(
202202
width = 4,
203203
selectInput("deconvMethod", "Deconvolution Method",
204-
choices = c('MuSiC'='music', omnideconv::deconvolution_methods[-10])
204+
choices = c("MuSiC" = "music", omnideconv::deconvolution_methods[-10])
205205
)
206206
),
207207
column(
@@ -220,8 +220,10 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
220220
column(
221221
width = 3,
222222
div(
223-
shinyBS::popify(shinyWidgets::actionBttn("deconvolute", "Deconvolute", style = 'simple', icon = icon('triangle-exclamation'), color = 'warning'),
224-
"Attention", "Some methods are considerably slower than others; please keep this in mind when using DeconvExplorer for deconvolution."),
223+
shinyBS::popify(
224+
shinyWidgets::actionBttn("deconvolute", "Deconvolute", style = "simple", icon = icon("triangle-exclamation"), color = "warning"),
225+
"Attention", "Some methods are considerably slower than others; please keep this in mind when using DeconvExplorer for deconvolution."
226+
),
225227
style = "margin-top:1.7em"
226228
)
227229
),
@@ -234,7 +236,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
234236
title = "",
235237
content = "Select a deconvolution method to run. If required and supported by the deconvolution method you can additionally select a custom signature to be used in computation. Please note this is an advanced feature and should be used with caution. "
236238
)
237-
239+
238240

239241
deconv_plot_box <- shinydashboard::box(
240242
id = "tour_deconvPlot",
@@ -511,43 +513,45 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
511513
title = span("Clustered Signature", icon("question-circle", id = "sigHeatmapQ")),
512514
status = "info", solidHeader = TRUE,
513515
width = 12,
514-
fluidRow(
516+
fluidRow(
515517
column(
516518
width = 4,
517519
selectInput("signatureToHeatmap", "Select a Signature", choices = NULL)
518520
),
519521
column(
520522
width = 2,
521523
selectInput("signatureAnnotationScore", "Select an annotation score",
522-
choices = c("Entropy" = "entropy", "Gini Index" = "gini")
524+
choices = c("Entropy" = "entropy", "Gini Index" = "gini")
523525
)
524526
),
525527
column(
526528
width = 2,
527529
selectInput("signatureAnnotationPlotType", "Annotation Type",
528-
choices = c("Bars" = "bar", "Lines" = "line")
530+
choices = c("Bars" = "bar", "Lines" = "line")
529531
)
530532
),
531533
column(
532534
width = 2,
533535
selectInput("clusterCelltypes", "Order rows (cell types)",
534-
choices = c(".. by cell-type similarity" = "cluster", ".. alphabetically" = "no_cluster")
536+
choices = c(".. by cell-type similarity" = "cluster", ".. alphabetically" = "no_cluster")
535537
)
536538
),
537539
column(
538540
width = 2,
539541
selectInput("clusterGenes", "Order columns (genes)",
540-
choices = c(".. by maximal z-score per cell type" = "z-score cutoff",
541-
".. hierarchically based on euclidean distance" = "hierarchical clustering",
542-
".. alphabetically" = "alphabetical")
542+
choices = c(
543+
".. by maximal z-score per cell type" = "z-score cutoff",
544+
".. hierarchically based on euclidean distance" = "hierarchical clustering",
545+
".. alphabetically" = "alphabetical"
546+
)
543547
)
544548
)
545549
),
546550
fluidRow(
547551
column(
548552
width = 12,
549553
InteractiveComplexHeatmap::originalHeatmapOutput("clusteredHeatmapOneSignature",
550-
width = "1250px", height = "450px", containment = TRUE
554+
width = "1250px", height = "450px", containment = TRUE
551555
)
552556
)
553557
),
@@ -725,7 +729,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
725729
column(
726730
width = 7,
727731
sliderInput("refinePercentZero", "Maximum percentage of zeroes allowed for each gene",
728-
min = 0, max = 100, value = 90, step = 1, post = "%"
732+
min = 0, max = 100, value = 90, step = 1, post = "%"
729733
)
730734
),
731735
column(
@@ -759,6 +763,13 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
759763
)
760764
)
761765

766+
refUnspecificPopover <-
767+
shinyBS::bsPopover(
768+
id = "refUnspecificQ",
769+
title = "",
770+
content = "The overall expression is binned into 'high', 'medium' and 'low expression' for each gene. The number of cell types the gene has to be in the 'high' bin can be modified and defaults to 1. Each gene expressed 'high' in more cell types than this parameter is removed. "
771+
)
772+
762773
refinementBestNBox <- shinydashboard::box(
763774
solidHeader = FALSE, width = NULL, background = "red",
764775
fluidRow(
@@ -810,8 +821,8 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
810821
shinyBS::bsPopover(
811822
id = "refManuallyQ",
812823
title = "",
813-
content =
814-
)
824+
content =
825+
)
815826

816827
# Info Boxes --------------------------------------------------------------
817828
info_overview <- shinydashboard::box(
@@ -1654,7 +1665,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
16541665
scoring_method = input$signatureAnnotationScore,
16551666
annotation_type = input$signatureAnnotationPlotType,
16561667
color_palette = input$globalColor,
1657-
order_rows = input$clusterCelltypes,
1668+
order_rows = input$clusterCelltypes,
16581669
order_columns = input$clusterGenes
16591670
),
16601671
"clusteredHeatmapOneSignature",

R/Global.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ returnSelectedDeconvolutions <- function(deconv_select, deconv_list) {
2929

3030
#' Modal window to print error messages or other warnings
3131
#'
32-
#' @param error_message
32+
#' @param error_message Character string, with the content of the error to
33+
#' display
3334
#'
3435
#' @return NULL
3536
#' @export

R/SignatureExplorationPlots.R

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,22 +253,19 @@ plot_signatureClustered <- function(signature_mat,
253253
cell.types.ordered <- order(colnames(mat))
254254
}
255255

256-
if(order_columns == 'z-score cutoff'){
256+
if (order_columns == "z-score cutoff") {
257257
genes <- c()
258258
for (c in cell.types.ordered) {
259259
highly.expr.genes <- names(which(mat[, c] > threshold))
260260
genes <- union(genes, highly.expr.genes)
261261
}
262-
262+
263263
genes <- union(genes, rownames(mat))
264-
}else if(order_columns == 'hierarchical clustering'){
265-
264+
} else if (order_columns == "hierarchical clustering") {
266265
# use hierarchical ward D2 clustering based on euclidean distance
267-
clustering <- hclust(dist(mat), method = 'ward.D2')
266+
clustering <- hclust(dist(mat), method = "ward.D2")
268267
genes <- rownames(mat)[clustering$order]
269-
270-
}else if(order_columns == 'alphabetical'){
271-
268+
} else if (order_columns == "alphabetical") {
272269
genes <- sort(rownames(mat))
273270
}
274271

R/SignatureRefinements.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,26 @@ removeUnspecificGenes <- function(signature_mat,
116116

117117
signature_mat <- as.matrix(signature_mat)
118118

119-
to_keep <- sapply(1:nrow(signature_mat), function(i){
119+
to_keep <- sapply(1:nrow(signature_mat), function(i) {
120120
row <- signature_mat[i, ] # has colnames! drop FALSE is mandatory !!!!!
121-
121+
122122
# calculate bins to prevent error
123123
breaks <- seq(floor(min(row)), ceiling(max(row)), length.out = number_of_bins + 1)
124-
124+
125125
# cut into bins, seperate for each gene
126126
bins <- cut(row, breaks = breaks, labels = labels, include.lowest = TRUE)
127-
127+
128128
nHighBins <- sum(bins == "high") # not working when labels is something else
129-
129+
130130
# this value needs to be greater than one, depending of the step in the pipeline there arent
131131
# any rows producing zeros left but that is not the case for all signatures
132132
if (nHighBins <= max_count & nHighBins > 0) {
133133
return(TRUE)
134-
}else{
134+
} else {
135135
return(FALSE)
136136
}
137137
})
138-
138+
139139

140140
refinedSignature <- signature_mat[to_keep, ]
141141

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
.onLoad <- function(libname, pkgname) {
44
shiny::addResourcePath("sbs", system.file("www", package = "shinyBS"))
5-
}
5+
}

man/DeconvExplorer-pkg.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/errorModal.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)