Skip to content

Commit 4b5a186

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 398e41f commit 4b5a186

3 files changed

Lines changed: 33 additions & 33 deletions

File tree

R/DeconvExplorer.R

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
127127
width = 12,
128128
fileInput("userSignatureUpload", "Upload Signature"),
129129
div(style = "margin-top: -25px"),
130-
131130
p("You can upload a previsouly generated signature matrix of a deconvolution method and analyse it with DeconvExplorer. Multiple uploads are possible."),
132131
fluidRow(
133132
column(4, shinyWidgets::actionBttn("selectSigExploration", "Explore the signature", icon = icon("arrow-right"), color = "success", style = "simple")),
@@ -202,7 +201,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
202201
column(
203202
width = 4,
204203
selectInput("deconvMethod", "Deconvolution Method",
205-
choices = c('MuSiC'='music', omnideconv::deconvolution_methods[-10])
204+
choices = c("MuSiC" = "music", omnideconv::deconvolution_methods[-10])
206205
)
207206
),
208207
column(
@@ -221,8 +220,10 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
221220
column(
222221
width = 3,
223222
div(
224-
shinyBS::popify(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."),
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+
),
226227
style = "margin-top:1.7em"
227228
)
228229
),
@@ -235,7 +236,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
235236
title = "",
236237
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. "
237238
)
238-
239+
239240

240241
deconv_plot_box <- shinydashboard::box(
241242
id = "tour_deconvPlot",
@@ -512,43 +513,45 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
512513
title = span("Clustered Signature", icon("question-circle", id = "sigHeatmapQ")),
513514
status = "info", solidHeader = TRUE,
514515
width = 12,
515-
fluidRow(
516+
fluidRow(
516517
column(
517518
width = 4,
518519
selectInput("signatureToHeatmap", "Select a Signature", choices = NULL)
519520
),
520521
column(
521522
width = 2,
522523
selectInput("signatureAnnotationScore", "Select an annotation score",
523-
choices = c("Entropy" = "entropy", "Gini Index" = "gini")
524+
choices = c("Entropy" = "entropy", "Gini Index" = "gini")
524525
)
525526
),
526527
column(
527528
width = 2,
528529
selectInput("signatureAnnotationPlotType", "Annotation Type",
529-
choices = c("Bars" = "bar", "Lines" = "line")
530+
choices = c("Bars" = "bar", "Lines" = "line")
530531
)
531532
),
532533
column(
533534
width = 2,
534535
selectInput("clusterCelltypes", "Order rows (cell types)",
535-
choices = c(".. by cell-type similarity" = "cluster", ".. alphabetically" = "no_cluster")
536+
choices = c(".. by cell-type similarity" = "cluster", ".. alphabetically" = "no_cluster")
536537
)
537538
),
538539
column(
539540
width = 2,
540541
selectInput("clusterGenes", "Order columns (genes)",
541-
choices = c(".. by maximal z-score per cell type" = "z-score cutoff",
542-
".. hierarchically based on euclidean distance" = "hierarchical clustering",
543-
".. 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+
)
544547
)
545548
)
546549
),
547550
fluidRow(
548551
column(
549552
width = 12,
550553
InteractiveComplexHeatmap::originalHeatmapOutput("clusteredHeatmapOneSignature",
551-
width = "1250px", height = "450px", containment = TRUE
554+
width = "1250px", height = "450px", containment = TRUE
552555
)
553556
)
554557
),
@@ -726,7 +729,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
726729
column(
727730
width = 7,
728731
sliderInput("refinePercentZero", "Maximum percentage of zeroes allowed for each gene",
729-
min = 0, max = 100, value = 90, step = 1, post = "%"
732+
min = 0, max = 100, value = 90, step = 1, post = "%"
730733
)
731734
),
732735
column(
@@ -760,7 +763,7 @@ DeconvExplorer <- function(deconvexp_bulk = NULL,
760763
)
761764
)
762765

763-
refUnspecificPopover <-
766+
refUnspecificPopover <-
764767
shinyBS::bsPopover(
765768
id = "refUnspecificQ",
766769
title = "",
@@ -818,8 +821,8 @@ refUnspecificPopover <-
818821
shinyBS::bsPopover(
819822
id = "refManuallyQ",
820823
title = "",
821-
content =
822-
)
824+
content =
825+
)
823826

824827
# Info Boxes --------------------------------------------------------------
825828
info_overview <- shinydashboard::box(
@@ -1662,7 +1665,7 @@ refUnspecificPopover <-
16621665
scoring_method = input$signatureAnnotationScore,
16631666
annotation_type = input$signatureAnnotationPlotType,
16641667
color_palette = input$globalColor,
1665-
order_rows = input$clusterCelltypes,
1668+
order_rows = input$clusterCelltypes,
16661669
order_columns = input$clusterGenes
16671670
),
16681671
"clusteredHeatmapOneSignature",

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

0 commit comments

Comments
 (0)