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 diff --git a/NAMESPACE b/NAMESPACE index 0804971..7ec5ce9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -59,6 +59,7 @@ importFrom(ggplot2,theme) importFrom(lubridate,seconds_to_period) importFrom(magrittr,"%>%") importFrom(magrittr,set_names) +importFrom(metabolyseR,"changeParameter<-") importFrom(metabolyseR,"dat<-") importFrom(metabolyseR,"parameters<-") importFrom(metabolyseR,"preTreated<-") diff --git a/NEWS.md b/NEWS.md index afb4bb1..a499960 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,16 @@ -# 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. + +* `detectPretreatmentParameters()` now detects the presence of QC samples. + +# metaboMisc 0.5.8 * Numbers of characters in strings are now limited by `sanitiseTable()`. diff --git a/R/detect.R b/R/detect.R index 4ad2530..1afa440 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) }) @@ -102,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,] #' @@ -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) }) @@ -242,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 @@ -263,22 +281,49 @@ batchDiff <- function(TICdat,pthresh = 0.05){ #' pp #' @export -setGeneric('detectPretreatmentParameters',function(x){ +setGeneric('detectPretreatmentParameters',function(x, + cls = 'class', + QCidx = 'QC'){ standardGeneric('detectPretreatmentParameters') }) #' @rdname detectPretreatmentParameters +#' @importFrom metabolyseR changeParameter<- 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 @@ -314,6 +359,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. @@ -366,17 +415,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 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) 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() %>% 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 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..b8be787 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.

  • +
    + +
    +
    + +
    +
    + +
    • 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..00150f5 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-16T13:29Z 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..6536eed 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',ask = FALSE)[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 Thu Dec 16 13:30:27 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.8S]
+
+## 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..9d8fe5b 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 Thu Dec 16 13:30:30 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]
+
+## 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..51f6a69 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 Thu Dec 16 13:30: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.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..7cf9fd1 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,119 @@

Detect pre-treatment parameters

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

-
detectPretreatmentParameters(x)
-
-# S4 method for Binalysis
-detectPretreatmentParameters(x)
+    
+
detectPretreatmentParameters(x, cls = "class", QCidx = "QC")
 
-# S4 method for MetaboProfile
-detectPretreatmentParameters(x)
+# S4 method for Binalysis +detectPretreatmentParameters(x, cls = "class", QCidx = "QC") -

Arguments

- - - - - - -
x

S4 object of class Binalysis, MetaboProfile or AnalysisData

- -

Value

+# S4 method for MetaboProfile +detectPretreatmentParameters(x, cls = "class", QCidx = "QC")
+
+
+

Arguments

+
x
+

S4 object of class Binalysis, MetaboProfile or AnalysisData

+
cls
+

the name of the sample information table column containing the sample class information

+
QCidx
+

QC sample class label

+
+
+

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 Thu Dec 16 13:30: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! [1.6S]
+
+## 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..b86aae5 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 Thu Dec 16 13:30: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! [1.3S]
+
+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..82591f4 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 Thu Dec 16 13:30:42 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..efb2ef6 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 Thu Dec 16 13:30:46 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]
+
+## 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 Thu Dec 16 13:30:47 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.4S]
+#> ________________________________________________________________________________
+#> 
+#> Complete! [0.7S]
+#> 
+
+
+ - - - + + diff --git a/docs/reference/reduce.html b/docs/reference/reduce.html index e22c101..3d8f079 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 Thu Dec 16 13:30:49 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 	 [4.9S]
+#> Adduct & isotope assignment 
+#> Adduct & isotope assignment 	 [8.3S]
+#> Transformation assignment iteration 1 
+#> Transformation assignment iteration 1 	 [0S]
+#> ________________________________________________________________________________
+#> 
+#> Complete! [13.4S]
+
+## 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..5233e89 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.
+#>    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
+
+
+
-
- - + + 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 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,] 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} 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) diff --git a/tests/testthat.R b/tests/testthat.R index 0d637f4..b034f91 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') +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...'))) })