From 51c63b3ce30d3b318fa960dfa6e77997bb420c8a Mon Sep 17 00:00:00 2001 From: nilsmechtel Date: Thu, 16 Nov 2023 22:32:45 +0100 Subject: [PATCH] update R CMD Check badge --- .github/workflows/R-CMD-check.yaml | 27 +++++++------------ DESCRIPTION | 4 ++- NAMESPACE | 13 ++++++++++ R/calculate_log2FC.R | 5 ++-- R/impute_data.R | 4 +-- R/plot_network.R | 2 +- R/transform_data.R | 4 +-- README.md | 2 +- data/example_meta_data.RDS | Bin 0 -> 176 bytes man/aggregate_data.Rd | 2 +- man/apply_linear_model.Rd | 18 +++++++++++++ man/calc_CV.Rd | 22 ++++++++++++++++ man/calculate_log2FC.Rd | 39 ++++++++++++++++++++++++++++ man/impute_data.Rd | 25 ++++++++++++++++++ man/plot_log2FC.Rd | 40 +++++++++++++++++++++++++++++ man/read_named_region.Rd | 28 ++++++++++++++++++++ man/set_threshold.Rd | 17 ++++++++++++ man/transform.Rd | 18 +++++++++++++ man/transform_data.Rd | 20 +++++++++++++++ man/zero_imputation.Rd | 20 +++++++++++++++ 20 files changed, 282 insertions(+), 28 deletions(-) create mode 100755 data/example_meta_data.RDS create mode 100644 man/apply_linear_model.Rd create mode 100644 man/calc_CV.Rd create mode 100644 man/calculate_log2FC.Rd create mode 100644 man/impute_data.Rd create mode 100644 man/plot_log2FC.Rd create mode 100644 man/read_named_region.Rd create mode 100644 man/set_threshold.Rd create mode 100644 man/transform.Rd create mode 100644 man/transform_data.Rd create mode 100644 man/zero_imputation.Rd diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f74fa68..a3ac618 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,4 +1,4 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: config: - - {os: macOS-latest, r: 'release'} + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} @@ -29,9 +29,9 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 with: @@ -39,20 +39,11 @@ jobs: http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: rcmdcheck + extra-packages: any::rcmdcheck + needs: check - - uses: r-lib/actions/check-r-package@v1 - - - name: Show testthat output - if: always() - run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true diff --git a/DESCRIPTION b/DESCRIPTION index fa01052..d9c07f8 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: MetAlyzer Type: Package Title: Read and Analyze 'MetIDQ™' Software Output Files -Version: 0.2.0 +Version: 1.0.0 Authors@R: c(person("Nils", "Mechtel", email = "nils.mech@gmail.com", @@ -28,6 +28,8 @@ Imports: stringr, utils, rlang, + ggplot2, + ggrepel, SummarizedExperiment, S4Vectors, BiocManager, diff --git a/NAMESPACE b/NAMESPACE index 73b8953..09e1fc7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,15 +1,28 @@ # Generated by roxygen2: do not edit by hand export(MetAlyzer_dataset) +export(calc_CV) +export(calculate_log2FC) export(exportConcValues) export(extraction_data) export(filterMetaData) export(filterMetabolites) +export(impute_data) export(pathway) +export(plot_log2FC) export(polarity) +export(read_named_region) export(renameMetaData) export(summarizeConcValues) export(summarizeQuantData) +export(transform_data) export(treatment_data) export(updateMetaData) +import(SummarizedExperiment) import(dplyr) +import(ggplot2) +import(ggrepel) +importFrom(rlang,.data) +importFrom(stats,lm) +importFrom(utils,install.packages) +importFrom(utils,installed.packages) diff --git a/R/calculate_log2FC.R b/R/calculate_log2FC.R index 6d1d6fc..b2e9378 100644 --- a/R/calculate_log2FC.R +++ b/R/calculate_log2FC.R @@ -12,6 +12,7 @@ #' @return A data frame containing the log2 fold change for each metabolite #' #' @import dplyr +#' @import SummarizedExperiment #' @importFrom utils install.packages #' @importFrom utils installed.packages #' @importFrom rlang .data @@ -27,7 +28,7 @@ calculate_log2FC <- function(metalyzer_se, categorical, perc_of_min = 0.2, imput installation_type = "binary") { metalyzer_se <- impute_data(metalyzer_se, perc_of_min, impute_NA) metalyzer_se <- transform_data(metalyzer_se) - aggregated_data <- metadata(metalyzer_se)$aggregated_data + aggregated_data <- metalyzer_se@metadata$aggregated_data meta_data <- colData(metalyzer_se) cat_str <- deparse(substitute(categorical)) @@ -39,7 +40,7 @@ calculate_log2FC <- function(metalyzer_se, categorical, perc_of_min = 0.2, imput }), levels = unique(mapping_vec)), .after = ID) - metadata(metalyzer_se)$aggregated_data <- aggregated_data + metalyzer_se@metadata$aggregated_data <- aggregated_data ## Check for qvalue and BiocManager installation installed_packages <- utils::installed.packages()[, "Package"] if (! "qvalue" %in% installed_packages) { diff --git a/R/impute_data.R b/R/impute_data.R index 9abfe93..1375a56 100644 --- a/R/impute_data.R +++ b/R/impute_data.R @@ -36,7 +36,7 @@ impute_data <- function( perc_of_min, impute_NA ) { - aggregated_data <- metadata(metalyzer_se)$aggregated_data + aggregated_data <- metalyzer_se@metadata$aggregated_data cat("Impute concentrations (groupwise: Metabolite) with", paste0(round(perc_of_min * 100), "%"), "of the minimal positive value... ") @@ -48,7 +48,7 @@ impute_data <- function( Concentration, perc_of_min, impute_NA), .after = Concentration) %>% group_by_at(grouping_vars) - metadata(metalyzer_se)$aggregated_data <- aggregated_data + metalyzer_se@metadata$aggregated_data <- aggregated_data cat("finished!\n") return(metalyzer_se) } diff --git a/R/plot_network.R b/R/plot_network.R index 4edc700..079c26c 100644 --- a/R/plot_network.R +++ b/R/plot_network.R @@ -1,4 +1,4 @@ -#' @title Plot Pathway Network +#' Plot Pathway Network #' #' @description This function plots the log2 fold change for each metabolite and visualizes it, in a pathway network. #' diff --git a/R/transform_data.R b/R/transform_data.R index be180fc..0b1234a 100644 --- a/R/transform_data.R +++ b/R/transform_data.R @@ -24,10 +24,10 @@ transform <- function(vec, func) { #' @return An updated aggregated_data tibble data frame #' @export transform_data <- function(metalyzer_se) { - aggregated_data <- metadata(metalyzer_se)$aggregated_data + aggregated_data <- metalyzer_se@metadata$aggregated_data aggregated_data <- mutate(aggregated_data, log2_Conc = transform(imputed_Conc, base::log2), .after = imputed_Conc) - metadata(metalyzer_se)$aggregated_data <- aggregated_data + metalyzer_se@metadata$aggregated_data <- aggregated_data return(metalyzer_se) } \ No newline at end of file diff --git a/README.md b/README.md index c86d5fc..68eacb2 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ MetAlyzer ======== -[![R-CMD-check](https://github.com/nilsmechtel/MetAlyzer/workflows/R-CMD-check/badge.svg)](https://github.com/nilsmechtel/MetAlyzer/actions) +[![R-CMD-check](https://github.com/nilsmechtel/MetAlyzer/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nilsmechtel/MetAlyzer/actions/workflows/R-CMD-check.yaml) [![license](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![metacran downloads](https://cranlogs.r-pkg.org/badges/grand-total/MetAlyzer)](https://cran.r-project.org/package=MetAlyzer) diff --git a/data/example_meta_data.RDS b/data/example_meta_data.RDS new file mode 100755 index 0000000000000000000000000000000000000000..7303ceb2efa54185d1c79650a58fcf997e0f70cc GIT binary patch literal 176 zcmV;h08jrPiwFP!000001B>8dU|?WoU;&Y=K!SlaG{jBU0>~2va+rWv0Ej(+3OIo@ zqakjF5pIStZiWeNhAD1_8E(d?3x~A}QPU$+kRhC91ZNqK%8tqoF