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

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge commits from master
  • Loading branch information
jenzopr authored and bioi committed Jul 19, 2018
2 parents 294cb51 + 330ab19 commit da262e7
Show file tree
Hide file tree
Showing 37 changed files with 42,293 additions and 81 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Expand Up @@ -2,3 +2,4 @@
^\.Rproj\.user$
^\.buildkite.*
^revdep$
^cran-comments.md$
17 changes: 11 additions & 6 deletions DESCRIPTION
@@ -1,15 +1,15 @@
Package: wilson
Type: Package
Title: Web-Based Interactive Omics Visualization
Version: 2.0.0
Version: 2.0.1
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 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
Description: Tool-set of modules for creating web-based applications that use plot based strategies to visualize and analyze multi-omics data.
This package 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
Encoding: UTF-8
LazyData: true
Expand Down Expand Up @@ -47,4 +47,9 @@ Imports: shiny,
methods,
R6
RoxygenNote: 6.0.1
biocViews:
biocViews:
Suggests: knitr,
rmarkdown,
testthat,
vdiffr
VignetteBuilder: knitr
25 changes: 25 additions & 0 deletions NEWS.md
@@ -0,0 +1,25 @@
# wilson 2.0.1
- tests added
# wilson 2.0.0
## Features
- clarion class:
- easier data-format validation by providing several checks
- simplified module usage (only forward clarion object) for top-level modules (e.g. filter & plot)
- provide functions for frequent tasks (e.g. get_name, is_delimited, etc.)

- geneView:
- group columns by one or more factors

- pca:
- color & shape grouping by selected factor(s)

- scatterPlot:
- add name to hovertext if available (only interactive)

## Misc
- improved notifications (closable, more)
- overall code quality improvements via usage of packages goodpractice and lintr
- removed deprecated colorPicker

# wilson 1.0.0
first public release
30 changes: 17 additions & 13 deletions R/function.R
Expand Up @@ -125,7 +125,7 @@ create_scatterplot <- function(data, data.labels = NULL, data.hovertext = NULL,
if (density) {
### kernel density
# plot$layers <- c(stat_density2d(geom = "tile", aes(fill = ..density..^0.25), n=200, contour=FALSE) + aes_(fill = as.name(var)), plot$layers) # n = resolution; density less sparse
plot <- plot + ggplot2::stat_density2d(geom = "tile", ggplot2::aes_(fill = ~ ..density.. ^ 0.25), n = 200, contour = FALSE)
plot <- plot + ggplot2::stat_density2d(geom = "tile", ggplot2::aes_(fill = ~ ..density.. ^ 0.25, color = NULL), n = 200, contour = FALSE)

plot <- plot + ggplot2::scale_fill_gradient(low = "white", high = "black") +
# guides(fill=FALSE) + # remove density legend
Expand Down Expand Up @@ -1152,7 +1152,7 @@ searchData <- function(input, choices, options = c("=", "<", ">"), min. = min(ch
}

# range
if ("inner" == options){
if ("inner" == options) {
if (x >= input[1] & x <= input[2]) return(TRUE)
}
if ("outer" == options) {
Expand Down Expand Up @@ -1203,15 +1203,17 @@ searchData <- function(input, choices, options = c("=", "<", ">"), min. = min(ch
download <- function(file, filename, plot, width, height, ppi = 72, save_plot = TRUE, ui = NULL) {
session <- shiny::getDefaultReactiveDomain()

# show notification
shiny::showNotification(
id = session$ns("download-note"),
shiny::tags$b("Preparing download files. Please wait..."),
duration = NULL,
closeButton = FALSE,
type = "message"
)
shinyjs::runjs(paste0("$(document.getElementById('", paste0("shiny-notification-", session$ns("download-note")), "')).addClass('notification-position-center');"))
if (!is.null(session)) {
# show notification
shiny::showNotification(
id = session$ns("download-note"),
shiny::tags$b("Preparing download files. Please wait..."),
duration = NULL,
closeButton = FALSE,
type = "message"
)
shinyjs::runjs(paste0("$(document.getElementById('", paste0("shiny-notification-", session$ns("download-note")), "')).addClass('notification-position-center');"))
}

# cut off file extension
name <- sub("(.*)\\..*$", replacement = "\\1", filename)
Expand Down Expand Up @@ -1283,8 +1285,10 @@ download <- function(file, filename, plot, width, height, ppi = 72, save_plot =
# remove tmp files
file.remove(files)

# remove notification
shiny::removeNotification(session$ns("download-note"))
if (!is.null(session)) {
# remove notification
shiny::removeNotification(session$ns("download-note"))
}

return(out)
}
Expand Down
4 changes: 3 additions & 1 deletion R/global.R
Expand Up @@ -11,8 +11,10 @@ wilson.globals <- new.env(parent = emptyenv())
#'
#' @export
set_logger <- function(logger, token = NULL) {
if (is.null(logger) || methods::is(logger, "logger")) {
if (methods::is(logger, "logger")) {
assign(x = paste0("logger", token), value = logger, envir = wilson.globals)
} else if (is.null(logger)) {
rm(list = paste0("logger", token), envir = wilson.globals)
}
}

Expand Down
28 changes: 23 additions & 5 deletions R/parser.R
Expand Up @@ -25,6 +25,8 @@
#' @param version pre-header information about version (optional)
#' @param experiment_id pre-header information about experiment id (optional)
#'
#' @return TRUE on success
#'
#' @export
parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduced, config = system.file("extdata", "parser_MaxQuant_config.json", package = "wilson"), delimiter = ";", format = NULL, version = NULL, experiment_id = NULL){
if (missing(proteinGroups_in)) {
Expand Down Expand Up @@ -85,7 +87,7 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
# @return String level of given column
get_sample_level <- function(col_head, isSample, full_list) {
# Get the level of all 'sample' columns.
# Default: level <- "sample"
# Default: level is "sample"
if (grepl("Ratio", col_head, perl = TRUE)) {
if (grepl("type", col_head, perl = TRUE)) return("feature")
return("contrast")
Expand Down Expand Up @@ -165,7 +167,7 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
# @param version version number
# @param exp_id experiment id
# @param pGroups data table protein groups file
write_clarion_file <- function(meta, out, format, version, exp_id, pGroups, delimiter){
write_clarion_file <- function(meta, out, format, version, exp_id, pGroups, delimiter) {
to_append <- FALSE
if (!missing(format)) {
write(paste0("!format=", format), file = out, append = to_append)
Expand All @@ -188,10 +190,21 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
# reading files in data tables
proteinGroups <- data.table::fread(proteinGroups_in, header = TRUE, quote = "")
summary_file <- data.table::fread(summary_in, header = TRUE)
meta_config <- rjson::fromJSON(file = config)

meta_config <- tryCatch({
rjson::fromJSON(file = config)
}, error = function(cond) {
stop("Could not read config file")
}, warning = function(w) {
stop("Could not read config file")
})

# getting experiment names
exp_names <- (unique(summary_file[Experiment != "", Experiment]))
if ("Experiment" %in% colnames(summary_file)) {
exp_names <- unique(summary_file[Experiment != "", Experiment])
} else {
stop("wrong format on summary file: column \'Experiment\' misssing")
}

meta <- get_meta_from_config(meta_config = meta_config)

Expand All @@ -203,6 +216,9 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
sample_ary <- meta_config$type_array
reduced_list <- meta_config$reduced_list
full_sample_list <- c(sample_scores, sample_ratios, sample_probability, sample_category, sample_ary)
if (is.null(reduced_list)) {
stop("reduced_list is missing in config file")
}

# get column names
col_names <- colnames(proteinGroups)
Expand All @@ -214,7 +230,7 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
# append rows to data table with metadata
samples_list <- lapply(col_names, function(col_head) {

unlist(lapply(exp_names, function(name){
unlist(lapply(exp_names, function(name) {
name_brackets <- paste0("\\Q", name)
exp_regex <- paste0("\\Q ", name)
sample_description <- strsplit(col_head, exp_regex)
Expand Down Expand Up @@ -286,6 +302,8 @@ parse_MaxQuant <- function(proteinGroups_in, summary_in, outfile, outfile_reduce
# writing reduced CLARION file
write_clarion_file(meta = meta_reduced, out = outfile_reduced, format = format,
version = version, exp_id = experiment_id, pGroups = proteinGroups, delimiter = delimiter)

return(TRUE)
}

#' Method to parse input file.
Expand Down
8 changes: 8 additions & 0 deletions R/release_questions.R
@@ -0,0 +1,8 @@
#' Defines additional questions asked before CRAN submission.
#' DO NOT EXPORT!
release_questions <- function() {
c(
"Re-run reverse dependencies?",
"Abide good practices?"
)
}
8 changes: 4 additions & 4 deletions README.md
@@ -1,5 +1,5 @@
# WIlsON: Webbased Interactive Omics visualizatioN - The R Package
*Buildkite:* [![Build status](https://badge.buildkite.com/d79f55bb3e3cf0d70d6784feb8c6e26182d602f534e74fac4e.svg?branch=master)](https://buildkite.com/loosolab/wilson)
*Buildkite:* ![Build status](https://badge.buildkite.com/d79f55bb3e3cf0d70d6784feb8c6e26182d602f534e74fac4e.svg?branch=master)

## Abstract
#### Objective
Expand All @@ -12,9 +12,9 @@ The WIlsON R package employs the R Shiny and Plotly web-based frameworks using a
The WIlsON R package includes a toolbox of R Shiny modules that can be used to construct a wide array of web-interfaces for plotting feature-based data.

## Availability
All components of the WIlsON R package have been implemented in an integrated web application that is available for download from the Github repository [wilson-apps](https://github.molgen.mpg.de/loosolab/wilson-apps) and can be tested on our [official demonstration server](http://loosolab.mpi-bn.mpg.de/apps/wilson/).
All components of the WIlsON R package have been implemented in an integrated web application that is available for download from the Github repository [wilson-apps](https://github.molgen.mpg.de/loosolab/wilson-apps/) and can be tested on our [official demonstration server](http://loosolab.mpi-bn.mpg.de/apps/wilson/).

Usage instructions can be found in the extensive [documentation](https://github.molgen.mpg.de/loosolab/wilson-apps/wiki).
Usage instructions can be found in the extensive [documentation](https://github.molgen.mpg.de/loosolab/wilson-apps/wiki/).

Get a Docker container [here](https://hub.docker.com/r/loosolab/wilson/).

Expand All @@ -37,7 +37,7 @@ CLARION: generiC fiLe formAt foR quantItative cOmparsions of high throughput scr

CLARION is a data format especially developed to be used with WIlsON, which relies on a tab-delimited table with a metadata header to describe the following columns. It is based on the Summarized Experiment format and supports all types of data which can be reduced to features and their annotation (e.g. genes, transcripts, proteins, probes) with assigned numerical values (e.g. count, score, log2foldchange, z-score, p-value). Most result tables derived from RNA-Seq, ChIP/ATAC-Seq, Proteomics, Microarrays, and many other analyses can thus be easily reformatted to become compatible without having to modify the code of WIlsON for each specific experiment.

Please check the following link for details considering the [CLARION format](https://github.molgen.mpg.de/loosolab/wilson-apps/wiki/CLARION-Format).
Please check the following link for details considering the [CLARION format](https://github.molgen.mpg.de/loosolab/wilson-apps/wiki/CLARION-Format/).

## How to cite
*Schultheis H, Kuenne C, Preussner J, Wiegandt R, Fust A, Bentsen M, Looso M*. WIlsON: Webbased Interactive Omics VisualizatioN. (2018), doi: https://XY
Expand Down
57 changes: 57 additions & 0 deletions cran-comments.md
@@ -0,0 +1,57 @@
# Submission 1
## Test environments
* local windows 7 install, R 3.5.1
* debian 9.4, R 3.4.1
* win-builder (devel and release)

## R CMD check results
There were no ERRORs or WARNINGs.

There was 1 NOTE:

* New submission

* Possibly mis-spelled words in DESCRIPTION:
Omics (3:30)
omics (9:126)

Both are spelled correctly. First is capital because of title case.

## Downstream dependencies
I have also run R CMD check on downstream dependencies of wilson
(https://github.molgen.mpg.de/loosolab/wilson/tree/master/revdep).
All packages that I could install passed.

## Reviewer comments
Thanks, we see you have lots of cuntions without examples (which may be reasonable given they are not intended t be called by users directly).
Nevertheless, it would be good to have them tested, so please create, if examples are not feasible, at least tests that execute the various functions in your package.

Best,
Uwe Ligges

# Submission 2
## Test environments
* local windows 7 install, R 3.5.1
* debian 9.4, R 3.4.1
* win-builder (devel and release)

## Submission comments
Addressed reviewer comments by adding tests where possible.

## R CMD check results
There were no ERRORs or WARNINGs.

There was 1 NOTE:

* New submission

* Possibly mis-spelled words in DESCRIPTION:
Omics (3:30)
omics (9:126)

Both are spelled correctly. First is capital because of title case.

## Downstream dependencies
I have also run R CMD check on downstream dependencies of wilson
(https://github.molgen.mpg.de/loosolab/wilson/tree/master/revdep).
All packages that I could install passed.
3 changes: 3 additions & 0 deletions man/parse_MaxQuant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions man/release_questions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da262e7

Please sign in to comment.