connect_lumadb: Connects to LUMA database

Description Usage Arguments Value Examples

View source: R/database-functions.R

Description

Establishes a connection to an RSQLite database for combining Peak.lists together from two different ionization modes. Must have previously saved SQLite databases to hard disk.

Usage

1
connect_lumadb(db.list, db.dir, new.db, mem)

Arguments

db.list

list character names of databases containing results from processing positive mode and negative mode data for samples and blanks

db.dir

character directory containing the databases

new.db

character what should the new database be called.

mem

logical should database be in-memory. Default is FALSE

Value

list of Formal class SQLiteConnections, starting with new.db entry followed by one for each db.list entry

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
library(LUMA)
if(require(RSQLite, quietly = TRUE)) {
file <- system.file("extdata","Sample_Data.csv", package =  "LUMA") # is case sensitive on Linux
sample_data <- read.table(file, header = TRUE, sep = ",")
mzdatafiles <- sample_data$CT.ID
samples.pos <- gen_filebase(mzdatafiles = mzdatafiles, BLANK = FALSE, IonMode
= "Positive", ion.id = c("Pos","Neg")) #Returns "Peaklist_Pos" samples.neg <-
gen_filebase(mzdatafiles = mzdatafiles, BLANK = FALSE, IonMode = "Negative",
ion.id = c("Pos","Neg")) #Returns "Peaklist_Neg" blanks.pos <-
gen_filebase(mzdatafiles = mzdatafiles, BLANK = TRUE, IonMode = "Positive",
ion.id = c("Pos","Neg")) #Returns "Blanks_Pos" blanks.neg <-
gen_filebase(mzdatafiles = mzdatafiles, BLANK = TRUE, IonMode = "Negative",
ion.id = c("Pos","Neg")) #Returns "Blanks_Neg"

spos_db <- connect_peakdb(file.base = samples.pos, mem = TRUE)
sneg_db <- connect_peakdb(file.base = samples.neg, mem = TRUE)
bpos_db <- connect_peakdb(file.base = blanks.pos, mem = TRUE)
bneg_db <- connect_peakdb(file.base = blanks.neg, mem = TRUE)
new_db.list <- connect_lumadb(db.list = c("spos_db","sneg_db","bpos_db","bneg_db"), mem = TRUE)
all(sapply(new_db.list, function(x) { #All valid databases are created
  dbIsValid(x)
}))
all(sapply(new_db.list, dbDisconnect))
}

USEPA/LUMA documentation built on Aug. 29, 2020, 1:40 p.m.