This function will write anno, data, and desc tables to a SQLite3 database.

write_database(
  desc = NULL,
  anno = NULL,
  data = NULL,
  file = stop("'file' must be specified"),
  overwrite = TRUE
)

Arguments

desc

a data.frame with two columns: base, which correspondes to the beginning of annotation columns; and label, which will be the label used to display related objects. Default: NULL

anno

a data.frame with annotation values. This table should always have a sample_id column that corresponds to the column names of the data table. Each annotation should have an _id, _label, and _color column.

data

a data.frame with data values. This first column should be called "gene", and each subsequent column should correspond to a single sample_id in the anno table. Default = NULL

file

a string specifying the location of the output database file. Required.

overwrite

a logical value indicating if existing tables in the database should be overwritten. Default = FALSE.

Value

Writes anno, desc, and data tables to the specified file.

Details

It can also be used to overwrite any one table in the database for updates.

Examples

rpkm <- v1_data
#> Error: object 'v1_data' not found
anno <- v1_anno
#> Error: object 'v1_anno' not found
desc <- v1_desc
#> Error: object 'v1_desc' not found

write_database(desc = desc, anno = anno, data = rpkm, file = "v1.db", overwrite=F)
#> Writing desc table
#> Error in (function (classes, fdef, mtable) {    methods <- .findInheritedMethods(classes, fdef, mtable)    if (length(methods) == 1L)         return(methods[[1L]])    else if (length(methods) == 0L) {        cnames <- paste0("\"", vapply(classes, as.character,             ""), "\"", collapse = ", ")        stop(gettextf("unable to find an inherited method for function %s for signature %s",             sQuote(fdef@generic), sQuote(cnames)), domain = NA)    }    else stop("Internal error in finding inherited methods; didn't return a unique method",         domain = NA)})(list(structure("SQLiteConnection", package = "RSQLite"), "character",     "function"), new("standardGeneric", .Data = function (conn,     name, value, ...) standardGeneric("dbWriteTable"), generic = structure("dbWriteTable", package = "DBI"),     package = "DBI", group = list(), valueClass = character(0),     signature = c("conn", "name", "value"), default = NULL, skeleton = (function (conn,         name, value, ...)     stop(gettextf("invalid call in method dispatch to '%s' (no default method)",         "dbWriteTable"), domain = NA))(conn, name, value, ...)),     <environment>): unable to find an inherited method for function ‘dbWriteTable’ for signature ‘"SQLiteConnection", "character", "function"’