R/dbGetTraitInfoByAccession.R

Defines functions dbGetTraitInfoByAccession

Documented in dbGetTraitInfoByAccession

#' Get trait info by dbGaP phv number
#' @param db A database connection
#' @param dbgap_trait_accessions A vector of dbGaP variable accessions, as integers or strings with a leading "phv"
#' @import dbTopmed
#' @export

dbGetTraitInfoByAccession <- function(db, dbgap_trait_accessions){
    accs_standardized <- .standardizeAccessions(dbgap_trait_accessions)
    query <- paste("SELECT *",
                   "FROM view_source_trait WHERE",
                   sprintf("dbgap_trait_accession IN (%s)",
                           paste(accs_standardized, collapse = ", ")))
    dbGetQuery(db, query)
}
UW-GAC/dbTopmedHelper documentation built on June 3, 2017, 8:40 a.m.