Skip to content

Instantly share code, notes, and snippets.

@davebridges
Last active August 29, 2015 14:11
Show Gist options
  • Save davebridges/2197b4b173216b5dacf7 to your computer and use it in GitHub Desktop.
Save davebridges/2197b4b173216b5dacf7 to your computer and use it in GitHub Desktop.
Sample mapping code
library(biomaRt)
ensembl=useMart("ensembl")
#show possible datasets
listDatasets(ensembl)
#your results are listed here
dataset <- read.csv('Hits_PvsM_HighinMimic_filt.csv')
#you have several different ensembl results
unique(substr(dataset$Gene, 1,7))
#get a mapping file to get externam gene names from stickleback
stickleback_table <- getBM(attributes=c('ensembl_gene_id','external_gene_name','entrezgene'),
filters='ensembl_gene_id',
values=dataset$Gene,
mart=useDataset("gaculeatus_gene_ensembl",mart=ensembl))
#repeat this with other species in your results set by changing the species in the use dataset.
#To find the abbreviation for that species use listDatasets(ensembl)
mapped_table <- rbind(stickleback_table) #add other tables
write.csv(mapped_table, file="Mapped Genes.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment