library("Gviz")
gen <- "hg38"
chr <- "chr2"
start <- 38290160
end <- 38303219
if(interactive()){
  snptrack <- snpBiomart_ENSEMBL(gen,chr, start, end,
                       dataset="hsapiens_snp",showId=FALSE)
  plotTracks(snptrack, from=start, to=end)
} else {
  data(snpBiomarttrack)
  plotTracks(snptrack, from=start, to=end)
}
Run the code above in your browser using DataLab