Skip to content
This repository has been archived by the owner. It is now read-only.

Clarion object #21

Merged
merged 80 commits into from Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d0cb7f0
R6 import added
HendrikSchultheis May 4, 2018
b259f97
implemented Clarion class
HendrikSchultheis May 4, 2018
693dcd4
parser: return clarion object
HendrikSchultheis May 7, 2018
4158652
parser: no header = NULL (not empty named list)
HendrikSchultheis May 7, 2018
beb67a2
clarion: added is_delimited function
HendrikSchultheis May 7, 2018
8849cd7
parser: updated documentation
HendrikSchultheis May 7, 2018
70bfa60
featureSelector: use clarion object
HendrikSchultheis May 7, 2018
9d164fb
clarion: get_factors function added
HendrikSchultheis May 8, 2018
d54d9ad
geneView: integrated clarion object; choose grouping factor
HendrikSchultheis May 8, 2018
0331d8b
geneview: fixed wrong if
HendrikSchultheis May 9, 2018
a72e328
geneview_example: added factors
HendrikSchultheis May 9, 2018
7fd4753
columnSelector: fixed sub_label used as label if no label provided
HendrikSchultheis May 9, 2018
b5ab180
global_cor_heatmap: use clarion object
HendrikSchultheis May 9, 2018
776aeb9
heatmap: use clarion object
HendrikSchultheis May 9, 2018
d7ef909
pca: use clarion object
HendrikSchultheis May 14, 2018
9e82e82
marker: use clarion object
HendrikSchultheis May 14, 2018
fec6cd5
marker_example: added missing source
HendrikSchultheis May 15, 2018
70a17c3
marker: return list of reactives for better performance
HendrikSchultheis May 15, 2018
af8d392
scatterplot: use clarion object
HendrikSchultheis May 16, 2018
d4b5240
clarion: also coerce name to character
HendrikSchultheis May 16, 2018
80deb83
scatterplot: add names to hovertext
HendrikSchultheis May 17, 2018
95eb6eb
pca: color and shape based grouping enabled
HendrikSchultheis May 22, 2018
0e12c11
added missing session$ns() to notifications
HendrikSchultheis May 24, 2018
352c47b
Merge branch 'master' into oo_clarion
HendrikSchultheis May 29, 2018
0cb954d
param grouping deprecated
HendrikSchultheis May 29, 2018
50cf78d
Merge branch 'master' into oo_clarion
HendrikSchultheis Jun 4, 2018
3252479
clarion: accept factor names e.g. factor1="name"
HendrikSchultheis Jun 4, 2018
7faf263
geneview, pca: updated to use factor names
HendrikSchultheis Jun 4, 2018
7b92867
Merge branch 'master' into oo_clarion
HendrikSchultheis Jun 18, 2018
ca2b1be
closeButton for all notifications
HendrikSchultheis Jun 18, 2018
5dcf4e2
added function docu
HendrikSchultheis Jun 18, 2018
e74a29d
clarion: enhanced docu; fixed examples
HendrikSchultheis Jun 18, 2018
f401503
satisfy R cmd check by using SE approaches for ggplot related variabl…
HendrikSchultheis Jun 19, 2018
65d57a7
satisfy R cmd check by using SE approaches for ggplot related variabl…
HendrikSchultheis Jun 19, 2018
b0ac2d3
Merge branch 'oo_clarion' of https://github.molgen.mpg.de/HendrikSchu…
HendrikSchultheis Jun 19, 2018
81f0d26
geneview: violin plot warning
HendrikSchultheis Jun 20, 2018
d97b0de
replaced colorPicker with colorPicker2
HendrikSchultheis Jun 20, 2018
1caf9e8
bump package version to v2.0.0
HendrikSchultheis Jun 20, 2018
b73286c
clarion$is_delimited: fixed wrong return
HendrikSchultheis Jun 21, 2018
0eb9c60
featureSelector: updated docu
HendrikSchultheis Jun 21, 2018
7f26cc4
geneView: changed guide
HendrikSchultheis Jun 21, 2018
ce951d3
featureSelector: fixed filter crash on data column not defined in met…
HendrikSchultheis Jun 21, 2018
7db391a
clarion: omit not defined columns from data
HendrikSchultheis Jun 21, 2018
67bb182
fixed notes (win-builder): package name in title, software not in '',…
HendrikSchultheis Jun 25, 2018
915080a
fixed spelling errors
HendrikSchultheis Jun 25, 2018
b84be79
Merge branch 'master' into oo_clarion
HendrikSchultheis Jun 27, 2018
84f492e
removed shinybs
HendrikSchultheis Jun 27, 2018
7422194
add reverse dependency checks
HendrikSchultheis Jun 27, 2018
53ab467
lint and
HendrikSchultheis Jun 28, 2018
2524e04
lint clarion
HendrikSchultheis Jun 28, 2018
1c3ca98
lint colorPicker
HendrikSchultheis Jun 28, 2018
9656bbd
lint columnSelector + example
HendrikSchultheis Jun 28, 2018
b8334d5
lint clarion
HendrikSchultheis Jun 28, 2018
4de0a38
lint featureSelector
HendrikSchultheis Jun 28, 2018
7557b04
featureSelector: fixed wrong download var
HendrikSchultheis Jun 28, 2018
4c64391
lint function
HendrikSchultheis Jun 28, 2018
8d6cb76
lint geneView
HendrikSchultheis Jun 28, 2018
bd79fb8
lint global
HendrikSchultheis Jun 28, 2018
0adf557
lint geneView
HendrikSchultheis Jun 28, 2018
f0abc10
lint global_cor_heatmap
HendrikSchultheis Jun 28, 2018
e662c44
lint heatmap
HendrikSchultheis Jun 28, 2018
9e5be22
lint heatmap
HendrikSchultheis Jun 28, 2018
9472f23
lint label
HendrikSchultheis Jun 28, 2018
23900e9
lint limit
HendrikSchultheis Jun 28, 2018
709e387
lint marker + example
HendrikSchultheis Jun 28, 2018
4ac08ad
lint orNumeric + example
HendrikSchultheis Jun 28, 2018
7c6547f
lint orTextual + example
HendrikSchultheis Jun 28, 2018
527e928
lint orNumeric
HendrikSchultheis Jun 28, 2018
a5468a1
lint parser
HendrikSchultheis Jun 28, 2018
45d0808
lint pca
HendrikSchultheis Jun 28, 2018
b6e4302
lint scatterPlot + example
HendrikSchultheis Jun 28, 2018
f938bad
lint transformation
HendrikSchultheis Jun 28, 2018
8d41dfd
download: restore wd on exit
HendrikSchultheis Jun 28, 2018
63f5ed9
and, featureSelector, function: use less error prone seq_len() instea…
HendrikSchultheis Jun 28, 2018
117e0c4
T -> TRUE; F -> FALSE
HendrikSchultheis Jun 28, 2018
45de92b
deleted unused imports
HendrikSchultheis Jun 28, 2018
ad9573a
replaced sapply with type safe v- /lapply
HendrikSchultheis Jun 29, 2018
670b26f
columnSelector: fixed typo
HendrikSchultheis Jun 29, 2018
5828ee9
update revdep_check
HendrikSchultheis Jun 29, 2018
f35ee0a
DESCRIPTION: changed title to title case
HendrikSchultheis Jun 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
@@ -1,3 +1,4 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.buildkite.*
^revdep$
1 change: 0 additions & 1 deletion .buildkite/wilson-env.yml
Expand Up @@ -43,4 +43,3 @@ dependencies:
- r-devtools
- "readline==6.3"
- r-roxygen2
- r-shinybs
14 changes: 6 additions & 8 deletions DESCRIPTION
@@ -1,13 +1,13 @@
Package: wilson
Type: Package
Title: WIlsON Webbased Interactive Omics visualizatioN
Version: 1.0.0
Title: Web-Based Interactive Omics Visualization
Version: 2.0.0
Authors@R: c(
person("Hendrik", "Schultheis", email = "hendrik.schultheis@mpi-bn.mpg.de", role = c("aut", "cre")),
person("Jens", "Preussner", email = "jens.preussner@mpi-bn.mpg.de", role = "aut"),
person("Looso", "Mario", email = "mario.looso@mpi-bn.mpg.de", role = "aut"))
Description: This package provides modules for webbased tools that use plot based strategies to visualize and analyze multi-omics data.
WIlsON utilizes the Rshiny and Plotly frameworks to provide a user friendly dashboard for interactive plotting.
Description: This package provides modules for web-based tools that use plot based strategies to visualize and analyze multi-omics data.
'wilson' utilizes the 'shiny' and 'plotly' frameworks to provide a user friendly dashboard for interactive plotting.
URL: https://github.molgen.mpg.de/loosolab/wilson
BugReports: https://github.molgen.mpg.de/loosolab/wilson/issues
License: MIT + file LICENSE
Expand All @@ -34,19 +34,17 @@ Imports: shiny,
gplots,
reshape,
rintrojs,
webshot,
RJSONIO,
ggrepel (>= 0.6.12),
DESeq2,
rjson,
FactoMineR,
factoextra,
heatmaply (>= 0.14.1),
shinyBS,
shinythemes,
shinycssloaders,
log4r,
openssl,
methods
methods,
R6
RoxygenNote: 6.0.1
biocViews:
3 changes: 1 addition & 2 deletions NAMESPACE
@@ -1,10 +1,9 @@
# Generated by roxygen2: do not edit by hand

export(Clarion)
export(and)
export(andUI)
export(colorPicker)
export(colorPicker2)
export(colorPicker2UI)
export(colorPickerUI)
export(columnSelector)
export(columnSelectorUI)
Expand Down
136 changes: 66 additions & 70 deletions R/and.R
Expand Up @@ -38,78 +38,78 @@ andUI <- function(id) {
#' @export
and <- function(input, output, session, data, show.elements = NULL, element.grouping = NULL, column.labels = NULL, delimiter = NULL, multiple = TRUE, contains = FALSE, ranged = FALSE, step = 100, reset = NULL) {
# handle reactive data
data.r <- shiny::reactive({
if(shiny::is.reactive(data)){
data_r <- shiny::reactive({
if (shiny::is.reactive(data)) {
data()
}else{
data
}
})

# handle reactive show.elements
show.elements.r <- shiny::reactive({
if(shiny::is.reactive(show.elements)) {
show_elements_r <- shiny::reactive({
if (shiny::is.reactive(show.elements)) {
show.elements <- show.elements()
} else {
show.elements <- show.elements
}
if(is.null(show.elements)) {
show.elements <- names(data.r())
if (is.null(show.elements)) {
show.elements <- names(data_r())
}

return(show.elements)
})

# handle reactive grouping
element.grouping.r <- shiny::reactive({
if(shiny::is.reactive(element.grouping)){
element_grouping_r <- shiny::reactive({
if (shiny::is.reactive(element.grouping)) {
element.grouping()
}else{
} else {
element.grouping
}
})

parameter <- shiny::reactive({
# get column labels
if(is.null(column.labels)){
column.labels <- names(data.r())
}else{
if (is.null(column.labels)) {
column.labels <- names(data_r())
} else {
column.labels <- column.labels
}
# fill multiple if vector is too small
if(shiny::is.reactive(multiple)) {
if (shiny::is.reactive(multiple)) {
multiple <- multiple()
}
if (length(multiple) < ncol(data.r())) {
multiple <- rep(multiple, length.out = ncol(data.r()))
if (length(multiple) < ncol(data_r())) {
multiple <- rep(multiple, length.out = ncol(data_r()))
}
# fill contains if vector is too small
if(shiny::is.reactive(contains)) {
if (shiny::is.reactive(contains)) {
contains <- contains()
}
if (length(contains) < ncol(data.r())) {
contains <- rep(contains, length.out = ncol(data.r()))
if (length(contains) < ncol(data_r())) {
contains <- rep(contains, length.out = ncol(data_r()))
}
# fill ranged if vector is too small
if(shiny::is.reactive(ranged)) {
if (shiny::is.reactive(ranged)) {
ranged <- ranged()
}
if (length(ranged) < ncol(data.r())) {
ranged <- rep(ranged, length.out = ncol(data.r()))
if (length(ranged) < ncol(data_r())) {
ranged <- rep(ranged, length.out = ncol(data_r()))
}
# fill delimiter if vector is too small
if(shiny::is.reactive(delimiter)) {
if (shiny::is.reactive(delimiter)) {
delimiter <- delimiter()
}
if (length(delimiter) < ncol(data.r()) & !is.null(delimiter)) {
delimiter <- rep(delimiter, length.out = ncol(data.r()))
if (length(delimiter) < ncol(data_r()) & !is.null(delimiter)) {
delimiter <- rep(delimiter, length.out = ncol(data_r()))
}
# fill step if vector is too small
if(shiny::is.reactive(step)) {
if (shiny::is.reactive(step)) {
step <- step()
}
if (length(step) < ncol(data.r()) & !is.null(step)) {
step <- rep(step, length.out = ncol(data.r()))
if (length(step) < ncol(data_r()) & !is.null(step)) {
step <- rep(step, length.out = ncol(data_r()))
}

return(list(column.labels = column.labels, multiple = multiple, contains = contains, ranged = ranged, delimiter = delimiter, step = step))
Expand All @@ -122,35 +122,35 @@ and <- function(input, output, session, data, show.elements = NULL, element.grou
progress$set(0, message = "Render orModules:")

# select data based on show.elements
data <- data.r()[, show.elements.r(), with = FALSE]
data <- data_r()[, show_elements_r(), with = FALSE]

step <- ncol(data)

if(!is.null(element.grouping.r())){
if (!is.null(element_grouping_r())) {
# only group shown data
element.grouping <- element.grouping.r()[element.grouping.r()[[1]] %in% show.elements.r()]
element.grouping <- element_grouping_r()[element_grouping_r()[[1]] %in% show_elements_r()]

grouping <- tapply(element.grouping[[1]], element.grouping[[2]], function(x){x})
grouping <- tapply(element.grouping[[1]], element.grouping[[2]], function(x) {x})
# keep grouping order
grouping <- grouping[unique(element.grouping[[2]])]

return <- lapply(1:length(grouping), function(i){
return <- lapply(seq_len(length(grouping)), function(i){
group <- lapply(unlist(grouping[i]), function(x){
progress$inc(step, detail = x)

if(is.numeric(data[[x]])){
if (is.numeric(data[[x]])) {
ui <- orNumericUI(id = session$ns(openssl::sha1(x)))
}else{
} else {
ui <- orTextualUI(id = session$ns(openssl::sha1(x)))
}

if(length(ui) < 4){ # orTextual
if (length(ui) < 4) { # orTextual
shiny::tagList(shiny::fluidRow(
shiny::column(width = 4, ui[1]),
shiny::column(width = 3, ui[2]),
shiny::column(width = 1, offset = 4, ui[3])
))
}else{ # orNumeric
} else { # orNumeric
shiny::tagList(shiny::fluidRow(
shiny::column(width = 4, ui[1]),
shiny::column(width = 1, ui[2]),
Expand All @@ -163,23 +163,23 @@ and <- function(input, output, session, data, show.elements = NULL, element.grou

shiny::tagList(shinydashboard::box(width = 12, collapsible = TRUE, collapsed = TRUE, title = names(grouping[i]), shiny::tagList(group)))
})
}else{
return <- lapply(1:ncol(data), function(x) {
} else {
return <- lapply(seq_len(ncol(data)), function(x) {
progress$inc(step, detail = names(data)[x])
if (is.numeric(data[[x]])) {
ui <- orNumericUI(id = session$ns(openssl::sha1(names(data)[x])))

} else{
} else {
ui <- orTextualUI(id = session$ns(openssl::sha1(names(data)[x])))
}

if(length(ui) < 4){ # orTextual
if (length(ui) < 4) { # orTextual
shiny::tagList(shiny::fluidRow(
shiny::column(width = 4, ui[1]),
shiny::column(width = 3, ui[2]),
shiny::column(width = 1, offset = 4, ui[3])
))
}else{ # orNumeric
} else { # orNumeric
shiny::tagList(shiny::fluidRow(
shiny::column(width = 4, ui[1]),
shiny::column(width = 1, ui[2]),
Expand All @@ -203,41 +203,41 @@ and <- function(input, output, session, data, show.elements = NULL, element.grou
progress <- shiny::Progress$new()
on.exit(progress$close())
progress$set(0, message = "Filtering Module:")
step <- ncol(data.r())
step <- ncol(data_r())

lapply(1:ncol(data.r()), function(x) {
progress$inc(step, detail = names(data.r())[x])
if (is.numeric(data.r()[[x]])) {
lapply(seq_len(ncol(data_r())), function(x) {
progress$inc(step, detail = names(data_r())[x])
if (is.numeric(data_r()[[x]])) {
if (parameter()$ranged[x]) {
shiny::callModule(
module = orNumeric,
id = openssl::sha1(names(data.r())[x]),
choices = data.r()[[x]],
value = c(floor(min(data.r()[[x]], na.rm = TRUE)), ceiling(max(data.r()[[x]], na.rm = TRUE))),
id = openssl::sha1(names(data_r())[x]),
choices = data_r()[[x]],
value = c(floor(min(data_r()[[x]], na.rm = TRUE)), ceiling(max(data_r()[[x]], na.rm = TRUE))),
label = parameter()$column.labels[x],
step = parameter()$step[x],
min. = floor(min(data.r()[[x]], na.rm = TRUE)),
max. = ceiling(max(data.r()[[x]], na.rm = TRUE)),
min. = floor(min(data_r()[[x]], na.rm = TRUE)),
max. = ceiling(max(data_r()[[x]], na.rm = TRUE)),
reset = reset
)
} else{
shiny::callModule(
module = orNumeric,
id = openssl::sha1(names(data.r())[x]),
choices = data.r()[[x]],
value = mean(data.r()[[x]], na.rm = TRUE),
id = openssl::sha1(names(data_r())[x]),
choices = data_r()[[x]],
value = mean(data_r()[[x]], na.rm = TRUE),
label = parameter()$column.labels[x],
step = parameter()$step[x],
min. = floor(min(data.r()[[x]], na.rm = TRUE)),
max. = ceiling(max(data.r()[[x]], na.rm = TRUE)),
min. = floor(min(data_r()[[x]], na.rm = TRUE)),
max. = ceiling(max(data_r()[[x]], na.rm = TRUE)),
reset = reset
)
}
} else{
shiny::callModule(
module = orTextual,
id = openssl::sha1(names(data.r())[x]),
choices = as.character(data.r()[[x]]),
id = openssl::sha1(names(data_r())[x]),
choices = as.character(data_r()[[x]]),
label = parameter()$column.labels[x],
delimiter = parameter()$delimiter[x],
multiple = parameter()$multiple[x],
Expand All @@ -256,35 +256,31 @@ and <- function(input, output, session, data, show.elements = NULL, element.grou

log_message(message = "Applying filter...", level = "INFO", token = session$token)

or.modules <- modules()
or_modules <- modules()

step <- 0.9 / length(or.modules)
step <- 0.9 / length(or_modules)
# OR modules selection
or.selection.bool <- sapply(or.modules, function(x) {
or_selection_bool <- vapply(or_modules, FUN.VALUE = logical(nrow(data_r())), FUN = function(x) {
progress$inc(step, detail = x()$label)
x()$bool
})
or.selection.text <- sapply(or.modules, function(x) {
if(shiny::isTruthy(x()$text)){

or_selection_text <- lapply(or_modules, function(x) {
if (shiny::isTruthy(x()$text)) {
return(paste0(x()$label, ": ", paste(x()$text, collapse = ","), collapse = ""))
}
})

# cast to matrix if sapply returns vector
if(is.vector(or.selection.bool)){
or.selection.bool <- t(as.matrix(or.selection.bool))
}

# selected rows (and selection)
and.selection.bool <- apply(or.selection.bool, 1, all)
and_selection_bool <- apply(or_selection_bool, 1, all)

or.selection.text <- unlist(or.selection.text)
or_selection_text <- unlist(or_selection_text)

progress$set(1)

log_message(message = "Done.", level = "INFO", token = session$token)

return(list(bool = and.selection.bool, text = unlist(or.selection.text)))
return(list(bool = and_selection_bool, text = unlist(or_selection_text)))
})

return(selection)
Expand Down