From 6dd58438f158a0348a05826715664d12f054e5eb Mon Sep 17 00:00:00 2001 From: hechth Date: Tue, 12 Dec 2023 14:29:47 +0100 Subject: [PATCH 1/4] removed duplicated SNplot function and updated NAMESPACE --- MFAssignR/DESCRIPTION | 56 ++--- MFAssignR/NAMESPACE | 33 ++- MFAssignR/R/HistNoise.R | 41 ---- MFAssignR/R/KMDNoise.R | 14 +- MFAssignR/man/MFAssignCHO_RMD.Rd | 175 --------------- MFAssignR/man/MFAssign_RMD.Rd | 263 ----------------------- MFAssignR/tests/testthat/test-KMDNoise.R | 8 + 7 files changed, 73 insertions(+), 517 deletions(-) delete mode 100644 MFAssignR/man/MFAssignCHO_RMD.Rd delete mode 100644 MFAssignR/man/MFAssign_RMD.Rd diff --git a/MFAssignR/DESCRIPTION b/MFAssignR/DESCRIPTION index 18c8d54..0778821 100644 --- a/MFAssignR/DESCRIPTION +++ b/MFAssignR/DESCRIPTION @@ -1,28 +1,28 @@ -Package: MFAssignR -Type: Package -Title: An R Package for Data Preparation and Molecular Formula Assignment -Version: 1.0.2 -Author: Simeon Schum, Lynn Mazzoleni, Laura Brown -Maintainer: Simeon Schum, -Description: This package contains functions that can estimate - the signal-to-noise for raw mass spectra, provide - preliminary identification of potential isotopic masses, - recalibrate mass spectral data, and assign molecular formulas - to exact mass measurements from ultrahigh resolution mass spectral - data using either Orbitrap MS or FT-ICR MS. The core algorithm for - formula assignment is the CHOFIT algorithm developed by - Green and Perdue, Anal. Chem. (2015). This algorithm has - been expanded on, using formula extension to increase its - performance and data quality. -License: GNU GPL-2 -Encoding: UTF-8 -LazyData: true -Depends: R (>= 3.4.1) -Imports: dplyr (>= 0.7.6), - tidyr (>= 0.8.1), - ggplot2 (>= 3.0.0), - colorRamps (>= 2.3) -RoxygenNote: 7.1.1 -Suggests: knitr, - rmarkdown -VignetteBuilder: knitr +Package: MFAssignR +Type: Package +Title: An R Package for Data Preparation and Molecular Formula Assignment +Version: 1.0.2 +Author: Simeon Schum, Lynn Mazzoleni, Laura Brown +Maintainer: Simeon Schum, +Description: This package contains functions that can estimate + the signal-to-noise for raw mass spectra, provide + preliminary identification of potential isotopic masses, + recalibrate mass spectral data, and assign molecular formulas + to exact mass measurements from ultrahigh resolution mass spectral + data using either Orbitrap MS or FT-ICR MS. The core algorithm for + formula assignment is the CHOFIT algorithm developed by + Green and Perdue, Anal. Chem. (2015). This algorithm has + been expanded on, using formula extension to increase its + performance and data quality. +License: GNU GPL-2 +Encoding: UTF-8 +LazyData: true +Depends: R (>= 3.4.1) +Imports: dplyr (>= 0.7.6), + tidyr (>= 0.8.1), + ggplot2 (>= 3.0.0), + colorRamps (>= 2.3) +RoxygenNote: 7.2.3 +Suggests: knitr, + rmarkdown +VignetteBuilder: knitr diff --git a/MFAssignR/NAMESPACE b/MFAssignR/NAMESPACE index 40ea8e2..840d51d 100644 --- a/MFAssignR/NAMESPACE +++ b/MFAssignR/NAMESPACE @@ -1 +1,32 @@ -exportPattern("^[[:alpha:]]+") +# Generated by roxygen2: do not edit by hand + +export(CompFactorToInt) +export(CompFactorToInt2) +export(CompIntToFactor) +export(CompIntToFactor2) +export(EM) +export(EM2) +export(Even) +export(FindCoreFormulae2) +export(FindCoreFormulae2_Halo) +export(HighMoles) +export(HighMoles2) +export(HistNoise) +export(IsoFiltR) +export(KMDNoise) +export(LowMoles) +export(LowMoles2) +export(MFAssign) +export(MFAssignCHO) +export(MaxMoles) +export(MinMoles) +export(NM) +export(NM2) +export(Recal) +export(RecalList) +export(SNplot) +export(Valence) +export(Valence2) +export(ValidFormula) +export(ValidFormula2) +import(ggplot2) diff --git a/MFAssignR/R/HistNoise.R b/MFAssignR/R/HistNoise.R index 8794de3..ca6d49f 100644 --- a/MFAssignR/R/HistNoise.R +++ b/MFAssignR/R/HistNoise.R @@ -76,44 +76,3 @@ Freq2 <- ggplot2::ggplot(df, ggplot2::aes(x = log(intensity))) + Output <- list(Noise = SNout, Hist = Freq2) Output } -########################################## -#'Plot of Mass Spectrum with highlighted S/N cut -#' -#'SNplot which plots the mass spectrum with the S/N cut denoted by different colors -#'for the mass spectrum peaks. This is useful for a qualitative look at the effectiveness -#'of the S/N cut being used. -#' -#'@param df - dataframe of intensity and ion mass, column 1 should be intensity, column 2 should be mass -#'@param cut - numeric value of the intensity cut value being investigated -#'@param mass - numeric value setting a centerpoint to look at the mass spectrum -#'@param window.x - numeric value setting the +/- range around the mass centerpoint, default is 0.5 -#'@param window.y - numeric value setting the y axis value for the plot, determined by multiplying the cut by this value -#' -#' @return S/N cut colored mass spectrum -#' -#' Zoomed Mass spectrum which shows where the cut is being applied -#' -#' @examples -#' SNplot(df, cut = 1000, mass = 300, window.x = 1, window.y = 10) -#' -#' @export - - - -SNplot <- function(df, cut, mass, window.x = 0.5, window.y = 10){ #plots a data set displaying the SN cut around a specific mass - - df <- df[c(2,1)] - names(df)[2] <- "mass" - names(df)[1] <- "Abundance" - df$Index <- "Bad" - df$Index <- replace(df$Index, df$Abundance > cut, "Good") - SNplot <- ggplot2::ggplot(df, ggplot2::aes_string(x = "mass", xend = "mass", y = 0, yend = "Abundance")) + - ggplot2::geom_segment(ggplot2::aes(color = Index), size = 0.65, alpha = 1) + - ggplot2::geom_hline(yintercept = cut, linetype = "solid", size = 0.1) + - ggplot2::coord_cartesian(xlim = c(mass-window.x, mass+window.x), ylim = c(0, cut*window.y)) - print(SNplot) -} - - - - diff --git a/MFAssignR/R/KMDNoise.R b/MFAssignR/R/KMDNoise.R index 92443f8..db672c8 100644 --- a/MFAssignR/R/KMDNoise.R +++ b/MFAssignR/R/KMDNoise.R @@ -150,21 +150,17 @@ KMDNoise <- function(df, upper.y = 0.2, lower.y = 0.05, upper.x = NA, lower.x = #' #' @examples #' SNplot(df, cut = 1000, mass = 300, window.x = 1, window.y = 10) -#' +#' @import ggplot2 #' @export - - - SNplot <- function(df, cut, mass, window.x = 0.5, window.y = 10) { # plots a data set displaying the SN cut around a specific mass - df <- df[c(2, 1)] names(df)[2] <- "mass" names(df)[1] <- "Abundance" df$Index <- "Bad" df$Index <- replace(df$Index, df$Abundance > cut, "Good") - SNplot <- ggplot2::ggplot(df, ggplot2::aes_string(x = "mass", xend = "mass", y = 0, yend = "Abundance")) + - ggplot2::geom_segment(ggplot2::aes(color = Index), size = 0.65, alpha = 1) + - ggplot2::geom_hline(yintercept = cut, linetype = "solid", size = 0.1) + - ggplot2::coord_cartesian(xlim = c(mass - window.x, mass + window.x), ylim = c(0, cut * window.y)) + SNplot <- ggplot(df, aes_string(x = "mass", xend = "mass", y = 0, yend = "Abundance")) + + geom_segment(aes(color = Index), size = 0.65, alpha = 1) + + geom_hline(yintercept = cut, linetype = "solid", size = 0.1) + + coord_cartesian(xlim = c(mass - window.x, mass + window.x), ylim = c(0, cut * window.y)) print(SNplot) } diff --git a/MFAssignR/man/MFAssignCHO_RMD.Rd b/MFAssignR/man/MFAssignCHO_RMD.Rd deleted file mode 100644 index 4a3bfc0..0000000 --- a/MFAssignR/man/MFAssignCHO_RMD.Rd +++ /dev/null @@ -1,175 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MFAssignCHO_RMD.R -\name{MFAssignCHO_RMD} -\alias{MFAssignCHO_RMD} -\title{Assigns all possible CHO molecular formulae to each row of input data frame} -\usage{ -MFAssignCHO_RMD( - peaks, - isopeaks = "none", - ionMode, - lowMW = 100, - highMW = 1000, - POEx = 0, - NOEx = 0, - Ex = 0, - Mx = 0, - NH4x = 0, - Zx = 1, - Ox = 30, - ppm_err = 3, - SN = 0, - O_Cmin = 0, - O_Cmax = 2.5, - H_Cmin = 0.3, - H_Cmax = 3, - DBEOmin = -13, - DBEOmax = 13, - Omin = 0, - max_def = 0.9, - min_def = 0.5, - HetCut = "off", - NMScut = "on", - DeNovo = 1000, - nLoop = 5, - Ambig = "off", - MSMS = "off" -) -} -\arguments{ -\item{peaks}{data frame, Monoisotopic Masses} - -\item{isopeaks}{data frame, Isotopic Masses. Default is "none"} - -\item{ionMode}{string: ("neg", "pos")} - -\item{lowMW}{numeric: -Sets the lower limit of molecular mass to be assigned. Default is 100.} - -\item{highMW}{numeric: -Sets the upper limit of molecular mass to be assigned. Default is 1000.} - -\item{POEx}{numeric: -If set to 1 and ionMode is positive, positive mode odd electron ions can be assigned. -Default is 0} - -\item{NOEx}{numeric: -If set to 1 and ionMode is negative, negative mode odd electron ions can be assigned. -Default is 0} - -\item{Ex}{numeric: -Sets the amount of Chlorine 37 to be used in assignment. Default is 0.} - -\item{Mx}{numeric: -Sets the amount of Sodium adduct to be used in assignment. Default is 0.} - -\item{NH4x}{numeric: -Sets the amount of Ammonium adduct to be used in assignment. Default is 0.} - -\item{Zx}{numeric: -Sets the amount of charge to be used in assignment. Default is 1.} - -\item{Ox}{numeric: -Ox sets the maximum number of oxygen looked for in the CHOFIT core, it limits the number of loops performed.} - -\item{ppm_err}{numeric: -ppm_err parameter sets the error tolerance (ppm) for formula assignment and polyisotope matching. Default is 3.} - -\item{SN}{numeric: -SN parameter set the signal to noise cut for formula assignment. Default is 0.} - -\item{O_Cmin}{numeric: -O_Cmin parameter sets the minimum allowed oxygen to carbon ratio. Default is 0.} - -\item{O_Cmax}{numeric: -The O_Cmax parameter sets the upper limit for oxygen to carbon ratio. Default is 2.5.} - -\item{H_Cmin}{numeric: -H_Cmin parameter sets lower limit for hydrogen to carbon ratio. Default is 0.1.} - -\item{H_Cmax}{numeric: -H_Cmax parameter sets upper limit for hydrogen to carbon ratio for assigned formulas. -Default is 3.} - -\item{DBEOmin}{numeric: -DBEOmin parameter sets lower limit for DBE minus oxygen QA parameter. Default is -13.} - -\item{DBEOmax}{numeric: -DBEOmax parameter sets upper limit for DBE minus oxygen QA parameter. Default is 13.} - -\item{Omin}{numeric: -Omin parameter sets lower limit for oxygen number in assigned formula. Default is 0.} - -\item{max_def}{numeric: -Value for upper limit of mass defect for using floor() instead of round() for KMD. Default is 0.9} - -\item{min_def}{numeric: -Value for lower limit of mass defect for using floor() instead of round() for KMD. Default is 0.5} - -\item{HetCut}{character: -HetCut turns on or off the high heteroatom QA parameter. Default is "off".} - -\item{NMScut}{character: -NMScut turns on or off the nominal mass series QA parameter. Default is “on”.} - -\item{DeNovo}{numeric: -DeNovo sets the de novo cut point for the data. Default is 1000.} - -\item{nLoop}{numeric: -nLoops sets the number of times the KMD and z* series assignment loops. Default is 5.} - -\item{Ambig}{character: -Turns on or off increased ambiguity for assignments. Default is "off".} - -\item{MSMS}{character: -Turns on or off CH2 KMD prescreening before initial assignment. Default is "off".} -} -\value{ -list(Unambig = Unambig, Ambig = Ambigout, None = unassigned, MSAssign = MZ, - Error = Error, MSgroups = MZgroups, VK = VK) - - Unambig - data frame containing unambiguous assignments - Ambig - data frame containing ambiguous assignments - None - data frame containing unassigned masses - MSAssign - ggplot of mass spectrum highlighting assigned/unassigned - Error - ggplot of the Error vs. m/z - MSgroups - ggplot of mass spectrum colored by molecular group - VK - ggplot of van Krevelen plot, colored by molecular group -} -\description{ -MFAssignCHO() assigns all possible molecular formulae to each -mass in the input file, subject to user constraints on the moles of -C, H, O -} -\details{ -This function operates in the same way as MFAssign() but only assigns -carbon, hydrogen, and oxygen formulas, heteroatoms are not included. -Basic QA steps are included within the function,more detail about -these QA steps can be seen in the vignette and user manual attached to this package. -Additionally, an option to remove ambiguous assignments based on choosing -the formula with the fewest number of heteroatoms (Ohno and Ohno, 2013), and -the CH4 vs O replacement nominal mass series (Koch et al., 2007) is included. -Most of these QA parameters can be adjusted from outside the function. - -Positive mode odd-electron formula assignment is possible using the POEx -parameter. If set to 1 positive mode odd-electron ionized masses can be -assigned. This is only really needed for APCI and APPI ionization modes. -This option is currently unavailable, but will be addressed in a future release. - -The Ox term sets the number of loops performed by the CHOFIT core by defining the -maximum oxygen allowed to be looked for. Three oxygen is equal to one loop due to -the low mass moiety used in CHOFIT (Perdue and Green 2015). The default setting is -30 oxygen, so it is limited to 10 loops. It can be increased if necessary. - -The input dataframe should have two columns, the first column should contain the -relative abundance or intensity for the ion mass and the second column should contain -the ion mass, either positive or negative mode. The function can also handle an additional -input dataframe containing the masses identified as istopic by the IsoFiltR function. The -outputs of that function can be directly put into this function as peaks and isopeaks, -doing so will allow likely 13C isotope masses to be match to assigned monoisotopic masses. -The inclusion of an isotopic mass list is not required, however. -} -\examples{ -MFAssignCHO(peaks = Mono_df, isopeaks = Iso_df, "neg", lowMW = 200, highMW = 700) -MFAssignCHO(peaks = Mono_df, isopeaks = Iso_df, "neg", lowMW = 100, highMW = 1000) -} diff --git a/MFAssignR/man/MFAssign_RMD.Rd b/MFAssignR/man/MFAssign_RMD.Rd deleted file mode 100644 index fdcaaed..0000000 --- a/MFAssignR/man/MFAssign_RMD.Rd +++ /dev/null @@ -1,263 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/MFAssign_RMD.R -\name{MFAssign_RMD} -\alias{MFAssign_RMD} -\title{Assigns all possible MF to each row of input data frame with CHOFIT and formula extension} -\usage{ -MFAssign_RMD( - peaks, - isopeaks = "none", - ionMode, - lowMW = 100, - highMW = 1000, - POEx = 0, - NOEx = 0, - Nx = 0, - Sx = 0, - Px = 0, - S34x = 0, - N15x = 0, - Dx = 0, - Ex = 0, - Clx = 0, - Cl37x = 0, - Fx = 0, - Brx = 0, - Br81x = 0, - Ix = 0, - Mx = 0, - NH4x = 0, - Zx = 1, - Sval = 2, - Nval = 3, - S34val = 2, - N15val = 3, - Pval = 5, - Ox = 30, - ppm_err = 3, - iso_err = 3, - SN = 0, - O_Cmin = 0, - O_Cmax = 2.5, - H_Cmin = 0.3, - H_Cmax = 3, - DBEOmin = -13, - DBEOmax = 13, - Omin = 0, - max_def = 0.9, - min_def = 0.5, - HetCut = "off", - NMScut = "on", - DeNovo = 300, - nLoop = 5, - SulfCheck = "on", - Ambig = "off", - MSMS = "off", - S34_abund = 30, - C13_abund = 60, - N3corr = "on" -) -} -\arguments{ -\item{peaks}{data frame, Monoisotopic Masses} - -\item{isopeaks}{data frame, Isotopic Masses. Default is "none"} - -\item{ionMode}{string: ("neg", "pos")} - -\item{lowMW}{numeric: -Sets the lower limit of molecular mass to be assigned. Default is 100.} - -\item{highMW}{numeric: -Sets the upper limit of molecular mass to be assigned. Default is 1000.} - -\item{POEx}{numeric: -If set to 1 and ionMode is positive, positive mode odd electron ions can be assigned. -Default is 0} - -\item{NOEx}{numeric: -If set to 1 and ionMode is negative, negative mode odd electron ions can be assigned. -Default is 0} - -\item{Nx}{numeric: -Sets the maximum allowable number of Nitrogen 14 to be used in assignment. Default is 0.} - -\item{Sx}{numeric: -Sets the maximum allowable number of Sulfur 32 to be used in assignment. Default is 0.} - -\item{Px}{numeric: -Sets the maximum allowable number of Phosphorus 31 to be used in assignment. Default is 0.} - -\item{S34x}{numeric: -Sets the amount of Sulfur 34 to be used in assignment. Default is 0.} - -\item{N15x}{numeric: -Sets the amount of Nitrogen 15 to be used in assignment. Default is 0.} - -\item{Dx}{numeric: -Sets the amount of Deuterium to be used in assignment. Default is 0.} - -\item{Ex}{numeric: -Sets the amount of Carbon 13 to be used in assignment. Default is 0.} - -\item{Clx}{numeric: -Sets the amount of Chlorine to be used in assignment. Default is 0.} - -\item{Cl37x}{numeric: -Sets the amount of Chlorine 37 to be used in assignment. Default is 0.} - -\item{Fx}{numeric: -Sets the amount of Fluorine to be used in assignment. Default is 0.} - -\item{Brx}{numeric: -Sets the amount of Bromine 79 to be used in assignment. Default is 0.} - -\item{Br81x}{numeric: -Sets the amount of Bromine 81 to be used in assignment. Default is 0.} - -\item{Ix}{numeric: -Sets the amount of Iodine 127 to be used in assignment. Default is 0.} - -\item{Mx}{numeric: -Sets the amount of Sodium adduct to be used in assignment. Default is 0.} - -\item{NH4x}{numeric: -Sets the amount of Ammonium adduct to be used in assignment. Default is 0.} - -\item{Zx}{numeric: -Sets the amount of charge to be used in assignment. Default is 1.} - -\item{Sval}{numeric: -Sets the valence of Sulfur. Default is 2.} - -\item{Nval}{numeric: -Sets the valence of Nitrogen. Default is 3.} - -\item{S34val}{numeric: -Sets the valence of Sulfur 34. Default is 2.} - -\item{N15val}{numeric: -Sets the valence of Nitrogen 15. Default is 3.} - -\item{Pval}{numeric: -Sets the valence of Phosphorus. Default is 5.} - -\item{Ox}{numeric: -Ox sets the maximum number of oxygen looked for in the CHOFIT core, it limits the number of loops performed.} - -\item{ppm_err}{numeric: -ppm_err parameter sets the error tolerance (ppm) for formula assignment. Default is 3.} - -\item{iso_err}{numeric: -iso_err parameter sets the error tolerance (ppm) for polyisotope matching. Default is 3.} - -\item{SN}{numeric: -SN parameter set the signal to noise cut for formula assignment. Default is 0.} - -\item{O_Cmin}{numeric: -O_Cmin parameter sets the minimum allowed oxygen to carbon ratio. Default is 0.} - -\item{O_Cmax}{numeric: -The O_Cmax parameter sets the upper limit for oxygen to carbon ratio. Default is 2.5.} - -\item{H_Cmin}{numeric: -H_Cmin parameter sets lower limit for hydrogen to carbon ratio. Default is 0.1.} - -\item{H_Cmax}{numeric: -H_Cmax parameter sets upper limit for hydrogen to carbon ratio for assigned formulas. -Default is 3.} - -\item{DBEOmin}{numeric: -DBEOmin parameter sets lower limit for DBE minus oxygen QA parameter. Default is -13.} - -\item{DBEOmax}{numeric: -DBEOmax parameter sets upper limit for DBE minus oxygen QA parameter. Default is 13.} - -\item{Omin}{numeric: -Omin parameter sets lower limit for oxygen number in assigned formula. Default is 0.} - -\item{max_def}{numeric: -Value for upper limit of mass defect for using floor() instead of round() for KMD. Default is 0.9} - -\item{min_def}{numeric: -Value for lower limit of mass defect for using floor() instead of round() for KMD. Default is 0.5} - -\item{HetCut}{character: -HetCut turns on or off the high heteroatom QA parameter. Default is "off"} - -\item{NMScut}{character: -NMScut turns on or off the nominal mass series QA parameter. Default is "on".} - -\item{DeNovo}{numeric: -DeNovo sets the de novo cut point for the data. Default is 300.} - -\item{nLoop}{numeric: -nLoop sets the number of times the KMD and z* formula extension loops. Default is 5.} - -\item{SulfCheck}{character: -Turns on or off the sulfur isotope check QA parameter. Default is "on".} - -\item{Ambig}{character: -Turns on or off increased ambiguity for assignments. Default is "off".} - -\item{MSMS}{character: -Turns on or off CH2 KMD prescreening before initial assignment. Default is "off".} - -\item{S34_abund}{numeric: -Sets the maximum 34S/32S isotope ratio for isotope matching. Default is 30.} - -\item{C13_abund}{numeric: -Sets the maximum 13C/12C isotope ratio for isotope matching. Default is 60.} - -\item{N3corr}{character: -Turns on or off correction of N3OS monoisotopic assignments to 13C assignment. Default is "on"} -} -\value{ -list(Unambig = Unambig, Ambig = Ambigout, None = unassigned, MSAssign = MZ, - Error = Error, MSgroups = MZgroups, VK = VK) - - Unambig - data frame containing unambiguous assignments - Ambig - data frame containing ambiguous assignments - None - data frame containing unassigned masses - MSAssign - ggplot of mass spectrum highlighting assigned/unassigned - Error - ggplot of the Error vs. m/z - MSgroups - ggplot of mass spectrum colored by molecular group - VK - ggplot of van Krevelen plot, colored by molecular group -} -\description{ -MFAssign assigns all possible molecular formulae to each -mass in the input file, subject to user constraints on the moles of -C, H, O, N, S, P, sodium (M), C13 (E), S34, N15, Deuterium (D), Cl, F, Cl37, NH4, and Z. -} -\details{ -There are user inputs for heteroatoms, adducts, and charge. -The terms for each are Nx, Sx, Px, Ex, S34x, N15x, Dx, -Clx, Fx, Cl37x, Mx, NH4x, and Zx. Basic QA steps are included within the -function. More detail about these QA steps can be seen in the -vignette and user manual attached to this package. -Additionally, an option to remove ambiguous assignments based on choosing -the formula with the fewest number of heteroatoms (Ohno and Ohno, 2013), and -the CH4 vs O replacement nominal mass series (Koch et al., 2007) is included. -Most of these QA parameters can be adjusted from outside the function. - -Positive mode odd-electron formula assignment is possible using the POEx -parameter. If set to 1 positive mode odd-electron ionized masses can be -assigned. - -The Ox term sets the number of loops performed by the CHOFIT core by defining the -maximum oxygen allowed to be looked for. Three oxygen is equal to one loop due to -the low mass moiety used in CHOFIT (Perdue and Green 2015). The default setting is -30 oxygen, so it is limited to 10 loops. It can be increased if necessary. - -The input dataframe should have two columns, the first column should contain the -relative abundance or intensity for the ion mass and the second column should contain -the ion mass, either positive or negative mode. The function can also handle an additional -input dataframe containing the masses identified as istopic by the IsoFiltR function. The -outputs of that function can be directly put into this function as peaks and isopeaks, -doing so will allow likely 13C isotope masses to be match to assigned monoisotopic masses. -The inclusion of an isotopic mass list is not required, however. -} -\examples{ -MFAssign_RMD(peaks = Mono_df, isopeaks = Iso_df, "neg", lowMW = 200, highMW = 700) -MFAssign_RMD(peaks = Mono_df, isopeaks = Iso_df, "neg", lowMW = 100, highMW = 1000, Nx = 3, Sx = 1) -} diff --git a/MFAssignR/tests/testthat/test-KMDNoise.R b/MFAssignR/tests/testthat/test-KMDNoise.R index b0295df..3e26ab1 100644 --- a/MFAssignR/tests/testthat/test-KMDNoise.R +++ b/MFAssignR/tests/testthat/test-KMDNoise.R @@ -4,3 +4,11 @@ test_that("KMDNoise works", { actual <- KMDNoise(Raw_Neg_ML) expect_equal(actual$Noise, 346.0706, tolerance = 1e-4) }) + + +test_that("SNplot works", { + load("../../data/Raw_Neg_ML.rda") + head(Raw_Neg_ML) + Raw_Neg_ML <- dplyr::relocate(Raw_Neg_ML, intensity) |> dplyr::rename(mass = m.z) + SNplot(Raw_Neg_ML, 100, 300) +}) \ No newline at end of file From 25540529a61beb9a3f6ba1b1d52d2f731fbce1aa Mon Sep 17 00:00:00 2001 From: hechth Date: Tue, 12 Dec 2023 14:33:36 +0100 Subject: [PATCH 2/4] added additional parameters --- MFAssignR/tests/testthat/test-KMDNoise.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MFAssignR/tests/testthat/test-KMDNoise.R b/MFAssignR/tests/testthat/test-KMDNoise.R index 3e26ab1..d5b05bc 100644 --- a/MFAssignR/tests/testthat/test-KMDNoise.R +++ b/MFAssignR/tests/testthat/test-KMDNoise.R @@ -10,5 +10,5 @@ test_that("SNplot works", { load("../../data/Raw_Neg_ML.rda") head(Raw_Neg_ML) Raw_Neg_ML <- dplyr::relocate(Raw_Neg_ML, intensity) |> dplyr::rename(mass = m.z) - SNplot(Raw_Neg_ML, 100, 300) + SNplot(Raw_Neg_ML, 1, 300, 100, 1000) }) \ No newline at end of file From 33c04672d1268a3a741e808310c5040d5e546ad6 Mon Sep 17 00:00:00 2001 From: Helge Hecht Date: Tue, 12 Dec 2023 15:27:50 +0000 Subject: [PATCH 3/4] Update MFAssignR/tests/testthat/test-KMDNoise.R Co-authored-by: Zargham Ahmad <46793118+zargham-ahmad@users.noreply.github.com> --- MFAssignR/tests/testthat/test-KMDNoise.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MFAssignR/tests/testthat/test-KMDNoise.R b/MFAssignR/tests/testthat/test-KMDNoise.R index df90344..0c2a482 100644 --- a/MFAssignR/tests/testthat/test-KMDNoise.R +++ b/MFAssignR/tests/testthat/test-KMDNoise.R @@ -10,7 +10,10 @@ test_that("KMDNoise works", { test_that("SNplot works", { - load("../../data/Raw_Neg_ML.rda") + load(system.file("data", "Raw_Neg_ML.rda", + package = "MFAssignR", + mustWork = TRUE + )) head(Raw_Neg_ML) Raw_Neg_ML <- dplyr::relocate(Raw_Neg_ML, intensity) |> dplyr::rename(mass = m.z) SNplot(Raw_Neg_ML, 1, 300, 100, 1000) From ec66c0fe4b8494ffd87b0169501a3240e73a3f29 Mon Sep 17 00:00:00 2001 From: Helge Hecht Date: Wed, 13 Dec 2023 08:37:20 +0000 Subject: [PATCH 4/4] Update MFAssignR/tests/testthat/test-KMDNoise.R Co-authored-by: Kristina Gomoryova --- MFAssignR/tests/testthat/test-KMDNoise.R | 1 - 1 file changed, 1 deletion(-) diff --git a/MFAssignR/tests/testthat/test-KMDNoise.R b/MFAssignR/tests/testthat/test-KMDNoise.R index 0c2a482..4922801 100644 --- a/MFAssignR/tests/testthat/test-KMDNoise.R +++ b/MFAssignR/tests/testthat/test-KMDNoise.R @@ -14,7 +14,6 @@ test_that("SNplot works", { package = "MFAssignR", mustWork = TRUE )) - head(Raw_Neg_ML) Raw_Neg_ML <- dplyr::relocate(Raw_Neg_ML, intensity) |> dplyr::rename(mass = m.z) SNplot(Raw_Neg_ML, 1, 300, 100, 1000) }) \ No newline at end of file