text: user3532: I'm trying to convert ~20,000 different human gene symbols to ensembl IDs. I've been trying to use biomaRt to do this, but continue getting the following error 
  getBM( attributes=c("ensembl_gene_id") , filters= "mgi_symbol"  ,mart=ensembl)
  Error in martCheck(mart) : 
    No dataset selected, please select a dataset first.  You can see the available datasets by using the listDatasets function see ?listDatasets for more information.  Then you should create the Mart object by using the useMart function.  See ?useMart for more information
  
  Is there a different format I should be using for this? I tried using BioConductor's description of how to use getBM but am a R novice and confused as to how to set this up to convert gene symbols into ensemble IDs. 
  
  user6572: I tried several R packages (mygene, org.Hs.eg.db, biomaRt, EnsDb.Hsapiens.v79) to convert Ensembl.gene to gene.symbol, and found that the EnsDb.Hsapiens.v79 package / gene database provides the best conversion quality (in terms of being able to convert most of Ensembl.gene to gene.symbol).
  # Install the package if you have not installed by running this command: 
  BiocManager::install("EnsDb.Hsapiens.v79")
  
  library(EnsDb.Hsapiens.v79)
  
  # 1. Convert from ensembl.gene to gene.symbol
  ensembl.genes <- c("ENSG00000150676", "ENSG00000099308", "ENSG00000142676", "ENSG00000180776", "ENSG00000108848", "ENSG00000277370", "ENSG00000103811", "ENSG00000101473")
  
  geneIDs1 <- ensembldb::select(EnsDb.Hsapiens.v79, keys= ensembl.genes, keytype = "GENEID", columns = c("SYMBOL","GENEID"))
  
  # 2. Convert from gene.symbol to ensembl.gene
  geneSymbols <-  c('DDX26B','CCDC83',  'MAST3', 'RPL11', 'ZDHHC20',  'LUC7L3',  'SNORD49A',  'CTSH', 'ACOT8')
  
  geneIDs2 <- ensembldb::select(EnsDb.Hsapiens.v79, keys= geneSymbols, keytype = "SYMBOL", columns = c("SYMBOL","GENEID"))
  
  Other available R packages / gene database for the conversion can refer to this GitHub page.
  
  user48: You can use the standard annotation package for humans (you can also use biomaRt, but it can be more confusing, see below):
  library("org.Hs.eg.db") # remember to install it if you don't have it already
  symbols <- mapIds(org.Hs.eg.db, keys = ensemblsIDS, keytype = "ENSEMBL", column="SYMBOL")
  
  The ensemblsIDS should be a character vector: c("ENSG001", "ENSG002", ..).
  However, if your primary key is an ENSEMBL id it is preferred to use a ENSEMBL package centred around the ENSEMBL id :
  library("EnsDb.Hsapiens.v86")
  mapIds <- mapIds(EnsDb.Hsapiens.v86, keys = ensemblsIDS, keytype = "GENEID", columns = c("SYMBOL")
  
  The solution with biomaRt:
  library("biomaRt")
  ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl")
  getBM(attributes='hgnc_symbol', 
        filters = 'ensembl_gene_id', 
        values = ensemblsIDS, 
        mart = ensembl)
  
  
original_text: 3532: <p>I'm trying to convert ~20,000 different human gene symbols to ensembl IDs. I've been trying to use biomaRt to do this, but continue getting the following error </p>
  
  <pre><code>getBM( attributes=c("ensembl_gene_id") , filters= "mgi_symbol"  ,mart=ensembl)
  Error in martCheck(mart) : 
    No dataset selected, please select a dataset first.  You can see the available datasets by using the listDatasets function see ?listDatasets for more information.  Then you should create the Mart object by using the useMart function.  See ?useMart for more information
  </code></pre>
  
  <p>Is there a different format I should be using for this? I tried using BioConductor's description of how to use getBM but am a R novice and confused as to how to set this up to convert gene symbols into ensemble IDs. </p>
   6572: <p>I tried several R packages (<code>mygene</code>, <code>org.Hs.eg.db</code>, <code>biomaRt</code>, <code>EnsDb.Hsapiens.v79</code>) to convert Ensembl.gene to gene.symbol, and found that the <code>EnsDb.Hsapiens.v79</code> package / gene database provides the best conversion quality (in terms of being able to convert most of Ensembl.gene to gene.symbol).</p>
  
  <pre><code># Install the package if you have not installed by running this command: 
  BiocManager::install("EnsDb.Hsapiens.v79")
  
  library(EnsDb.Hsapiens.v79)
  
  # 1. Convert from ensembl.gene to gene.symbol
  ensembl.genes &lt;- c("ENSG00000150676", "ENSG00000099308", "ENSG00000142676", "ENSG00000180776", "ENSG00000108848", "ENSG00000277370", "ENSG00000103811", "ENSG00000101473")
  
  geneIDs1 &lt;- ensembldb::select(EnsDb.Hsapiens.v79, keys= ensembl.genes, keytype = "GENEID", columns = c("SYMBOL","GENEID"))
  
  # 2. Convert from gene.symbol to ensembl.gene
  geneSymbols &lt;-  c('DDX26B','CCDC83',  'MAST3', 'RPL11', 'ZDHHC20',  'LUC7L3',  'SNORD49A',  'CTSH', 'ACOT8')
  
  geneIDs2 &lt;- ensembldb::select(EnsDb.Hsapiens.v79, keys= geneSymbols, keytype = "SYMBOL", columns = c("SYMBOL","GENEID"))
  </code></pre>
  
  <p>Other available R packages / gene database for the conversion can refer to <a href="https://shiring.github.io/genome/2016/10/23/AnnotationDbi" rel="noreferrer">this GitHub page</a>.</p>
   48: <p>You can use the standard annotation package for humans (you can also use biomaRt, but it can be more confusing, see below):</p>
  <pre><code>library(&quot;org.Hs.eg.db&quot;) # remember to install it if you don't have it already
  symbols &lt;- mapIds(org.Hs.eg.db, keys = ensemblsIDS, keytype = &quot;ENSEMBL&quot;, column=&quot;SYMBOL&quot;)
  </code></pre>
  <p>The <code>ensemblsIDS</code> should be a character vector: <code>c(&quot;ENSG001&quot;, &quot;ENSG002&quot;, ..)</code>.</p>
  <p>However, if your primary key is an ENSEMBL id it is preferred to use a ENSEMBL package centred around the ENSEMBL id :</p>
  <pre><code>library(&quot;EnsDb.Hsapiens.v86&quot;)
  mapIds &lt;- mapIds(EnsDb.Hsapiens.v86, keys = ensemblsIDS, keytype = &quot;GENEID&quot;, columns = c(&quot;SYMBOL&quot;)
  </code></pre>
  <p>The solution with biomaRt:</p>
  <pre class="lang-r prettyprint-override"><code>library(&quot;biomaRt&quot;)
  ensembl = useMart(&quot;ensembl&quot;,dataset=&quot;hsapiens_gene_ensembl&quot;)
  getBM(attributes='hgnc_symbol', 
        filters = 'ensembl_gene_id', 
        values = ensemblsIDS, 
        mart = ensembl)
  </code></pre>
  