retrieve_param_query: Send and retrieve the result of an SQL query

Description Usage Arguments Value Author(s) See Also Examples

Description

A function that sends and retrieves queries to the specified datasources and optionally performs sanity checks in terms of returned column names. If can.fail is TRUE, an empty data.frame will be returned if a query does not return a result. Otherwise program execution is halted.

Usage

1
retrieve.param.query(sample.id.list, db.con, param.obj, query.func, exp.col = NULL, can.fail=FALSE)

Arguments

sample.id.list

Either a sample.id.list style list or NULL. A sample.id.list is defined as a list with three elements: recon is the human readable name, ind is the database index value and num.pats is the number of samples in the database.

db.con

An object inherited from DBIConnection that provides access to the datasource.

param.obj

A priorDbParams object.

query.func

A method generating the function that generates the SQL query to be sent. Needs to take the sample.id.list and priorDbParams object as arguments.

exp.col

A character vector containing the expected columns or NULL if none.

can.fail

A logical value.

Value

A data.framecontaining the results of the query.

Author(s)

Daniel Bottomly

See Also

priorDbParams, dbGetQuery

Examples

1
2
3
4
5
6
7
8
9
if(require(RSQLite) && require(HitWalkerData))
{
  data(params)
  db.con <- dbConnect("SQLite", hitwalker.db.path())
  sample.id.list <- reconcile.sample.name("08-00102", db.con, examp.prior.param)
  query.func <- hitQuery
  query.res <- retrieve.param.query(sample.id.list, db.con, examp.prior.param, query.func, exp.col = NULL, can.fail=FALSE)
  head(query.res)
}

dbottomly/HitWalker documentation built on May 15, 2019, 1:22 a.m.