Skip to content

Commit

Permalink
Merge pull request #27 from RECETOX/hechth/issue8
Browse files Browse the repository at this point in the history
Removed SNplot duplicate
  • Loading branch information
hechth authored Dec 13, 2023
2 parents ccdaa3c + ec66c0f commit beb874a
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 517 deletions.
56 changes: 28 additions & 28 deletions MFAssignR/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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, <[email protected]>
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, <[email protected]>
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
33 changes: 32 additions & 1 deletion MFAssignR/NAMESPACE
Original file line number Diff line number Diff line change
@@ -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)
41 changes: 0 additions & 41 deletions MFAssignR/R/HistNoise.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}




14 changes: 5 additions & 9 deletions MFAssignR/R/KMDNoise.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
175 changes: 0 additions & 175 deletions MFAssignR/man/MFAssignCHO_RMD.Rd

This file was deleted.

Loading

0 comments on commit beb874a

Please sign in to comment.