ahToMySQL {epivizrData}R Documentation

Utility function to import data to a MySQL database from Annotation Hub

Description

Utility function to import data to a MySQL database from Annotation Hub

Usage

ahToMySQL(ah, annotations = list(), ...)

Arguments

ah

AnnotationHub object with records to add to database.

annotations

A named list of lists (key/value pairs). Keys must be the AH ID for the corresponding record and the value is a named list representing an annotation. An annotation is automatically inferred by the record's metadata. Any annotation that is passed for a particular record is concatenated to its inferred annotation. If the annotation has a subtype column, it is used to name the data object being added to the db, otherwise the record's tags is used.

...

arguments for toMySQL (connection, db_name, batch, index)

Examples

library(epivizrData)
library(AnnotationHub)
library(DBI)
library(RMySQL)

ah <- AnnotationHub()
db_annotations <- list()

# Query Patterns
roadmap <- "EpigenomeRoadMap"
bisulphite <- "bisulphite"

esophagus <- query(ah, c("esophagus", "roadmap", "bisulphite"))
eso_anno <- list(tissue="Digestive", subtype="Esophagus")
eso_id <- names(esophagus)
db_annotations[[eso_id]] <- eso_anno

gastric <- query(ah, c("gastric", "roadmap", "bisulphite"))
gas_anno <- list(tissue="Digestive", subtype="Gastric")
gas_id <- names(gastric)
db_annotations[[gas_id]] <- gas_anno

sigmoid_colon <- query(ah, c("sigmoid colon", "roadmap", "bisulphite"))
colon_anno <- list(tissue="Digestive", subtype="Sigmoid Colon")
colon_id <- names(sigmoid_colon)
db_annotations[[colon_id]] <- colon_anno

small_intestine <- query(ah, c("small intestine", "roadmap", "bisulphite"))
intestine_anno <- list(tissue="Digestive", subtype="Small Intestine")
intestine_id <- names(small_intestine)
db_annotations[[intestine_id]] <- intestine_anno

# This collapses our 4 records into one AnnotationHub object.
records <- c(esophagus, gastric, sigmoid_colon,  small_intestine)

# connection <- dbConnect(MySQL(), host=host, user=user, password=pass)
# db_name="my_database"

# ahToMySQL(ah=records, annotations=db_annotations,
#   connection=connection, db_name=db_name)


[Package epivizrData version 1.8.0 Index]