createDatabase: Create database

Description Usage Arguments Value Examples

View source: R/createDatabase.R

Description

** General **

Create and SQLite database of an LC-MS(/MS) experiment (replaces the create_database function).

Schema details can be found here.

Example LC-MS/MS processing workflow

Usage

1
2
3
4
5
6
7
8
9
createDatabase(
  pa,
  xset,
  xsa = NULL,
  outDir = ".",
  grpPeaklist = NA,
  dbName = NA,
  metadata = NA
)

Arguments

pa

purityA object; Needs to be the same used for frag4feature function

xset

xcms object; Needs to be the same used for frag4feature function (this will be ignored when using xsa parameter)

xsa

CAMERA object (optional); if CAMERA object is used, we ignore the xset parameter input and obtain all information from the xset object nested with the CAMERA xsa object. Adduct and isotope information will be included into the database when using this parameter. The underlying xset object must be the one used for the frag4feature function

outDir

character; Out directory for the SQLite result database

grpPeaklist

dataframe (optional); Can use any peak dataframe. Still needs to be derived from the xset object though

dbName

character (optional); Name of the result database

metadata

list; A list of metadata to add to the s_peak_meta table

Value

path to SQLite database and database name

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#msmsPths <- list.files(system.file("extdata", "lcms", "mzML",
# package="msPurityData"), full.names = TRUE, pattern = "MSMS")
#xset <- xcms::xcmsSet(msmsPths)
#xset <- xcms::group(xset)
#xset <- xcms::retcor(xset)
#xset <- xcms::group(xset)

#pa  <- purityA(msmsPths)
#pa <- frag4feature(pa, xset)
#pa <- filterFragSpectra(pa, allfrag=TRUE)
#pa <- averageAllFragSpectra(pa)
#dbPth <- createDatabase(pa, xset, metadata=list('polarity'='positive',
#'instrument'='Q-Exactive'))

# Run from previously generated data:
pa <- readRDS(system.file("extdata", "tests", "purityA",
          "9_averageAllFragSpectra_with_filter_pa.rds", package="msPurity"))
xset <- readRDS(system.file("extdata","tests", "xcms",
                "msms_only_xset.rds", package="msPurity"))
msmsPths <- list.files(system.file("extdata", "lcms", "mzML",
               package="msPurityData"), full.names = TRUE, pattern = "MSMS")
pa@fileList[1] <- msmsPths[basename(msmsPths)=="LCMSMS_1.mzML"]
pa@fileList[2] <- msmsPths[basename(msmsPths)=="LCMSMS_2.mzML"]
xset@filepaths[1] <- msmsPths[basename(msmsPths)=="LCMSMS_1.mzML"]
xset@filepaths[2] <- msmsPths[basename(msmsPths)=="LCMSMS_2.mzML"]
td <- tempdir()
db_pth = createDatabase(pa, xset, outDir = td)

msPurity documentation built on Jan. 14, 2021, 2:44 a.m.