#' Query variants with chromosome and position
#'
#' This function allows you to query SNP information given its chromosome and position.
#' @param chrom What's the chromosome number of the SNP?
#' @param pos What's the position of the SNP on the chromosome?
#' @param fields What would you like to know about the SNP?
#' @keywords SNP query
#' @export
#' @examples
#' makeBPQuery(4, 12345679, c("cadd.consequence", "dbsnp.gene"))
makeBPQuery = function(chrom, pos, fields){
queryResult = list()
for(i in 1:length(chrom)){
q = paste0('cadd.chrom:', chrom[i], ' AND cadd.pos:', pos[i])
result = queryVariant(q=q, fields=fields)$hits
if (!length(result) == 0){
result = list(result)
queryResult = c(queryResult, result)
}
}
return(queryResult)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.