knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
ms2sweeper is an R package designed to find and retreive ms/ms spectra within whenever available for a given feature for the analysis of metabolomics data. If multiple scans for a single are available, the program does its best to return the cleanest possible spectra.
The cleaning processes is designed to remove noise peaks from spectra that are there due to contamination from other peaks being coeluted within the isolation window or irreproducible secondary fragments.
To install this package, please type the following command into the R console:
#devtools::install_github("crmclean/ms2sweeper")
Hopefully in the future, this package will be distributed through either CRAN or Bioconductor.
library(ms2sweeper) metadata <- read.csv("~/MIT/Research/MMETSP_Project/data/MMETSPsequencetrim.2017.2.11.csv",stringsAsFactors = F) files <- metadata$File.Name[grep("*. pos \\(Hak\\)",as.character(metadata$Sample.Name), ignore.case = T)] ms2dir <- "~/MIT/Research/MMETSP_Project/data/2017-12-21/all_ms2" ms2Data <- list.files(ms2dir) dataIndex <- sapply(paste0(files, ".mzML"), grep, ms2Data) %>% unlist() ms2Paths <- file.path(ms2dir, ms2Data[dataIndex]) features <- read.csv(here::here("lipid_table.csv")) outpath <- here::here("data/sweeperTest")
sweeper <- ms2sweeper::createSweeper(features, ms2Path = ms2Paths) sweeper <- ms2sweeper::harvestMS2(sweeperObj = sweeper, clearData = FALSE) temp <- alignMS2s(sweeperObj = sweeper, mzDiff = 0.1) retreiveSpectra(sweeperObj = temp, outputPath = outpath)
Loading content needed to check for MS2 data.
lobDB$mz frags[[2]][frags[[2]]$msLevel == 1,] %>% View()
ms2sweeper requires that the columns for exact mass and retention time for each feature be labeled as mz and rt respectively.
colnames(checkFeatures) <- c("mz", "rt") ms2sweeper::createSweeper(checkFeatures, files)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.