Title: | 'tigreBrowser' Database Writer |
---|---|
Description: | Write modelling results into a database for 'tigreBrowser', a web-based tool for browsing figures and summary data of independent model fits, such as Gaussian process models fitted for each gene or other genomic element. The browser is available at <https://github.com/PROBIC/tigreBrowser>. |
Authors: | Antti Honkela [aut, cre], Miika-Petteri Matikainen [aut] |
Maintainer: | Antti Honkela <[email protected]> |
License: | AGPL-3 |
Version: | 0.1.5 |
Built: | 2024-11-12 04:40:21 UTC |
Source: | https://github.com/probic/tigrebrowserwriter |
Finalise and close the database
closeDb(db, experimentSet = "")
closeDb(db, experimentSet = "")
db |
Database object created by |
experimentSet |
Name of the experiment set for all the experiments (optional) |
db <- initializeDb("", "My Dataset") # ... closeDb(db)
db <- initializeDb("", "My Dataset") # ... closeDb(db)
Create and initialize a database
initializeDb(dbPath, datasetName, datasetSpecies = "", datasetSource = "", datasetPlatform = "", datasetDescription = "", datasetSaveLocation = "", datasetFigureFilename = "")
initializeDb(dbPath, datasetName, datasetSpecies = "", datasetSource = "", datasetPlatform = "", datasetDescription = "", datasetSaveLocation = "", datasetFigureFilename = "")
dbPath |
Path to the database file to be created. Empty string |
datasetName |
Name of the data set |
datasetSpecies |
Optional data set metadata: species |
datasetSource |
Optional data set metadata: source |
datasetPlatform |
Optional data set metadata: platform |
datasetDescription |
Optional data set metadata: description |
datasetSaveLocation |
Optional data set metadata: save location |
datasetFigureFilename |
Optional data set metadata: figure file name |
A database object db needed by other tigreBrowserWriter functions
## Not run: # Create a real database to a file db <- initializeDb("/path/to/the/database.sqlite", "My Dataset") closeDb(db) ## End(Not run) # Create a temporary database to be deleted at the end db <- initializeDb("", "My Dataset") closeDb(db)
## Not run: # Create a real database to a file db <- initializeDb("/path/to/the/database.sqlite", "My Dataset") closeDb(db) ## End(Not run) # Create a temporary database to be deleted at the end db <- initializeDb("", "My Dataset") closeDb(db)
Insert aliases
insertAliases(db, aliasType, aliases, aliasSource = "", aliasDescription = "")
insertAliases(db, aliasType, aliases, aliasSource = "", aliasDescription = "")
db |
Database object created by |
aliasType |
Name of the alias |
aliases |
A vector of aliases with names giving the primary identifiers |
aliasSource |
Optional alias metadata: source |
aliasDescription |
Optional alias metadata: description |
An updated database object db
db <- initializeDb("", "My Dataset") aliases <- c("aliasA", "aliasB", "aliasC") names(aliases) <- c("A", "B", "C") db <- insertAliases(db, "testalias", aliases) closeDb(db)
db <- initializeDb("", "My Dataset") aliases <- c("aliasA", "aliasB", "aliasC") names(aliases) <- c("A", "B", "C") db <- insertAliases(db, "testalias", aliases) closeDb(db)
Insert figure data directly to the database
insertFigureData(db, experimentName, regulatorName, filenames, name = "", description = "", priority = 0)
insertFigureData(db, experimentName, regulatorName, filenames, name = "", description = "", priority = 0)
db |
Database object created by |
experimentName |
Experiment name |
regulatorName |
Regulator name (more detailed experiment identifier) |
filenames |
A list of file names of PNG figures. names of the list must correspond to the names of the entities the figures are for. |
name |
Optional figure name |
description |
Optional figure description |
priority |
Integer priority used for sorting figures (default: 0) |
An updated database object db
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) # Generate a dummy plot (reused for all data elements for simplicity) examplefile <- tempfile("plot", fileext=".png") png(examplefile) plot(c(0, 1), c(0, 1)) dev.off() figures <- list(A=examplefile, B=examplefile, C=examplefile) db <- insertFigureData(db, "testexperiment", "testregulator", figures) closeDb(db)
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) # Generate a dummy plot (reused for all data elements for simplicity) examplefile <- tempfile("plot", fileext=".png") png(examplefile) plot(c(0, 1), c(0, 1)) dev.off() figures <- list(A=examplefile, B=examplefile, C=examplefile) db <- insertFigureData(db, "testexperiment", "testregulator", figures) closeDb(db)
Insert figure links
insertFigures(db, experimentName, regulatorName, filename, name = "", description = "", priority = 0)
insertFigures(db, experimentName, regulatorName, filename, name = "", description = "", priority = 0)
db |
Database object created by |
experimentName |
Experiment name |
regulatorName |
Regulator name (more detailed experiment identifier) |
filename |
URL path to figures. The path can contain the
special form |
name |
Optional figure name |
description |
Optional figure description |
priority |
Integer priority used for sorting figures (default: 0) |
An updated database object db
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) db <- insertFigures(db, "testexperiment", "testregulator", "http://foo.invalid/path/${probe_name}_fit.png") closeDb(db)
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) db <- insertFigures(db, "testexperiment", "testregulator", "http://foo.invalid/path/${probe_name}_fit.png") closeDb(db)
Insert results
insertResults(db, experimentName, regulatorName, figurePath, loglikelihoods, baselineloglikelihoods = NA, experimentDesc = "", loopVariable = 2, modelTranslation = FALSE, numberOfParameters = NA, parameterNames = NA, experimentProducer = "", experimentTimestamp = "", parameters = NA)
insertResults(db, experimentName, regulatorName, figurePath, loglikelihoods, baselineloglikelihoods = NA, experimentDesc = "", loopVariable = 2, modelTranslation = FALSE, numberOfParameters = NA, parameterNames = NA, experimentProducer = "", experimentTimestamp = "", parameters = NA)
db |
Database object created by |
experimentName |
Experiment name |
regulatorName |
Regulator name (more detailed experiment identifier) |
figurePath |
URL path to figures |
loglikelihoods |
A vector of log-likelihoods of elements identified by names |
baselineloglikelihoods |
A vector of baseline log-likelihoods of elements identified by names (optional) |
experimentDesc |
Optional experiment description |
loopVariable |
Optional: Loop variable (1=regulator, 2=target (default)) |
modelTranslation |
Optional: For gene regulation models, is translation modelled |
numberOfParameters |
Optional: Number of parameters |
parameterNames |
Optional: Parameter names |
experimentProducer |
Optional: Experiment producer (string) |
experimentTimestamp |
Optional: Experiment timestamp (string) |
parameters |
Optional: A vector of parameter values for the model |
An updated database object db
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) closeDb(db)
db <- initializeDb("", "My Dataset") logl <- c(-4.0, -2.0, 0.0) names(logl) <- c("A", "B", "C") baselogl <- c(1.0, -1.0, 4.0) names(baselogl) <- names(logl) db <- insertResults(db, "testexperiment", "testregulator", "", logl, baselineloglikelihoods=baselogl) closeDb(db)
Insert supplementary data
insertSupplementaryData(db, name, suppData, regulatorName = NA, source = "", platform = "", description = "")
insertSupplementaryData(db, name, suppData, regulatorName = NA, source = "", platform = "", description = "")
db |
Database object created by |
name |
Name of the supplementary data |
suppData |
A vector of supplementary data of elements identified by names |
regulatorName |
Regulator name the data links to (optional) |
source |
Optional annotation: source |
platform |
Optional annotation: platform |
description |
Optional annotation: description |
An updated database object db
db <- initializeDb("", "My Dataset") suppdata <- c(1, 2, 3) names(suppdata) <- c("A", "B", "C") db <- insertSupplementaryData(db, "supptest", suppdata) boolsupp <- c(TRUE, TRUE, FALSE) names(boolsupp) <- names(suppdata) db <- insertSupplementaryData(db, "supptest_bool", boolsupp) closeDb(db)
db <- initializeDb("", "My Dataset") suppdata <- c(1, 2, 3) names(suppdata) <- c("A", "B", "C") db <- insertSupplementaryData(db, "supptest", suppdata) boolsupp <- c(TRUE, TRUE, FALSE) names(boolsupp) <- names(suppdata) db <- insertSupplementaryData(db, "supptest_bool", boolsupp) closeDb(db)
Insert data z-scores used for filtering
insertZScores(db, zscores)
insertZScores(db, zscores)
db |
Database object created by |
zscores |
A vector of z-scores of elements identified by names |
An updated database object db
db <- initializeDb("", "My Dataset") zscores <- c(1, 2, 3) names(zscores) <- c("A", "B", "C") db <- insertZScores(db, zscores) closeDb(db)
db <- initializeDb("", "My Dataset") zscores <- c(1, 2, 3) names(zscores) <- c("A", "B", "C") db <- insertZScores(db, zscores) closeDb(db)