From 357d7b8d33dab30adfe907e91cbde50f43c7bd5a Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Tue, 14 Dec 2021 18:23:34 +0000 Subject: [PATCH 01/16] added featureSummary() method for MetaboProfile class --- R/summary.R | 60 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/R/summary.R b/R/summary.R index 05b174f..5385771 100644 --- a/R/summary.R +++ b/R/summary.R @@ -21,28 +21,48 @@ setGeneric('featureSummary',function(x) standardGeneric('featureSummary')) #' @rdname featureSummary -#' @importFrom dplyr n_distinct setMethod('featureSummary',signature = 'Binalysis', function(x){ x %>% - binnedData() %>% - map(~{{ - .x %>% - rowid_to_column(var = 'Sample') %>% - gather('Feature','Intensity',-Sample) - }}) %>% - bind_rows() %>% - mutate(Mode = str_sub(Feature,1,1)) %>% - group_by(Mode) %>% - summarise( - `Number of bins` = n_distinct(Feature), - `Missing Data (%)` = round(length(which(Intensity == 0)) / - length(Intensity) * 100,2), - .groups = 'drop') %>% - {{ - .$Mode[.$Mode == 'n'] <- 'Negative' - .$Mode[.$Mode == 'p'] <- 'Positive' - . - }} + binnedData() %>% + featSummary() }) + +#' @rdname featureSummary + +setMethod('featureSummary',signature = 'MetaboProfile', + function(x){ + x %>% + processedData() %>% + featSummary() + }) + +#' @importFrom dplyr n_distinct + +featSummary <- function(x){ + + if (!is.list(x)){ + x <- list(x) + } + + x %>% + map(~{{ + .x %>% + rowid_to_column(var = 'Sample') %>% + gather('Feature','Intensity',-Sample) + }}) %>% + bind_rows() %>% + mutate(Mode = str_sub(Feature,1,1)) %>% + mutate(Mode = replace(Mode, + Mode != 'n' & Mode != 'p', + NA)) %>% + group_by(Mode) %>% + summarise( + `Number of bins` = n_distinct(Feature), + `Missing Data (%)` = round(length(which(Intensity == 0)) / + length(Intensity) * 100,2), + .groups = 'drop') %>% + mutate(Mode = replace(Mode,Mode == 'n','Negative') %>% + replace(Mode == 'p','Positive')) +} \ No newline at end of file From c1239be76bf43ce0b2ca6246c0298fa6ead3ca2c Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Tue, 14 Dec 2021 18:25:20 +0000 Subject: [PATCH 02/16] bumped version to 0.5.9 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 643caac..e5c8919 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: metaboMisc Title: Miscellaneous Functions for Metabolomics Analyses -Version: 0.5.8 +Version: 0.5.9 Authors@R: person("Jasen", "Finch", email = "jsf9@aber.ac.uk", role = c("aut", "cre")) Description: Miscellaneous helper functions for metabolomics analyses that do not yet have a permanent home. URL: https://jasenfinch.github.io/metaboMisc From d5b3ded7709f3685bfb23bb42d4df6a75a59c2f9 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:13:28 +0000 Subject: [PATCH 03/16] corrected file name for modeless processed data for MetaboProfile class --- R/export.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/R/export.R b/R/export.R index bdd0b66..58c03b3 100644 --- a/R/export.R +++ b/R/export.R @@ -88,10 +88,20 @@ setMethod('exportData',signature = 'MetaboProfile', file_paths <- pd %>% names() %>% map_chr(~{ + prefix <- .x + + if (prefix != 'n' | prefix != 'p'){ + prefix <- '' + } else { + prefix <- switch(prefix, + n = 'negative_mode_', + p = 'positive_mode_') + } + bind_cols(pd[[.x]],i %>% select(name)) %>% gather('Feature','Intensity',-name) %>% spread(name,Intensity) %>% - exportCSV(str_c(outPath,'/',.x,'_mode_processed_data.csv')) + exportCSV(str_c(outPath,'/',prefix,'processed_data.csv')) }) return(file_paths) From ac7e91538f6d1164d8ec5521527dbe0c839e6069 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:14:06 +0000 Subject: [PATCH 04/16] Fixed character column sanitation in sanitiseTable() --- R/sanitise.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/sanitise.R b/R/sanitise.R index dda734f..c649964 100644 --- a/R/sanitise.R +++ b/R/sanitise.R @@ -19,7 +19,7 @@ sanitiseTable <- function(x,maxRows = 5000,sigFig = 3,maxCharacters = 100){ x <- x[seq_len(maxRows),] } - a <- map_df(x,~{ + x <- map_df(x,~{ if (typeof(.x) == 'character'){ limit_characters <- .x %>% nchar() %>% From b7165bf7102f7f3a2dd3c5f28ac39da2f0b185c9 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:37:28 +0000 Subject: [PATCH 05/16] fixed tibble console messages for single mode data in detectMissInjection() and detectBatchDiff() methods for the MetaboProfile class --- R/detect.R | 90 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/R/detect.R b/R/detect.R index 4ad2530..6964b2f 100644 --- a/R/detect.R +++ b/R/detect.R @@ -60,20 +60,27 @@ setMethod('detectMissInjections',signature = 'MetaboProfile', mi <- x %>% processedData() - if (str_detect(technique(x),'GCMS')) { - mi <- mi %>% - rowSums() %>% - tibble(value = .) %>% - bind_cols(i) - } else { - mi <- mi %>% - map(rowSums) %>% - bind_cols() %>% - rowSums() %>% - as_tibble() %>% - bind_cols(i) + if (!is.list(mi)){ + mi <- list(mi) + } + + mi <- mi %>% + map(rowSums) + + if (mi %>% + names() %>% + is.na() %>% + any()) { + names(mi) <- replace(names(mi), + is.na(names(mi)), + 'NA') } - mi %>% + + mi %>% + bind_cols() %>% + rowSums() %>% + as_tibble() %>% + bind_cols(i) %>% missInject(idx = idx) }) @@ -159,21 +166,30 @@ setMethod('detectBatchDiff',signature = "MetaboProfile", TICdat <- x %>% processedData() - if (str_detect(technique(x),'GCMS')) { - TICdat <- TICdat %>% - rowSums() %>% - {tibble(Sample = 1:length(.), - TIC = ., - batch = ri[,by] %>% deframe() %>% factor())} - } else { - TICdat <- TICdat %>% - map(rowSums) %>% - bind_cols() %>% - rowid_to_column(var = 'Sample') %>% - mutate(batch = ri[,by] %>% unlist() %>% factor()) %>% - gather('Mode','TIC',-batch,-Sample) + if (!is.list(TICdat)){ + TICdat <- list(TICdat) + } + + TICdat <- TICdat %>% + map(rowSums) + + if (TICdat %>% + names() %>% + is.na() %>% + any()) { + names(TICdat) <- replace(names(TICdat), + is.na(names(TICdat)), + 'NA') } + TICdat <- TICdat %>% + bind_cols() %>% + rowid_to_column(var = 'Sample') %>% + mutate(batch = ri[,by] %>% + unlist() %>% + factor()) %>% + gather('Mode','TIC',-batch,-Sample) + diff <- batchDiff(TICdat,pthresh) return(diff) }) @@ -366,17 +382,17 @@ setMethod('detectModellingParameters',signature = 'Binalysis', setMethod('detectModellingParameters',signature = 'MetaboProfile', function(x){ - idx <- x %>% - processingParameters() %>% - .$info %>% - .$cls - - sample_information <- x %>% - profilePro::sampleInfo() %>% - select(all_of(idx)) %>% - deframe() - - detectModelling(sample_information,idx) + idx <- x %>% + processingParameters() %>% + .$info %>% + .$cls + + sample_information <- x %>% + profilePro::sampleInfo() %>% + select(all_of(idx)) %>% + deframe() + + detectModelling(sample_information,idx) }) #' @rdname detectModellingParameters From 4e7dfe2a260ec7ff7bacfdd5d90b7f80ed315de4 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:45:53 +0000 Subject: [PATCH 06/16] enabled unit tests for methods for the MetaboProfile class --- tests/testthat.R | 52 +++++++++++++++++----------------- tests/testthat/test-detect.R | 10 +++---- tests/testthat/test-export.R | 3 +- tests/testthat/test-plot.R | 1 - tests/testthat/test-sanitise.R | 2 +- 5 files changed, 32 insertions(+), 36 deletions(-) diff --git a/tests/testthat.R b/tests/testthat.R index 0d637f4..2f490dc 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -7,40 +7,40 @@ library(MFassign) ## Example Binalysis class file_paths <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes') %>% - .[61:63] + .[stringr::str_detect(.,'QC')] sample_information <- runinfo('FIE-HRMS','BdistachyonEcotypes') %>% - dplyr::filter(name == 'QC01' | name == 'QC02' | name == 'QC03') + dplyr::filter(stringr::str_detect(name,'QC')) bp <- binneR::detectParameters(file_paths) bd <- binneR::binneRlyse(file_paths,sample_information,bp) ## Example MetaboProfile class -# file_paths <- list.files( -# system.file("cdf", -# package = "faahKO"), -# full.names = TRUE, -# recursive = TRUE)[1:2] -# file_names <- basename(file_paths) -# sample_names <- tools::file_path_sans_ext(file_names) -# -# sample_info <- tibble::tibble(fileOrder = seq_along(file_paths), -# injOrder = seq_along(file_paths), -# fileName = file_names, -# batch = 1, -# block = 1, -# name = sample_names, -# class = substr(sample_names,1,2)) -# -# parameters <- profileParameters('LCMS-RP',nCores = 2) -# processingParameters(parameters)$peakDetection <- xcms::CentWaveParam(snthresh = 20, -# noise = 1000) -# processingParameters(parameters)$retentionTimeCorrection <- xcms::ObiwarpParam() -# processingParameters(parameters)$grouping <- xcms::PeakDensityParam(sampleGroups = sample_info$class, -# maxFeatures = 300, -# minFraction = 2/3) -# lcd <- profileProcess(file_paths,sample_info,parameters) +file_paths <- list.files( + system.file("cdf", + package = "faahKO"), + full.names = TRUE, + recursive = TRUE)[1:2] +file_names <- basename(file_paths) +sample_names <- tools::file_path_sans_ext(file_names) + +sample_info <- tibble::tibble(fileOrder = seq_along(file_paths), + injOrder = seq_along(file_paths), + fileName = file_names, + batch = 1, + block = 1, + name = sample_names, + class = substr(sample_names,1,2)) + +parameters <- profileParameters('LCMS-RP',nCores = 2) +processingParameters(parameters)$peakDetection <- xcms::CentWaveParam(snthresh = 20, + noise = 1000) +processingParameters(parameters)$retentionTimeCorrection <- xcms::ObiwarpParam() +processingParameters(parameters)$grouping <- xcms::PeakDensityParam(sampleGroups = sample_info$class, + maxFeatures = 300, + minFraction = 2/3) +lcd <- profileProcess(file_paths,sample_info,parameters) ## Example Analysis class a <- new('Analysis') diff --git a/tests/testthat/test-detect.R b/tests/testthat/test-detect.R index 801ff5d..e945444 100644 --- a/tests/testthat/test-detect.R +++ b/tests/testthat/test-detect.R @@ -7,7 +7,7 @@ test_that('miss injection detectioni works for Binalysis class',{ }) test_that('miss injection detectioni works for MetaboProfile class',{ - skip('Skip tests involving MetaboProfile class') + miss_injections <- detectMissInjections(lcd) @@ -24,8 +24,6 @@ test_that('batch correction detection works for Binalysis class',{ }) test_that('batch correction detection works for MetaboProfile class',{ - skip('Skip tests involving MetaboProfile class') - batch_diff <- detectBatchDiff(lcd) expect_null(batch_diff) @@ -38,7 +36,7 @@ test_that('pre-treatment parameter detection works for Binalysis class',{ }) test_that('pre-treatment parameter detection works for MetaboProfile class',{ - skip('Skip tests involving MetaboProfile class') + pp <- detectPretreatmentParameters(lcd) @@ -52,7 +50,7 @@ test_that('modelling parameter detection works for Binalysis class',{ }) test_that('modelling parameter detection works for MetaboProfile class',{ - skip('Skip tests involving MetaboProfile class') + mp <- detectModellingParameters(lcd) @@ -63,4 +61,4 @@ test_that('modelling parameter detection works for Analysis class',{ mp <- detectModellingParameters(a,cls = 'day') expect_s4_class(mp,'AnalysisParameters') -}) \ No newline at end of file +}) diff --git a/tests/testthat/test-export.R b/tests/testthat/test-export.R index e239861..e662785 100644 --- a/tests/testthat/test-export.R +++ b/tests/testthat/test-export.R @@ -20,13 +20,12 @@ test_that("export Binalysis works", { }) test_that("export MetaboProfile works", { - skip('Skip tests involving MetaboProfile class') fp <- export(lcd,temp_dir) expect_identical(basename(fp),c('sample_information.csv', 'peak_info.csv', - '/1_mode_processed_data.csv')) + 'processed_data.csv')) }) test_that("export Analysis works", { diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index 1561098..bbd3e35 100644 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -5,7 +5,6 @@ test_that("plotRSD works for Binalysis class", { }) test_that("plotRSD works for MetaboProfile class", { - skip('Skip tests involving MetaboProfile class') pl <- plotRSD(lcd) diff --git a/tests/testthat/test-sanitise.R b/tests/testthat/test-sanitise.R index f9aa20a..691adf2 100644 --- a/tests/testthat/test-sanitise.R +++ b/tests/testthat/test-sanitise.R @@ -14,5 +14,5 @@ test_that("tables can be sanitised", { expect_equal(nrow(x),n_rows) expect_equal(x$Sepal.Length[1],5) - expect_equal(max(nchar(x$Species)),max_char) + expect_true(all(str_detect(x$Species,'set...'))) }) From 3f0406003b82629fcfc8e10e73d0835aac42a1f8 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:46:46 +0000 Subject: [PATCH 07/16] updated documentation --- man/featureSummary.Rd | 3 +++ man/sanitiseTable.Rd | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/man/featureSummary.Rd b/man/featureSummary.Rd index 4e94813..6fd32f3 100644 --- a/man/featureSummary.Rd +++ b/man/featureSummary.Rd @@ -3,11 +3,14 @@ \name{featureSummary} \alias{featureSummary} \alias{featureSummary,Binalysis-method} +\alias{featureSummary,MetaboProfile-method} \title{Summarise features} \usage{ featureSummary(x) \S4method{featureSummary}{Binalysis}(x) + +\S4method{featureSummary}{MetaboProfile}(x) } \arguments{ \item{x}{S4 object of class \code{Binalysis}} diff --git a/man/sanitiseTable.Rd b/man/sanitiseTable.Rd index 4a89def..5170475 100644 --- a/man/sanitiseTable.Rd +++ b/man/sanitiseTable.Rd @@ -16,7 +16,7 @@ sanitiseTable(x, maxRows = 5000, sigFig = 3, maxCharacters = 100) \item{maxCharacters}{Maximum number of characters allowed in a string before it is truncated} } \description{ -Sanitise a data table by restricting the number of rows and rounding numeric columns. +Sanitise a data table by restricting the number of rows or characters and rounding numeric columns. } \examples{ sanitiseTable(iris,maxRows = 10,sigFig = 1) From 6293e919ec2c350a2029de5567cecdfceee3b788 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:51:11 +0000 Subject: [PATCH 08/16] Updated package NEWS --- NEWS.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index afb4bb1..c248303 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,14 @@ -# metabMisc 0.5.8 +# metaboMisc 0.5.9 + +* Corrected the exported file name for mode-less processed data for the `MetaboProfile` class. + +* Fixed the character sanitation in `sanitiseTable()`. + +* Fixed extraneous console messages in `detectMissInjections()` and `detectBatchDiff()` methods for the `MetaboProfile` class. + +* Enabled unit tests for methods for the `MetaboProfile` class. + +# metaboMisc 0.5.8 * Numbers of characters in strings are now limited by `sanitiseTable()`. From 6db951c9a2af1d56bfdf700ae5ec5f62789c24b2 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Wed, 15 Dec 2021 23:58:37 +0000 Subject: [PATCH 09/16] updated pkgdown site --- docs/404.html | 123 +++---- docs/authors.html | 139 +++----- docs/index.html | 81 +++-- docs/news/index.html | 285 +++++----------- docs/pkgdown.css | 83 +++-- docs/pkgdown.js | 4 +- docs/pkgdown.yml | 10 +- docs/reference/addAssignments.html | 148 +++------ docs/reference/convertSampleInfo.html | 141 ++------ docs/reference/detectBatchDiff.html | 242 +++++--------- docs/reference/detectMissInjections.html | 218 ++++-------- docs/reference/detectModellingParameters.html | 235 +++++-------- .../detectPretreatmentParameters.html | 275 ++++++--------- docs/reference/export.html | 253 +++++--------- docs/reference/exportCSV.html | 160 +++------ docs/reference/featureSummary.html | 204 ++++-------- docs/reference/index.html | 188 ++--------- docs/reference/plotRSD.html | 215 ++++-------- docs/reference/preTreatModes.html | 313 +++++++----------- docs/reference/reduce.html | 290 ++++++---------- docs/reference/reexports.html | 121 ++----- docs/reference/sanitiseTable.html | 186 +++-------- docs/reference/suitableParallelPlan.html | 129 ++------ docs/sitemap.xml | 50 ++- 24 files changed, 1355 insertions(+), 2738 deletions(-) diff --git a/docs/404.html b/docs/404.html index 688cbb6..76ae6c3 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - -
-
- + +
+ + + - - -
+
+
-
- +
+ + - - diff --git a/docs/authors.html b/docs/authors.html index e766a83..5935d1b 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • metaboMisc - - + + - - - -
-
-
- -
+
- @@ -126,22 +79,20 @@

Authors

-
- +
- - + + diff --git a/docs/index.html b/docs/index.html index 24b1da3..de2b4bb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -19,6 +19,8 @@ + +
-
- +
+

Miscellaneous Functions for Metabolomics Analyses

-

A collection of miscellaneous helper and linker functions for metabolomics analyses in the hrm R package ecosystem.

-
-

-Installation

+

A collection of miscellaneous helper and linker functions for metabolomics analyses in the hrm R package ecosystem.

+
+

Installation +

The metaboMisc package can be installed from GitHub using the following:

-remotes::install_github('jasenfinch/metaboMisc')
+remotes::install_github('jasenfinch/metaboMisc')
-
-

-Learn more

+
+

Learn more +

The package documentation can be browsed online at https://jasenfinch.github.io/metaboMisc/.

-

If you believe you’ve found a bug in metaboMisc, please file a bug (and, if possible, a reproducible example) at https://github.com/jasenfinch/metaboMisc/issues.

+

If you believe you’ve found a bug in metaboMisc, please file a bug (and, if possible, a reproducible example) at https://github.com/jasenfinch/metaboMisc/issues.

-

Site built with pkgdown 1.6.1.

+

+

Site built with pkgdown 2.0.1.

@@ -144,5 +151,7 @@

Dev status

+ + diff --git a/docs/news/index.html b/docs/news/index.html index ac75df0..5cd3bb0 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -1,66 +1,12 @@ - - - - - - - -Changelog • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Changelog • metaboMisc - - + + - - -
-
- -
- -
+
-
-

-metabMisc 0.5.8

- -
-
-

-metaboMisc 0.5.7

-
    -
  • Removed aberHRML/metaboData from the Remotes field in the DESCRIPTION to ensure that the CRAN version of metaboData is installed.

  • +
    + +
    • Corrected the exported file name for mode-less processed data for the MetaboProfile class.

    • +
    • Fixed the character sanitation in sanitiseTable().

    • +
    • Fixed extraneous console messages in detectMissInjections() and detectBatchDiff() methods for the MetaboProfile class.

    • +
    • Enabled unit tests for methods for the MetaboProfile class.

    • +
    +
    + +
    +
    + +
    • Removed aberHRML/metaboData from the Remotes field in the DESCRIPTION to ensure that the CRAN version of metaboData is installed.

    • Added sanitiseTable() that can be used to restrict the number of rows in a table and round numeric columns to a given number of significant figures.

    • -
    -
    -
    -

    -metaboMisc 0.5.6

    - -
    -
    -

    -metaboMisc 0.5.5

    -
      -
    • Added gzip_ext argument to convertSampleInfo() to enable the addition of the .gz file extension to file names in the fileNames column.
    • -
    -
    -
    -

    -metaboMisc 0.5.4

    - -
    -
    -

    -metaboMisc 0.5.3

    -
      -
    • Added generic methods for exporting individual elements of the Binalysis, MetaboProfile, Analysis and Assignment classes.

    • +
    +
    + +
    +
    + +
    • Added gzip_ext argument to convertSampleInfo() to enable the addition of the .gz file extension to file names in the fileNames column.
    • +
    +
    + +
    +
    + +
    • Added generic methods for exporting individual elements of the Binalysis, MetaboProfile, Analysis and Assignment classes.

    • export methods now return vectors of file paths of the exported files.

    • -
    -
    -
    -

    -metaboMisc 0.5.2

    -
    +
    + +
    • Added addAssignments() method for Analysis and Assignment classes.

    • Added exportCSV() that exports data to .csv format and returns the file path of the exported file.

    • -
    • Added convertSampleInfo() to convert sample information returned from grover::runInfo to a format compatible with the binneR and profilePro packages.

    • -
    -
    -
    -

    -metaboMisc 0.5.1

    - -
    -
    -

    -metaboMisc 0.5.0

    -
    +
    + +
    +
    + +
    • Added pkgdown site available here.

    • Removed redundant methods and functions: detectPairwises(), addAssignments(), filterCorrelations(), theme_neat().

    • Improved documentation and added examples.

    • Added unit testing infrastructure.

    • Added detectPretreatmentParameters and detectModellingParameters methods.

    • The magrittr pipe (%>%) is now re-exported.

    • -
    -
    -
    -

    -metaboMisc 0.4.6

    -
      -
    • Fixed parameter handling in preTreatModes.
    • -
    -
    -
    -

    -metaboMisc 0.4.5

    -
      -
    • Fixed breakages and function imports caused by metabolyseR to version 0.14.0.
    • -
    -
    -
    -

    -metaboMisc 0.4.4

    - -
    -
    -

    -metaboMisc 0.4.3

    - -
    -
    -

    -metaboMisc 0.4.2

    - -
    -
    -

    -metaboMisc 0.4.1

    - -
    +
+
+ +
  • Fixed parameter handling in preTreatModes.
  • +
+
+ +
  • Fixed breakages and function imports caused by metabolyseR to version 0.14.0.
  • +
+
+ +
+
+ +
+
+ +
+
+ +
+
-
- +
- - + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index 1273238..80ea5b8 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -56,8 +56,10 @@ img.icon { float: right; } -img { +/* Ensure in-page images don't run outside their container */ +.contents img { max-width: 100%; + height: auto; } /* Fix bug in bootstrap (only seen in firefox) */ @@ -78,11 +80,10 @@ dd { /* Section anchors ---------------------------------*/ a.anchor { - margin-left: -30px; - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; + display: none; + margin-left: 5px; + width: 20px; + height: 20px; background-image: url(./link.svg); background-repeat: no-repeat; @@ -90,17 +91,15 @@ a.anchor { background-position: center center; } -.hasAnchor:hover a.anchor { - visibility: visible; -} - -@media (max-width: 767px) { - .hasAnchor:hover a.anchor { - visibility: hidden; - } +h1:hover .anchor, +h2:hover .anchor, +h3:hover .anchor, +h4:hover .anchor, +h5:hover .anchor, +h6:hover .anchor { + display: inline-block; } - /* Fixes for fixed navbar --------------------------*/ .contents h1, .contents h2, .contents h3, .contents h4 { @@ -264,31 +263,26 @@ table { /* Syntax highlighting ---------------------------------------------------- */ -pre { - word-wrap: normal; - word-break: normal; - border: 1px solid #eee; -} - -pre, code { +pre, code, pre code { background-color: #f8f8f8; color: #333; } +pre, pre code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; +} -pre code { - overflow: auto; - word-wrap: normal; - white-space: pre; +pre { + border: 1px solid #eee; } -pre .img { +pre .img, pre .r-plt { margin: 5px 0; } -pre .img img { +pre .img img, pre .r-plt img { background-color: #fff; - display: block; - height: auto; } code a, pre a { @@ -305,9 +299,8 @@ a.sourceLine:hover { .kw {color: #264D66;} /* keyword */ .co {color: #888888;} /* comment */ -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: #6A0366; font-weight: bolder;} +.error {font-weight: bolder;} +.warning {font-weight: bolder;} /* Clipboard --------------------------*/ @@ -365,3 +358,27 @@ mark { content: ""; } } + +/* Section anchors --------------------------------- + Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 +*/ + +div.csl-bib-body { } +div.csl-entry { + clear: both; +} +.hanging-indent div.csl-entry { + margin-left:2em; + text-indent:-2em; +} +div.csl-left-margin { + min-width:2em; + float:left; +} +div.csl-right-inline { + margin-left:2em; + padding-left:1em; +} +div.csl-indent { + margin-left: 2em; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 7e7048f..6f0eee4 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -80,7 +80,7 @@ $(document).ready(function() { var copyButton = ""; - $(".examples, div.sourceCode").addClass("hasCopyButton"); + $("div.sourceCode").addClass("hasCopyButton"); // Insert copy buttons: $(copyButton).prependTo(".hasCopyButton"); @@ -91,7 +91,7 @@ // Initialize clipboard: var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { text: function(trigger) { - return trigger.parentNode.textContent; + return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); } }); diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 696fe44..1aa5a8f 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,9 +1,9 @@ -pandoc: 2.11.4 -pkgdown: 1.6.1 +pandoc: 2.14.0.3 +pkgdown: 2.0.1 pkgdown_sha: ~ articles: {} -last_built: 2021-11-17T09:52Z +last_built: 2021-12-15T23:56Z urls: - reference: https://jasenfinch.github.io/metaboMisc//reference - article: https://jasenfinch.github.io/metaboMisc//articles + reference: https://jasenfinch.github.io/metaboMisc/reference + article: https://jasenfinch.github.io/metaboMisc/articles diff --git a/docs/reference/addAssignments.html b/docs/reference/addAssignments.html index 72ba628..dd80646 100644 --- a/docs/reference/addAssignments.html +++ b/docs/reference/addAssignments.html @@ -1,67 +1,12 @@ - - - - - - - -Add molecular formula assignments — addAssignments • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Add molecular formula assignments — addAssignments • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,56 +52,50 @@

Add molecular formula assignments

Add molecular formaul assignments to an Analysis class object.

-
addAssignments(analysis, assignment)
-
-# S4 method for Analysis,Assignment
-addAssignments(analysis, assignment)
- -

Arguments

- - - - - - - - - - -
analysis

S4 object of class Analysis

assignment

S4 object of class Assignment

+
+
addAssignments(analysis, assignment)
 
-    

Value

+# S4 method for Analysis,Assignment +addAssignments(analysis, assignment)
+
+
+

Arguments

+
analysis
+

S4 object of class Analysis

+
assignment
+

S4 object of class Assignment

+
+
+

Value

An S4 object of class Analysis

-

Details

- +
+
+

Details

Molecular formula assignments are added to the Analysis pre-treated data

+
+
-
- +
- - + + diff --git a/docs/reference/convertSampleInfo.html b/docs/reference/convertSampleInfo.html index b6fb723..d34801b 100644 --- a/docs/reference/convertSampleInfo.html +++ b/docs/reference/convertSampleInfo.html @@ -1,67 +1,12 @@ - - - - - - - -Convert sample information to a workflow compatible format — convertSampleInfo • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Convert sample information to a workflow compatible format — convertSampleInfo • metaboMisc - - - - + + -
-
- -
- -
+
-

Convert sample information from grover::runInfo to a format compatible with binneR and profilePro.

+

Convert sample information from grover::runInfo to a format compatible with binneR and profilePro.

-
convertSampleInfo(sample_info, gzip_ext = TRUE)
- -

Arguments

- - - - - - - - - - -
sample_info

tibble containing sample information as returned from grover::runInfo

gzip_ext

add .gz extension to file names

- -

Value

+
+
convertSampleInfo(sample_info, gzip_ext = TRUE)
+
+
+

Arguments

+
sample_info
+

tibble containing sample information as returned from grover::runInfo

+
gzip_ext
+

add .gz extension to file names

+
+
+

Value

A tibble containing converted sample information.

+
+
-
- +
- - + + diff --git a/docs/reference/detectBatchDiff.html b/docs/reference/detectBatchDiff.html index 548b349..4efb22a 100644 --- a/docs/reference/detectBatchDiff.html +++ b/docs/reference/detectBatchDiff.html @@ -1,67 +1,12 @@ - - - - - - - -Detect batch/block differences — detectBatchDiff • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Detect batch/block differences — detectBatchDiff • metaboMisc + + - - - - -
-
- -
- -
+
@@ -120,102 +52,96 @@

Detect batch/block differences

Detect batch/block differences within analytical runs for each ionisation mode.

-
detectBatchDiff(x, by = "block", pthresh = 0.05)
-
-# S4 method for Binalysis
-detectBatchDiff(x, by = "block", pthresh = 0.05)
-
-# S4 method for MetaboProfile
-detectBatchDiff(x, by = "block", pthresh = 0.05)
- -

Arguments

- - - - - - - - - - - - - - -
x

object of class Binalysis or MetaboProfile

by

info class column to use for batch information

pthresh

p-value threshold for significance

- -

Value

+
+
detectBatchDiff(x, by = "block", pthresh = 0.05)
 
-    

If no differences between batches are found then NULL is returned. If significant differences are found then a tibble is returned containing the ANOVA results for each ionisation mode and showing whether batch correction is needed.

-

Details

+# S4 method for Binalysis +detectBatchDiff(x, by = "block", pthresh = 0.05) + +# S4 method for MetaboProfile +detectBatchDiff(x, by = "block", pthresh = 0.05)
+
+
+

Arguments

+
x
+

object of class Binalysis or MetaboProfile

+
by
+

info class column to use for batch information

+
pthresh
+

p-value threshold for significance

+
+
+

Value

+

If no differences between batches are found then NULL is returned. If significant differences are found then a tibble is returned containing the ANOVA results for each ionisation mode and showing whether batch correction is needed.

+
+
+

Details

Analysis of Variance (ANOVA) is used to detect differences in total ion count (TIC) averages between batches/blocks.

+
-

Examples

-
## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = binneR::detectParameters(files))
-#> 
-#> Attaching package: ‘purrr’
-#> The following object is masked from ‘package:metaboMisc’:
-#> 
-#>     reduce
-#> binneR v2.6.2 Wed Nov 17 09:52:25 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [2.6S]
-
-## Detect batch differences
-batch_diff <- detectBatchDiff(analysis)
-#> Batches with < 3 replicates removed: "3", "5"
-#> Only 1 batch detected, skipping detection
-
-## Display batch diffferences
-batch_diff
-#> NULL
-
+
+

Examples

+
## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = binneR::detectParameters(files))
+#> 
+#> Attaching package: ‘purrr’
+#> The following object is masked from ‘package:metaboMisc’:
+#> 
+#>     reduce
+#> binneR v2.6.2 Wed Dec 15 23:57:16 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [2S]
+
+## Detect batch differences
+batch_diff <- detectBatchDiff(analysis)
+#> Batches with < 3 replicates removed: "3", "5"
+#> Only 1 batch detected, skipping detection
+
+## Display batch diffferences
+batch_diff
+#> NULL
+
+
+
-
- +
- - + + diff --git a/docs/reference/detectMissInjections.html b/docs/reference/detectMissInjections.html index 7f905c0..bb0ed71 100644 --- a/docs/reference/detectMissInjections.html +++ b/docs/reference/detectMissInjections.html @@ -1,67 +1,12 @@ - - - - - - - -Detect miss injections — detectMissInjections • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Detect miss injections — detectMissInjections • metaboMisc + + - - - - -
-
- -
- -
+
@@ -120,91 +52,87 @@

Detect miss injections

Detect miss injected samples.

-
detectMissInjections(x, idx = "fileOrder")
+    
+
detectMissInjections(x, idx = "fileOrder")
 
-# S4 method for Binalysis
-detectMissInjections(x, idx = "fileOrder")
+# S4 method for Binalysis
+detectMissInjections(x, idx = "fileOrder")
 
-# S4 method for MetaboProfile
-detectMissInjections(x, idx = "fileOrder")
- -

Arguments

- - - - - - - - - - -
x

object of class Binalysis or MetaboProfile

idx

sample information column to use for sample indexes

- -

Value

+# S4 method for MetaboProfile +detectMissInjections(x, idx = "fileOrder")
+
+
+

Arguments

+
x
+

object of class Binalysis or MetaboProfile

+
idx
+

sample information column to use for sample indexes

+
+
+

Value

A list containing the name of sample information column used to index the miss injections and a vector of miss injection indexes.

-

Details

- +
+
+

Details

Samples with a total ion count (TIC) below 1.5 times the inter-quartile range are detected as miss injections.

+
-

Examples

-
## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = binneR::detectParameters(files))
-#> binneR v2.6.2 Wed Nov 17 09:52:29 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [1.9S]
-
-## Detect miss injections
-miss_injections <- detectMissInjections(analysis)
-
-## Display detected miss injections
-miss_injections$missInjections
-#> numeric(0)
-
+
+

Examples

+
## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = binneR::detectParameters(files))
+#> binneR v2.6.2 Wed Dec 15 23:57:21 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [1.2S]
+
+## Detect miss injections
+miss_injections <- detectMissInjections(analysis)
+
+## Display detected miss injections
+miss_injections$missInjections
+#> numeric(0)
+
+
+
-
- +
- - + + diff --git a/docs/reference/detectModellingParameters.html b/docs/reference/detectModellingParameters.html index a36eb51..ec6c1b1 100644 --- a/docs/reference/detectModellingParameters.html +++ b/docs/reference/detectModellingParameters.html @@ -1,67 +1,12 @@ - - - - - - - -Detect modelling parameters — detectModellingParameters • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Detect modelling parameters — detectModellingParameters • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,99 +52,90 @@

Detect modelling parameters

Detect modelling parameters for Binalysis, MetaboProfile or Analysis S4 classes.

-
detectModellingParameters(x, ...)
-
-# S4 method for Binalysis
-detectModellingParameters(x)
-
-# S4 method for MetaboProfile
-detectModellingParameters(x)
-
-# S4 method for Analysis
-detectModellingParameters(x, type = "pre-treated", cls = "class")
- -

Arguments

- - - - - - - - - - - - - - - - - - -
x

S4 object of class Binalysis,MetaboProfile or Analysis

...

arguments to pass to the appropriate method

type

detect parameters for raw or pre-treated data for Analysis class

cls

sample information column to use for modelling

- -

Value

+
+
detectModellingParameters(x, ...)
+
+# S4 method for Binalysis
+detectModellingParameters(x)
+
+# S4 method for MetaboProfile
+detectModellingParameters(x)
+
+# S4 method for Analysis
+detectModellingParameters(x, type = "pre-treated", cls = "class")
+
+
+

Arguments

+
x
+

S4 object of class Binalysis,MetaboProfile or Analysis

+
...
+

arguments to pass to the appropriate method

+
type
+

detect parameters for raw or pre-treated data for Analysis class

+
cls
+

sample information column to use for modelling

+
+
+

Value

S4 object of class AnalysisParameters

+
-

Examples

-
## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = binneR::detectParameters(files))
-#> binneR v2.6.2 Wed Nov 17 09:52:32 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [1.9S]
-
-## Detect modelling parameters
-modelling_parameters <- detectModellingParameters(analysis)
-
-modelling_parameters
-#> Parameters:
-#> 
-
+
+

Examples

+
## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = binneR::detectParameters(files))
+#> binneR v2.6.2 Wed Dec 15 23:57:23 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [1.2S]
+
+## Detect modelling parameters
+modelling_parameters <- detectModellingParameters(analysis)
+
+modelling_parameters
+#> Parameters:
+#> 
+
+
+
-
- +
- - + + diff --git a/docs/reference/detectPretreatmentParameters.html b/docs/reference/detectPretreatmentParameters.html index e69969d..d9a39e2 100644 --- a/docs/reference/detectPretreatmentParameters.html +++ b/docs/reference/detectPretreatmentParameters.html @@ -1,67 +1,12 @@ - - - - - - - -Detect pre-treatment parameters — detectPretreatmentParameters • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Detect pre-treatment parameters — detectPretreatmentParameters • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,118 +52,115 @@

Detect pre-treatment parameters

Detect pre-treatment parameters for Binalysis or MetaboProfile class objects.

-
detectPretreatmentParameters(x)
-
-# S4 method for Binalysis
-detectPretreatmentParameters(x)
+    
+
detectPretreatmentParameters(x)
 
-# S4 method for MetaboProfile
-detectPretreatmentParameters(x)
+# S4 method for Binalysis +detectPretreatmentParameters(x) -

Arguments

- - - - - - -
x

S4 object of class Binalysis, MetaboProfile or AnalysisData

- -

Value

+# S4 method for MetaboProfile +detectPretreatmentParameters(x)
+
+
+

Arguments

+
x
+

S4 object of class Binalysis, MetaboProfile or AnalysisData

+
+
+

Value

S4 object of class AnalysisParameters

+
-

Examples

-
## Retreive example file paths and sample information 
-file_paths <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes') %>% 
-   .[61:63]
-
-sample_information <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes') %>% 
-    dplyr::filter(name == 'QC01' | name == 'QC02' | name == 'QC03')
-
-## Detect spectral binning parameters
-bp <- binneR::detectParameters(file_paths)
-
-## Perform spectral binning
-bd <- binneR::binneRlyse(file_paths,sample_information,bp)
-#> binneR v2.6.2 Wed Nov 17 09:52:35 2021
-#> ________________________________________________________________________________
-#> Scans: 5:13 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [2.7S]
-
-## Detect pre-treatment parameters
-pp <- detectPretreatmentParameters(bd) 
-#> Only 1 batch detected, skipping detection
-
-pp
-#> Parameters:
-#> pre-treatment
-#> 	QC
-#> 		occupancyFilter
-#> 			cls = class
-#> 			QCidx = QC
-#> 			occupancy = 2/3
-#> 		impute
-#> 			cls = class
-#> 			QCidx = QC
-#> 			occupancy = 2/3
-#> 			parallel = variables
-#> 			seed = 1234
-#> 		RSDfilter
-#> 			cls = class
-#> 			QCidx = QC
-#> 			RSDthresh = 50
-#> 		removeQC
-#> 			cls = class
-#> 			QCidx = QC
-#> 	occupancyFilter
-#> 		maximum
-#> 			cls = class
-#> 			occupancy = 2/3
-#> 	impute
-#> 		class
-#> 			cls = class
-#> 			occupancy = 2/3
-#> 			seed = 1234
-#> 	transform
-#> 		TICnorm
-#> 
-
+
+

Examples

+
## Retreive example file paths and sample information 
+file_paths <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes') %>% 
+   .[61:63]
+
+sample_information <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes') %>% 
+    dplyr::filter(name == 'QC01' | name == 'QC02' | name == 'QC03')
+
+## Detect spectral binning parameters
+bp <- binneR::detectParameters(file_paths)
+
+## Perform spectral binning
+bd <- binneR::binneRlyse(file_paths,sample_information,bp)
+#> binneR v2.6.2 Wed Dec 15 23:57:25 2021
+#> ________________________________________________________________________________
+#> Scans: 5:13 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [2.4S]
+
+## Detect pre-treatment parameters
+pp <- detectPretreatmentParameters(bd) 
+#> Only 1 batch detected, skipping detection
+
+pp
+#> Parameters:
+#> pre-treatment
+#> 	QC
+#> 		occupancyFilter
+#> 			cls = class
+#> 			QCidx = QC
+#> 			occupancy = 2/3
+#> 		impute
+#> 			cls = class
+#> 			QCidx = QC
+#> 			occupancy = 2/3
+#> 			parallel = variables
+#> 			seed = 1234
+#> 		RSDfilter
+#> 			cls = class
+#> 			QCidx = QC
+#> 			RSDthresh = 50
+#> 		removeQC
+#> 			cls = class
+#> 			QCidx = QC
+#> 	occupancyFilter
+#> 		maximum
+#> 			cls = class
+#> 			occupancy = 2/3
+#> 	impute
+#> 		class
+#> 			cls = class
+#> 			occupancy = 2/3
+#> 			seed = 1234
+#> 	transform
+#> 		TICnorm
+#> 
+
+
+ -
- +
- - + + diff --git a/docs/reference/export.html b/docs/reference/export.html index 5ecc347..0505e5f 100644 --- a/docs/reference/export.html +++ b/docs/reference/export.html @@ -1,67 +1,12 @@ - - - - - - - -Export results — exportData • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Export results — exportData • metaboMisc - - - - + + -
-
- -
- -
+
@@ -120,139 +52,126 @@

Export results

Export data tables from Binalysis,MetaboProfile, Analysis and Assignment classes.

-
exportData(x, outPath = ".", ...)
-
-# S4 method for Binalysis
-exportData(x, outPath = ".")
-
-# S4 method for MetaboProfile
-exportData(x, outPath = ".")
+    
+
exportData(x, outPath = ".", ...)
 
-# S4 method for Analysis
-exportData(x, outPath = ".", type = "raw", idx = "name")
+# S4 method for Binalysis
+exportData(x, outPath = ".")
 
-# S4 method for Assignment
-exportData(x, outPath = ".")
+# S4 method for MetaboProfile
+exportData(x, outPath = ".")
 
-exportSampleInfo(x, outPath = ".", ...)
+# S4 method for Analysis
+exportData(x, outPath = ".", type = "raw", idx = "name")
 
-# S4 method for Binalysis
-exportSampleInfo(x, outPath = ".")
+# S4 method for Assignment
+exportData(x, outPath = ".")
 
-# S4 method for MetaboProfile
-exportSampleInfo(x, outPath = ".")
+exportSampleInfo(x, outPath = ".", ...)
 
-# S4 method for Analysis
-exportSampleInfo(x, outPath = ".", type = "raw")
+# S4 method for Binalysis
+exportSampleInfo(x, outPath = ".")
 
-exportAccurateData(x, outPath = ".")
+# S4 method for MetaboProfile
+exportSampleInfo(x, outPath = ".")
 
-# S4 method for Binalysis
-exportAccurateData(x, outPath = ".")
+# S4 method for Analysis
+exportSampleInfo(x, outPath = ".", type = "raw")
 
-exportPeakInfo(x, outPath = ".")
+exportAccurateData(x, outPath = ".")
 
-# S4 method for MetaboProfile
-exportPeakInfo(x, outPath = ".")
+# S4 method for Binalysis
+exportAccurateData(x, outPath = ".")
 
-exportModellingMetrics(x, outPath = ".")
+exportPeakInfo(x, outPath = ".")
 
-# S4 method for Analysis
-exportModellingMetrics(x, outPath = ".")
+# S4 method for MetaboProfile
+exportPeakInfo(x, outPath = ".")
 
-exportModellingImportance(x, outPath = ".")
+exportModellingMetrics(x, outPath = ".")
 
-# S4 method for Analysis
-exportModellingImportance(x, outPath = ".")
+# S4 method for Analysis
+exportModellingMetrics(x, outPath = ".")
 
-exportModelling(x, outPath = ".")
+exportModellingImportance(x, outPath = ".")
 
-# S4 method for Analysis
-exportModelling(x, outPath = ".")
+# S4 method for Analysis
+exportModellingImportance(x, outPath = ".")
 
-exportCorrelations(x, outPath = ".")
+exportModelling(x, outPath = ".")
 
-# S4 method for Analysis
-exportCorrelations(x, outPath = ".")
+# S4 method for Analysis
+exportModelling(x, outPath = ".")
 
-exportAssignments(x, outPath = ".")
+exportCorrelations(x, outPath = ".")
 
-# S4 method for Assignment
-exportAssignments(x, outPath = ".")
+# S4 method for Analysis
+exportCorrelations(x, outPath = ".")
 
-exportSummarisedAssignments(x, outPath = ".")
+exportAssignments(x, outPath = ".")
 
-# S4 method for Assignment
-exportSummarisedAssignments(x, outPath = ".")
+# S4 method for Assignment
+exportAssignments(x, outPath = ".")
 
-export(x, outPath = ".", ...)
+exportSummarisedAssignments(x, outPath = ".")
 
-# S4 method for Binalysis
-export(x, outPath = ".")
+# S4 method for Assignment
+exportSummarisedAssignments(x, outPath = ".")
 
-# S4 method for MetaboProfile
-export(x, outPath = ".")
+export(x, outPath = ".", ...)
 
-# S4 method for Analysis
-export(x, outPath = ".", type = "raw", idx = "name")
+# S4 method for Binalysis
+export(x, outPath = ".")
 
-# S4 method for Assignment
-export(x, outPath = ".")
+# S4 method for MetaboProfile +export(x, outPath = ".") -

Arguments

- - - - - - - - - - - - - - - - - - - - - - -
x

S4 object of class Binalysis, MetaboProfile, Analysis or Assignment,

outPath

directory path to export to.

...

arguments to pass to relevant method

type

data type to extract. raw or pre-treated

idx

sample information column name to use as sample IDs

+# S4 method for Analysis +export(x, outPath = ".", type = "raw", idx = "name") -

Value

+# S4 method for Assignment +export(x, outPath = ".")
+
+
+

Arguments

+
x
+

S4 object of class Binalysis, MetaboProfile, Analysis or Assignment,

+
outPath
+

directory path to export to.

+
...
+

arguments to pass to relevant method

+
type
+

data type to extract. raw or pre-treated

+
idx
+

sample information column name to use as sample IDs

+
+
+

Value

A character vector of exported file paths.

+
+ -
- +
- - + + diff --git a/docs/reference/exportCSV.html b/docs/reference/exportCSV.html index 118d4f3..2fd9775 100644 --- a/docs/reference/exportCSV.html +++ b/docs/reference/exportCSV.html @@ -1,67 +1,12 @@ - - - - - - - -Export a csv — exportCSV • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Export a csv — exportCSV • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,61 +52,55 @@

Export a csv

Export a csv and return the file path of the exported csv.

-
exportCSV(x, file, ...)
- -

Arguments

- - - - - - - - - - - - - - -
x

a data frame or tibble to export

file

file or connection to write to

...

arguments to pass to readr::write_csv()

- -

Value

+
+
exportCSV(x, file, ...)
+
+
+

Arguments

+
x
+

a data frame or tibble to export

+
file
+

file or connection to write to

+
...
+

arguments to pass to readr::write_csv()

+
+
+

Value

The file path of the exported csv.

-

Details

- +
+
+

Details

If the file path directory does not exist, the directory is created prior to export.

+
-

Examples

-
exportCSV(iris, "iris.csv")
-#> [1] "iris.csv"
-
+
+

Examples

+
exportCSV(iris, "iris.csv")
+#> [1] "iris.csv"
+
+
+
-
- +
- - + + diff --git a/docs/reference/featureSummary.html b/docs/reference/featureSummary.html index 1f9e1d9..28063e2 100644 --- a/docs/reference/featureSummary.html +++ b/docs/reference/featureSummary.html @@ -1,67 +1,12 @@ - - - - - - - -Summarise features — featureSummary • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Summarise features — featureSummary • metaboMisc - - - - + + -
-
- -
- -
+
@@ -120,81 +52,81 @@

Summarise features

Summarise spectrally binned features.

-
featureSummary(x)
+    
+
featureSummary(x)
 
-# S4 method for Binalysis
-featureSummary(x)
+# S4 method for Binalysis +featureSummary(x) -

Arguments

- - - - - - -
x

S4 object of class Binalysis

- -

Value

+# S4 method for MetaboProfile +featureSummary(x)
+
+
+

Arguments

+
x
+

S4 object of class Binalysis

+
+
+

Value

A tibble containing feature summaries

+
-

Examples

-
## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = binneR::detectParameters(files))
-#> binneR v2.6.2 Wed Nov 17 09:52:39 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [3.5S]
-
-featureSummary(analysis)
-#> # A tibble: 2 × 3
-#>   Mode     `Number of bins` `Missing Data (%)`
-#>   <chr>               <int>              <dbl>
-#> 1 Negative             1188               6.48
-#> 2 Positive             1550               9.68
-
+
+

Examples

+
## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = binneR::detectParameters(files))
+#> binneR v2.6.2 Wed Dec 15 23:57:31 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [1.2S]
+
+featureSummary(analysis)
+#> # A tibble: 2 × 3
+#>   Mode     `Number of bins` `Missing Data (%)`
+#>   <chr>               <int>              <dbl>
+#> 1 Negative             1188               6.48
+#> 2 Positive             1550               9.68
+
+
+ -
- +
- - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index c8e4987..c7139f9 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Function reference • metaboMisc - - + + - - -
-
- -
- -
+
- - - - - - - - - - -
-

All functions

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+

All functions

+

addAssignments()

Add molecular formula assignments

+

convertSampleInfo()

Convert sample information to a workflow compatible format

+

detectBatchDiff()

Detect batch/block differences

+

detectMissInjections()

Detect miss injections

+

detectModellingParameters()

Detect modelling parameters

+

detectPretreatmentParameters()

Detect pre-treatment parameters

+

exportData() exportSampleInfo() exportAccurateData() exportPeakInfo() exportModellingMetrics() exportModellingImportance() exportModelling() exportCorrelations() exportAssignments() exportSummarisedAssignments() export()

Export results

+

exportCSV()

Export a csv

+

featureSummary()

Summarise features

+

plotRSD(<Binalysis>) plotRSD(<MetaboProfile>)

Plot relative standard deviation (RSD) distributions

+

preTreatModes()

Pre-treatment of multiple ionisation modes

+

reduce()

Reduce an analysis by removing isotopic, adduct or unknown features

+

sanitiseTable()

Sanitise a data table

+

suitableParallelPlan()

Generate a suitable parallel processing plan

- +
+
-
- +
- - + + diff --git a/docs/reference/plotRSD.html b/docs/reference/plotRSD.html index 31e0627..18ca4c3 100644 --- a/docs/reference/plotRSD.html +++ b/docs/reference/plotRSD.html @@ -1,67 +1,12 @@ - - - - - - - -Plot relative standard deviation (RSD) distributions — plotRSD,Binalysis-method • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot relative standard deviation (RSD) distributions — plotRSD,Binalysis-method • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,88 +52,83 @@

Plot relative standard deviation (RSD) distributions

Plot RSD distributions of processed data.

-
# S4 method for Binalysis
-plotRSD(analysis, cls = "class")
-
-# S4 method for MetaboProfile
-plotRSD(analysis, cls = "class")
+
+
# S4 method for Binalysis
+plotRSD(analysis, cls = "class")
 
-    

Arguments

- - - - - - - - - - -
analysis

S4 object of class Binalysis or MetaboProfile

cls

info column to use for class labels.

- -

Value

+# S4 method for MetaboProfile +plotRSD(analysis, cls = "class")
+
+
+

Arguments

+
analysis
+

S4 object of class Binalysis or MetaboProfile

+
cls
+

info column to use for class labels.

+
+
+

Value

A list of plots of RSD distributions

+
-

Examples

-
## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = binneR::detectParameters(files))
-#> binneR v2.6.2 Wed Nov 17 09:52:44 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [3S]
-
-## Plot RSD distributions
-plotRSD(analysis)
-#> $n
-
-#> 
-#> $p
-
-#> 
-
+
+

Examples

+
## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = binneR::detectParameters(files))
+#> binneR v2.6.2 Wed Dec 15 23:57:33 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [1.2S]
+
+## Plot RSD distributions
+plotRSD(analysis)
+#> $n
+
+#> 
+#> $p
+
+#> 
+
+
+
-
- +
- - + + diff --git a/docs/reference/preTreatModes.html b/docs/reference/preTreatModes.html index c5ebb1a..5904e30 100644 --- a/docs/reference/preTreatModes.html +++ b/docs/reference/preTreatModes.html @@ -1,67 +1,12 @@ - - - - - - - -Pre-treatment of multiple ionisation modes — preTreatModes • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Pre-treatment of multiple ionisation modes — preTreatModes • metaboMisc - - + + - - -
-
- -
- -
+
@@ -120,139 +52,132 @@

Pre-treatment of multiple ionisation modes

Pre-treat both positive and negative ionisation modes for Binalysis and MetaboProfile classes.

-
preTreatModes(processed_data, parameters, verbose = TRUE)
-
-# S4 method for Binalysis
-preTreatModes(processed_data, parameters, verbose = TRUE)
+    
+
preTreatModes(processed_data, parameters, verbose = TRUE)
 
-# S4 method for MetaboProfile
-preTreatModes(processed_data, parameters, verbose = TRUE)
+# S4 method for Binalysis +preTreatModes(processed_data, parameters, verbose = TRUE) -

Arguments

- - - - - - - - - - - - - - -
processed_data

S4 object of class Binalysis or MetaboProfile

parameters

object of class AnalysisParameters containing pre-treatment parameters

verbose

console output

- -

Value

+# S4 method for MetaboProfile +preTreatModes(processed_data, parameters, verbose = TRUE)
+
+
+

Arguments

+
processed_data
+

S4 object of class Binalysis or MetaboProfile

+
parameters
+

object of class AnalysisParameters containing pre-treatment parameters

+
verbose
+

console output

+
+
+

Value

S4 object of class Analysis

+
-

Examples

-
library(metabolyseR)
-#> 
-#> Attaching package: ‘metabolyseR’
-#> The following object is masked from ‘package:stats’:
-#> 
-#>     anova
-#> The following objects are masked from ‘package:base’:
-#> 
-#>     raw, split
-
-## Retrieve file paths and sample information for example data
-files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
-
-info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
-
-## Detect spectral binning parameters
-bp <- binneR::detectParameters(files)
-
-## Perform spectral binning
-analysis <- binneR::binneRlyse(files, 
-                               info, 
-                               parameters = bp)
-#> binneR v2.6.2 Wed Nov 17 09:52:51 2021
-#> ________________________________________________________________________________
-#> Scans: 5:14 
-#> ________________________________________________________________________________
-#> Reading raw data
-#> Gathering bins
-#> Removing single scan events
-#> Averaging intensities across scans
-#> Calculating bin metrics
-#> Calculating accurate m/z
-#> Building intensity matrix
-#> Gathering file headers
-#> 
-#> Completed! [2.5S]
-
-## Declare pre-treatment parameters
-pre_treatment_parameters <- analysisParameters('pre-treatment')
-parameters(pre_treatment_parameters,
-                        'pre-treatment') <- preTreatmentParameters(
- list(
-   occupancyFilter = 'maximum',
-   impute = 'all',
-   transform = 'TICnorm'
- )
-)
-changeParameter(pre_treatment_parameters,'parallel') <- 'no'
-
-## Perform pre-treatment
-pre_treated_data <- preTreatModes(analysis,
-                                  pre_treatment_parameters)
-#> 
-#> metabolyseR v0.14.5 Wed Nov 17 09:52:53 2021
-#> ________________________________________________________________________________
-#> Parameters:
-#> pre-treatment
-#> 	occupancyFilter
-#> 		maximum
-#> 			cls = class
-#> 			occupancy = 2/3
-#> 	impute
-#> 		all
-#> 			occupancy = 2/3
-#> 			parallel = no
-#> 			seed = 1234
-#> 	transform
-#> 		TICnorm
-#> 
-#> ________________________________________________________________________________
-#> 
-#> Negative modeNegative mode 		 [1.1S]
-#> Positive modePositive mode 		 [0.9S]
-#> ________________________________________________________________________________
-#> 
-#> Complete! [2.1S]
-#> 
-
+
+

Examples

+
library(metabolyseR)
+#> 
+#> Attaching package: ‘metabolyseR’
+#> The following object is masked from ‘package:stats’:
+#> 
+#>     anova
+#> The following objects are masked from ‘package:base’:
+#> 
+#>     raw, split
+
+## Retrieve file paths and sample information for example data
+files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]
+
+info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]
+
+## Detect spectral binning parameters
+bp <- binneR::detectParameters(files)
+
+## Perform spectral binning
+analysis <- binneR::binneRlyse(files, 
+                               info, 
+                               parameters = bp)
+#> binneR v2.6.2 Wed Dec 15 23:57:36 2021
+#> ________________________________________________________________________________
+#> Scans: 5:14 
+#> ________________________________________________________________________________
+#> Reading raw data
+#> Gathering bins
+#> Removing single scan events
+#> Averaging intensities across scans
+#> Calculating bin metrics
+#> Calculating accurate m/z
+#> Building intensity matrix
+#> Gathering file headers
+#> 
+#> Completed! [1.1S]
+
+## Declare pre-treatment parameters
+pre_treatment_parameters <- analysisParameters('pre-treatment')
+parameters(pre_treatment_parameters,
+                        'pre-treatment') <- preTreatmentParameters(
+ list(
+   occupancyFilter = 'maximum',
+   impute = 'all',
+   transform = 'TICnorm'
+ )
+)
+changeParameter(pre_treatment_parameters,'parallel') <- 'no'
+
+## Perform pre-treatment
+pre_treated_data <- preTreatModes(analysis,
+                                  pre_treatment_parameters)
+#> 
+#> metabolyseR v0.14.6 Wed Dec 15 23:57:38 2021
+#> ________________________________________________________________________________
+#> Parameters:
+#> pre-treatment
+#> 	occupancyFilter
+#> 		maximum
+#> 			cls = class
+#> 			occupancy = 2/3
+#> 	impute
+#> 		all
+#> 			occupancy = 2/3
+#> 			parallel = no
+#> 			seed = 1234
+#> 	transform
+#> 		TICnorm
+#> 
+#> ________________________________________________________________________________
+#> 
+#> Negative modeNegative mode 		 [0.3S]
+#> Positive modePositive mode 		 [0.3S]
+#> ________________________________________________________________________________
+#> 
+#> Complete! [0.7S]
+#> 
+
+
+ -
- +
- - + + diff --git a/docs/reference/reduce.html b/docs/reference/reduce.html index e22c101..4d70b77 100644 --- a/docs/reference/reduce.html +++ b/docs/reference/reduce.html @@ -1,67 +1,12 @@ - - - - - - - -Reduce an analysis by removing isotopic, adduct or unknown features — reduce • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Reduce an analysis by removing isotopic, adduct or unknown features — reduce • metaboMisc + + - - - - -
-
- -
- -
+
@@ -120,127 +52,119 @@

Reduce an analysis by removing isotopic, adduct or unknown features

Reduce an analysis by removing isotopic, adduct or unknown features.

-
reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE)
-
-# S4 method for Analysis
-reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE)
-
-# S4 method for AnalysisData
-reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
x

S4 class of class Analysis or AnalysisData

isotopes

TRUE/FALSE remove isotopic features.

adducts

TRUE/FALSE remove multiple adduct features.

unknowns

TRUE/FALSE remove unassigned features.

- -

Value

+
+
reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE)
 
-    

S4 object of class Analysis or AnalysisData with features reduced

-

Details

+# S4 method for Analysis +reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE) + +# S4 method for AnalysisData +reduce(x, isotopes = TRUE, adducts = TRUE, unknowns = FALSE)
+
+
+

Arguments

+
x
+

S4 class of class Analysis or AnalysisData

+
isotopes
+

TRUE/FALSE remove isotopic features.

+
adducts
+

TRUE/FALSE remove multiple adduct features.

+
unknowns
+

TRUE/FALSE remove unassigned features.

+
+
+

Value

+

S4 object of class Analysis or AnalysisData with features reduced

+
+
+

Details

Isotope and adduct features are filtered based on the maximum intensity peak for each molecular formulas.

+
-

Examples

-
library(MFassign)
-#> Loading required package: ggraph
-#> Loading required package: ggplot2
-
-## Assign molecular formulas
-p <- assignmentParameters('FIE')
-
-assignment <- assignMFs(peakData,p)
-#> 
-#> MFassign v0.7.10 Wed Nov 17 09:52:56 2021
-#> ________________________________________________________________________________
-#> Assignment Parameters: 
-#> 
-#> 	 Technique:		 FIE 
-#> 	 Max M:			 1000 
-#> 	 Max MF score:		 5 
-#> 	 PPM threshold:		 5 
-#> 	 Relationship limit:	 0.001 
-#> 
-#> 	 Adducts: 
-#> 	 n: [M-H]1-, [M+Cl]1-, [M+K-2H]1-, [M-2H]2-, [M+Cl37]1-, [2M-H]1-
-#> 	 p: [M+H]1+, [M+K]1+, [M+Na]1+, [M+K41]1+, [M+NH4]1+, [M+2H]2+, [2M+H]1+ 
-#> 	 Isotopes: 13C, 18O, 13C2 
-#> 	 Transformations: M - [O] + [NH2], M - [OH] + [NH2], M + [H2], M - [H2] + [O], M - [H] + [CH3], M - [H] + [NH2], M - [H] + [OH], M + [H2O], M - [H3] + [H2O], M - [H] + [CHO2], M - [H] + [SO3], M - [H] + [PO3H2]
-#> ________________________________________________________________________________
-#> No. m/z:	9
-#> Calculating correlations 
-#> Calculating correlations 	 [24 correlations] [0.1S]
-#> Filtering correlations 
-#> Filtering correlations 		 [24 correlations] [0S]
-#> Preparing correlations 
-#> Preparing correlations 		 [0S]
-#> Calculating relationships 
-#> Calculating relationships 	 [12.4S]
-#> Adduct & isotope assignment 
-#> Adduct & isotope assignment 	 [15.7S]
-#> Transformation assignment iteration 1 
-#> Transformation assignment iteration 1 	 [0S]
-#> ________________________________________________________________________________
-#> 
-#> Complete! [28.2S]
-
-## Retrieve assigned data
-assigned_data <- metabolyseR::analysisData(
- assignedData(assignment),
- tibble::tibble(sample = seq_len(nrow(peakData)))
- )
-
-reduced_data <- metaboMisc::reduce(assigned_data)
-
-reduced_data
-#> 
-#> AnalysisData object containing:
-#> 
-#> Samples: 60 
-#> Features: 1 
-#> Info: 1 
-#> 
-
+
+

Examples

+
library(MFassign)
+#> Loading required package: ggraph
+#> Loading required package: ggplot2
+
+## Assign molecular formulas
+p <- assignmentParameters('FIE')
+
+assignment <- assignMFs(peakData,p)
+#> 
+#> MFassign v0.7.10 Wed Dec 15 23:57:39 2021
+#> ________________________________________________________________________________
+#> Assignment Parameters: 
+#> 
+#> 	 Technique:		 FIE 
+#> 	 Max M:			 1000 
+#> 	 Max MF score:		 5 
+#> 	 PPM threshold:		 5 
+#> 	 Relationship limit:	 0.001 
+#> 
+#> 	 Adducts: 
+#> 	 n: [M-H]1-, [M+Cl]1-, [M+K-2H]1-, [M-2H]2-, [M+Cl37]1-, [2M-H]1-
+#> 	 p: [M+H]1+, [M+K]1+, [M+Na]1+, [M+K41]1+, [M+NH4]1+, [M+2H]2+, [2M+H]1+ 
+#> 	 Isotopes: 13C, 18O, 13C2 
+#> 	 Transformations: M - [O] + [NH2], M - [OH] + [NH2], M + [H2], M - [H2] + [O], M - [H] + [CH3], M - [H] + [NH2], M - [H] + [OH], M + [H2O], M - [H3] + [H2O], M - [H] + [CHO2], M - [H] + [SO3], M - [H] + [PO3H2]
+#> ________________________________________________________________________________
+#> No. m/z:	9
+#> Calculating correlations 
+#> Calculating correlations 	 [24 correlations] [0S]
+#> Filtering correlations 
+#> Filtering correlations 		 [24 correlations] [0S]
+#> Preparing correlations 
+#> Preparing correlations 		 [0S]
+#> Calculating relationships 
+#> Calculating relationships 	 [6.4S]
+#> Adduct & isotope assignment 
+#> Adduct & isotope assignment 	 [7.4S]
+#> Transformation assignment iteration 1 
+#> Transformation assignment iteration 1 	 [0S]
+#> ________________________________________________________________________________
+#> 
+#> Complete! [13.9S]
+
+## Retrieve assigned data
+assigned_data <- metabolyseR::analysisData(
+ assignedData(assignment),
+ tibble::tibble(sample = seq_len(nrow(peakData)))
+ )
+
+reduced_data <- metaboMisc::reduce(assigned_data)
+
+reduced_data
+#> 
+#> AnalysisData object containing:
+#> 
+#> Samples: 60 
+#> Features: 1 
+#> Info: 1 
+#> 
+
+
+
-
- +
- - + + diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index 9333b1b..4115ccb 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -1,72 +1,19 @@ - - - - - - - -Objects exported from other packages — reexports • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Objects exported from other packages — reexports • metaboMisc + magrittr +%&gt;% - - - - - - - - + + - - - -
-
- -
- -
+

These objects are imported from other packages. Follow the links below to see their documentation.

-
-
magrittr

%>%

+
magrittr
+

%>%

-
-
+
+
-
- +
- - + + diff --git a/docs/reference/sanitiseTable.html b/docs/reference/sanitiseTable.html index 187209d..2d6ea21 100644 --- a/docs/reference/sanitiseTable.html +++ b/docs/reference/sanitiseTable.html @@ -1,67 +1,12 @@ - - - - - - - -Sanitise a data table — sanitiseTable • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Sanitise a data table — sanitiseTable • metaboMisc - - + + - - -
-
- -
- -
+
-

Sanitise a data table by restricting the number of rows and rounding numeric columns.

+

Sanitise a data table by restricting the number of rows or characters and rounding numeric columns.

+
+ +
+
sanitiseTable(x, maxRows = 5000, sigFig = 3, maxCharacters = 100)
-
sanitiseTable(x, maxRows = 5000, sigFig = 3, maxCharacters = 100)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
x

A tibble or data.frame containing the data to be sanitised

maxRows

Maximum number of rows with which to restrict the table

sigFig

Significant figures with which to round numeric columns

maxCharacters

Maximum number of characters allowed in a string before it is truncated

- - -

Examples

-
sanitiseTable(iris,maxRows = 10,sigFig = 1)
-#> Number of rows in table restricted to 10.
-#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
-#> 1             5           4            1         0.2  setosa
-#> 2             5           3            1         0.2  setosa
-#> 3             5           3            1         0.2  setosa
-#> 4             5           3            2         0.2  setosa
-#> 5             5           4            1         0.2  setosa
-#> 6             5           4            2         0.4  setosa
-#> 7             5           3            1         0.3  setosa
-#> 8             5           3            2         0.2  setosa
-#> 9             4           3            1         0.2  setosa
-#> 10            5           3            2         0.1  setosa
-
+
+

Arguments

+
x
+

A tibble or data.frame containing the data to be sanitised

+
maxRows
+

Maximum number of rows with which to restrict the table

+
sigFig
+

Significant figures with which to round numeric columns

+
maxCharacters
+

Maximum number of characters allowed in a string before it is truncated

+
+ +
+

Examples

+
sanitiseTable(iris,maxRows = 10,sigFig = 1)
+#> Number of rows in table restricted to 10.
+#> # A tibble: 10 × 5
+#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
+#>           <dbl>       <dbl>        <dbl>       <dbl> <fct>  
+#>  1            5           4            1         0.2 setosa 
+#>  2            5           3            1         0.2 setosa 
+#>  3            5           3            1         0.2 setosa 
+#>  4            5           3            2         0.2 setosa 
+#>  5            5           4            1         0.2 setosa 
+#>  6            5           4            2         0.4 setosa 
+#>  7            5           3            1         0.3 setosa 
+#>  8            5           3            2         0.2 setosa 
+#>  9            4           3            1         0.2 setosa 
+#> 10            5           3            2         0.1 setosa 
+
+
+
-
- +
- - + + diff --git a/docs/reference/suitableParallelPlan.html b/docs/reference/suitableParallelPlan.html index cb495a5..44ec75c 100644 --- a/docs/reference/suitableParallelPlan.html +++ b/docs/reference/suitableParallelPlan.html @@ -1,67 +1,12 @@ - - - - - - - -Generate a suitable parallel processing plan — suitableParallelPlan • metaboMisc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Generate a suitable parallel processing plan — suitableParallelPlan • metaboMisc - - + + - - -
-
- -
- -
+
-

Generate a suitable parallel processing future plan for your session. See ?future::plan for more details on future plans.

+

Generate a suitable parallel processing future plan for your session. See ?future::plan for more details on future plans.

-
suitableParallelPlan()
- +
+
suitableParallelPlan()
+
-

Examples

-
if (FALSE) {
-suitableParallelPlan()
-}
-
+
+

Examples

+
if (FALSE) {
+suitableParallelPlan()
+}
+
+
+
-
- +
- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index ce234cd..9bbc848 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,51 +1,69 @@ - https://jasenfinch.github.io/metaboMisc//index.html + https://jasenfinch.github.io/metaboMisc/404.html - https://jasenfinch.github.io/metaboMisc//reference/addAssignments.html + https://jasenfinch.github.io/metaboMisc/authors.html - https://jasenfinch.github.io/metaboMisc//reference/convertSampleInfo.html + https://jasenfinch.github.io/metaboMisc/index.html - https://jasenfinch.github.io/metaboMisc//reference/detectBatchDiff.html + https://jasenfinch.github.io/metaboMisc/news/index.html - https://jasenfinch.github.io/metaboMisc//reference/detectMissInjections.html + https://jasenfinch.github.io/metaboMisc/reference/addAssignments.html - https://jasenfinch.github.io/metaboMisc//reference/detectModellingParameters.html + https://jasenfinch.github.io/metaboMisc/reference/convertSampleInfo.html - https://jasenfinch.github.io/metaboMisc//reference/detectPretreatmentParameters.html + https://jasenfinch.github.io/metaboMisc/reference/detectBatchDiff.html - https://jasenfinch.github.io/metaboMisc//reference/export.html + https://jasenfinch.github.io/metaboMisc/reference/detectMissInjections.html - https://jasenfinch.github.io/metaboMisc//reference/exportCSV.html + https://jasenfinch.github.io/metaboMisc/reference/detectModellingParameters.html - https://jasenfinch.github.io/metaboMisc//reference/featureSummary.html + https://jasenfinch.github.io/metaboMisc/reference/detectPretreatmentParameters.html - https://jasenfinch.github.io/metaboMisc//reference/plotRSD.html + https://jasenfinch.github.io/metaboMisc/reference/export.html - https://jasenfinch.github.io/metaboMisc//reference/preTreatModes.html + https://jasenfinch.github.io/metaboMisc/reference/exportCSV.html - https://jasenfinch.github.io/metaboMisc//reference/reduce.html + https://jasenfinch.github.io/metaboMisc/reference/featureSummary.html - https://jasenfinch.github.io/metaboMisc//reference/reexports.html + https://jasenfinch.github.io/metaboMisc/reference/filterCorrelations.html - https://jasenfinch.github.io/metaboMisc//reference/sanitiseTable.html + https://jasenfinch.github.io/metaboMisc/reference/index.html - https://jasenfinch.github.io/metaboMisc//reference/suitableParallelPlan.html + https://jasenfinch.github.io/metaboMisc/reference/plotRSD.html + + + https://jasenfinch.github.io/metaboMisc/reference/preTreatModes.html + + + https://jasenfinch.github.io/metaboMisc/reference/reduce.html + + + https://jasenfinch.github.io/metaboMisc/reference/reexports.html + + + https://jasenfinch.github.io/metaboMisc/reference/sanitiseTable.html + + + https://jasenfinch.github.io/metaboMisc/reference/suitableParallelPlan.html + + + https://jasenfinch.github.io/metaboMisc/reference/theme_neat.html From 9b34745bbeb891789fdbcf6d68b931a04c9aef32 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 16 Dec 2021 00:53:36 +0000 Subject: [PATCH 10/16] detectPretreatmentParameters now detects the presence of QC samples --- R/detect.R | 46 ++++++++++++++++++++++++----- man/detectPretreatmentParameters.Rd | 10 +++++-- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/R/detect.R b/R/detect.R index 6964b2f..aad8ba4 100644 --- a/R/detect.R +++ b/R/detect.R @@ -178,8 +178,8 @@ setMethod('detectBatchDiff',signature = "MetaboProfile", is.na() %>% any()) { names(TICdat) <- replace(names(TICdat), - is.na(names(TICdat)), - 'NA') + is.na(names(TICdat)), + 'NA') } TICdat <- TICdat %>% @@ -258,6 +258,8 @@ batchDiff <- function(TICdat,pthresh = 0.05){ #' @rdname detectPretreatmentParameters #' @description Detect pre-treatment parameters for `Binalysis` or `MetaboProfile` class objects. #' @param x S4 object of class `Binalysis`, `MetaboProfile` or `AnalysisData` +#' @param cls the name of the sample information table column containing the sample class information +#' @param QCidx QC sample class label #' @return S4 object of class `AnalysisParameters` #' @examples #' ## Retreive example file paths and sample information @@ -279,22 +281,48 @@ batchDiff <- function(TICdat,pthresh = 0.05){ #' pp #' @export -setGeneric('detectPretreatmentParameters',function(x){ +setGeneric('detectPretreatmentParameters',function(x, + cls = 'class', + QCidx = 'QC'){ standardGeneric('detectPretreatmentParameters') }) #' @rdname detectPretreatmentParameters setMethod('detectPretreatmentParameters',signature = 'Binalysis', - function(x){ - detectPretreatment(x) + function(x,cls = 'class',QCidx = 'QC'){ + pp <- detectPretreatment(x) + + sample_info <- binneR::sampleInfo(x) + + if (!detectQC(sample_info,cls,QCidx)){ + parameters(pp,'pre-treatment')$QC <- NULL + } else { + changeParameter(pp,'QCidx','pre-treatment') <- QCidx + } + + changeParameter(pp,'cls','pre-treatment') <- cls + + return(pp) }) #' @rdname detectPretreatmentParameters setMethod('detectPretreatmentParameters',signature = 'MetaboProfile', - function(x){ - detectPretreatment(x) + function(x,cls = 'class',QCidx = 'QC'){ + pp <- detectPretreatment(x) + + sample_info <- profilePro::sampleInfo(x) + + if (!detectQC(sample_info,cls,QCidx)){ + parameters(pp,'pre-treatment')$QC <- NULL + } else { + changeParameter(pp,'QCidx','pre-treatment') <- QCidx + } + + changeParameter(pp,'cls','pre-treatment') <- cls + + return(pp) }) #' @importFrom metabolyseR parameters<- parameters @@ -330,6 +358,10 @@ detectPretreatment <- function(x){ return(pre_treat_params) } +detectQC <- function(sample_info,cls,QCidx){ + any(str_detect(sample_info[[cls]],'QC')) +} + #' Detect modelling parameters #' @rdname detectModellingParameters #' @description Detect modelling parameters for `Binalysis`, `MetaboProfile` or `Analysis` S4 classes. diff --git a/man/detectPretreatmentParameters.Rd b/man/detectPretreatmentParameters.Rd index eccd116..5e7a1d2 100644 --- a/man/detectPretreatmentParameters.Rd +++ b/man/detectPretreatmentParameters.Rd @@ -6,14 +6,18 @@ \alias{detectPretreatmentParameters,MetaboProfile-method} \title{Detect pre-treatment parameters} \usage{ -detectPretreatmentParameters(x) +detectPretreatmentParameters(x, cls = "class", QCidx = "QC") -\S4method{detectPretreatmentParameters}{Binalysis}(x) +\S4method{detectPretreatmentParameters}{Binalysis}(x, cls = "class", QCidx = "QC") -\S4method{detectPretreatmentParameters}{MetaboProfile}(x) +\S4method{detectPretreatmentParameters}{MetaboProfile}(x, cls = "class", QCidx = "QC") } \arguments{ \item{x}{S4 object of class \code{Binalysis}, \code{MetaboProfile} or \code{AnalysisData}} + +\item{cls}{the name of the sample information table column containing the sample class information} + +\item{QCidx}{QC sample class label} } \value{ S4 object of class \code{AnalysisParameters} From 27aabfe111a4f458c019dd4262d07cb40ed7a95c Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 16 Dec 2021 00:55:32 +0000 Subject: [PATCH 11/16] detectBatchDiff() example fix --- R/detect.R | 2 +- man/detectBatchDiff.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/detect.R b/R/detect.R index aad8ba4..96e4801 100644 --- a/R/detect.R +++ b/R/detect.R @@ -109,7 +109,7 @@ missInject <- function(TICdat,idx){ #' @details Analysis of Variance (ANOVA) is used to detect differences in total ion count (TIC) averages between batches/blocks. #' @examples #' ## Retrieve file paths and sample information for example data -#' files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2] +#' files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes',ask = FALSE)[1:2] #' #' info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,] #' diff --git a/man/detectBatchDiff.Rd b/man/detectBatchDiff.Rd index 2e83998..a27ea62 100644 --- a/man/detectBatchDiff.Rd +++ b/man/detectBatchDiff.Rd @@ -30,7 +30,7 @@ Analysis of Variance (ANOVA) is used to detect differences in total ion count (T } \examples{ ## Retrieve file paths and sample information for example data -files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2] +files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes',ask = FALSE)[1:2] info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,] From 19e0ed697e73d006632b91d989d53fc56a3258eb Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 16 Dec 2021 00:59:29 +0000 Subject: [PATCH 12/16] updated package NEWS --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index c248303..a499960 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ * Enabled unit tests for methods for the `MetaboProfile` class. +* `detectPretreatmentParameters()` now detects the presence of QC samples. + # metaboMisc 0.5.8 * Numbers of characters in strings are now limited by `sanitiseTable()`. From 4446b494f89060e9c8beba499b9936d52ec26516 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 16 Dec 2021 01:03:42 +0000 Subject: [PATCH 13/16] added missing function import --- NAMESPACE | 1 + R/detect.R | 1 + 2 files changed, 2 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 0804971..e2cb3ea 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -66,6 +66,7 @@ importFrom(metabolyseR,"raw<-") importFrom(metabolyseR,analysisData) importFrom(metabolyseR,analysisParameters) importFrom(metabolyseR,analysisResults) +importFrom(metabolyseR,changeParameter) importFrom(metabolyseR,dat) importFrom(metabolyseR,importance) importFrom(metabolyseR,metabolyse) diff --git a/R/detect.R b/R/detect.R index 96e4801..2cd027b 100644 --- a/R/detect.R +++ b/R/detect.R @@ -288,6 +288,7 @@ setGeneric('detectPretreatmentParameters',function(x, }) #' @rdname detectPretreatmentParameters +#' @importFrom metabolyseR changeParameter setMethod('detectPretreatmentParameters',signature = 'Binalysis', function(x,cls = 'class',QCidx = 'QC'){ From a87635ef0b026c7812e181c622954ae06f04b833 Mon Sep 17 00:00:00 2001 From: jasenfinch Date: Thu, 16 Dec 2021 13:31:44 +0000 Subject: [PATCH 14/16] updated pkgdown site --- docs/news/index.html | 1 + docs/pkgdown.yml | 2 +- docs/reference/detectBatchDiff.html | 6 ++--- docs/reference/detectMissInjections.html | 4 ++-- docs/reference/detectModellingParameters.html | 2 +- .../detectPretreatmentParameters.html | 14 +++++++----- docs/reference/featureSummary.html | 4 ++-- docs/reference/plotRSD.html | 2 +- docs/reference/preTreatModes.html | 8 +++---- docs/reference/reduce.html | 8 +++---- docs/reference/sanitiseTable.html | 22 +++++++++---------- 11 files changed, 38 insertions(+), 35 deletions(-) diff --git a/docs/news/index.html b/docs/news/index.html index 5cd3bb0..b8be787 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -53,6 +53,7 @@