From 07223ef1366ec98c140401a3d50bf4426226a12d Mon Sep 17 00:00:00 2001 From: Konrad1991 Date: Mon, 22 Apr 2024 10:11:49 +0200 Subject: [PATCH] fixed error in removeOutlier function --- Dockerfile | 4 +++- MTT/DESCRIPTION | 2 +- MTT/NAMESPACE | 1 + MTT/R/import.R | 11 +++++++---- MTT/man/removeOutlier.Rd | 18 ++++++++++++++++++ build_and_run.sh | 0 installMTT.R | 2 ++ push2docker.sh | 5 +++-- run.sh | 5 +++-- shinychem.Rproj | 13 ------------- 10 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 MTT/man/removeOutlier.Rd mode change 100644 => 100755 build_and_run.sh create mode 100644 installMTT.R mode change 100644 => 100755 push2docker.sh mode change 100644 => 100755 run.sh delete mode 100644 shinychem.Rproj diff --git a/Dockerfile b/Dockerfile index 40f1fe7..8da7ab6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,9 @@ RUN install2.r --error --skipinstalled \ ggpmisc \ jose \ R6 \ - patchwork + patchwork \ + cowplot \ + quarto USER shiny COPY ./app/ ./myapp diff --git a/MTT/DESCRIPTION b/MTT/DESCRIPTION index a9fc66e..2eae7ce 100644 --- a/MTT/DESCRIPTION +++ b/MTT/DESCRIPTION @@ -8,5 +8,5 @@ Maintainer: Description: Import xml files from platereader. Calculation of LD50. Creating boxplots of raw data and the curves used for calculation of LD50. License: GPL-2 Imports: tidyr, ggplot2, drc, R6, quarto, openxlsx, cowplot, gridExtra -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Encoding: UTF-8 diff --git a/MTT/NAMESPACE b/MTT/NAMESPACE index 73145e8..b8d8eed 100644 --- a/MTT/NAMESPACE +++ b/MTT/NAMESPACE @@ -3,6 +3,7 @@ export(XML2DF) export(ic50) export(import) +export(removeOutlier) export(report_pdf) export(save) import(drc) diff --git a/MTT/R/import.R b/MTT/R/import.R index 17a6d5b..1aa7106 100644 --- a/MTT/R/import.R +++ b/MTT/R/import.R @@ -137,10 +137,12 @@ import <- function(path, names = names_default(), conc = conc_default()) { #' @param l a list containing column indices which defines the different groups #' @param dep the column index which defines the dependent variable removeOutlier <- function(df, l, dep) { - int <- sapply(seq_along(1:length(df)), function(x) { - paste0(df[, l], collapse = "_") - }) + ps <- function(a, b) { + paste0(a, "_", b) + } + int <- Reduce(ps, as.list(df[, l])) intUnique <- unique(int) + dfor <- lapply(intUnique, function(x) { temp <- df[int == x, ] bs <- boxplot.stats(temp$abs) @@ -148,5 +150,6 @@ removeOutlier <- function(df, l, dep) { temp[temp$abs %in% bs$out, "abs"] <- NA return(temp) }) - do.call(rbind, dfor) + df <- do.call(rbind, dfor) + df[!is.na(df$abs), ] } diff --git a/MTT/man/removeOutlier.Rd b/MTT/man/removeOutlier.Rd new file mode 100644 index 0000000..f08eb72 --- /dev/null +++ b/MTT/man/removeOutlier.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/import.R +\name{removeOutlier} +\alias{removeOutlier} +\title{remove outliers} +\usage{ +removeOutlier(df, l, dep) +} +\arguments{ +\item{df}{a data.frame from which the outliers should be removed} + +\item{l}{a list containing column indices which defines the different groups} + +\item{dep}{the column index which defines the dependent variable} +} +\description{ +remove outliers +} diff --git a/build_and_run.sh b/build_and_run.sh old mode 100644 new mode 100755 diff --git a/installMTT.R b/installMTT.R new file mode 100644 index 0000000..866fb8a --- /dev/null +++ b/installMTT.R @@ -0,0 +1,2 @@ +install.packages("/home/konrad/Documents/GitHub/RProjects/shinychem/MTT", + type = "source", repos = NULL) diff --git a/push2docker.sh b/push2docker.sh old mode 100644 new mode 100755 index d634259..a9f5c85 --- a/push2docker.sh +++ b/push2docker.sh @@ -1,4 +1,5 @@ #!/bin/bash -docker build -t my-shiny-app . -docker push konradkraemer/biostats:latest \ No newline at end of file +docker build -t konradkraemer/biostats:latest . +docker push konradkraemer/biostats:latest + diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 index e217024..18615e9 --- a/run.sh +++ b/run.sh @@ -3,5 +3,6 @@ #/usr/bin/shiny-server sudo -u shiny /usr/bin/shiny-server -# rstudio switch to terminal alt, shift, m -# rstudio run command from script in terminal: strg, alt, enter \ No newline at end of file +#cd /srv/shiny-server + +#Rscript -e 'shiny::runApp(".", port = 3838)' \ No newline at end of file diff --git a/shinychem.Rproj b/shinychem.Rproj deleted file mode 100644 index 8e3c2eb..0000000 --- a/shinychem.Rproj +++ /dev/null @@ -1,13 +0,0 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX