Skip to content

Instantly share code, notes, and snippets.

@thirdknife
Last active July 20, 2017 21:42
Show Gist options
  • Save thirdknife/700d867beba6c297d87d7e153b4435b9 to your computer and use it in GitHub Desktop.
Save thirdknife/700d867beba6c297d87d7e153b4435b9 to your computer and use it in GitHub Desktop.
#necessary installations
source("http://bioconductor.org/biocLite.R")
biocLite("biomaRt")
library("biomaRt")
#use ensembl mart
ensembl = useMart("ensembl")
#reference homosapiens
ensembl = useDataset("hsapiens_gene_ensembl", ensembl)
#set gene to find
geneToFind = c("PolB")
#set attributes to list after search
attributes = c('hgnc_symbol', 'chromosome_name', 'start_position', 'end_position', 'band')
#set filter, in this case its gene name
filters = 'external_gene_name'
#call the getBM function to get result
getBM(attributes, filters, geneToFind, ensembl)
#output
# hgnc_symbol chromosome_name start_position end_position band
#1 POLB 8 42338454 42371808 p11.21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment