text: user2005: I am supplying 30 ensembl ids into BioMart, but somehow it returns 31 result. What is going wrong here?
  Here you can see the code:
  library('biomaRt')
  mart <- useDataset("mmusculus_gene_ensembl", useMart("ensembl"))
  genes <- rownames(mat)
  G_list <- getBM(filters= "ensembl_gene_id", attributes= 
  c("ensembl_gene_id","entrezgene", 
  "mgi_symbol","description"),values=genes,mart= mart)
  
  genes list is the following one: 
  [1] "ENSMUSG00000097971" "ENSMUSG00000097582" "ENSMUSG00000061808" "ENSMUSG00000097206"
  [5] "ENSMUSG00000022425" "ENSMUSG00000094708" "ENSMUSG00000095937" "ENSMUSG00000032484"
  [9] "ENSMUSG00000060550" "ENSMUSG00000073409" "ENSMUSG00000026822" "ENSMUSG00000056071"
  [13] "ENSMUSG00000035299" "ENSMUSG00000045932" "ENSMUSG00000006154" "ENSMUSG00000032496"
  [17] "ENSMUSG00000040809" "ENSMUSG00000032690" "ENSMUSG00000055322" "ENSMUSG00000066443"
  [21] "ENSMUSG00000005089" "ENSMUSG00000073489" "ENSMUSG00000005800" "ENSMUSG00000034855"
  [25] "ENSMUSG00000029417" "ENSMUSG00000029561" "ENSMUSG00000021843" "ENSMUSG00000020108"
  [29] "ENSMUSG00000037849" "ENSMUSG00000066861"
  
  As you can see I have here 30 genes, but BioMart returns:
  > G_list$mgi_symbol
  [1] "Slc1a2"  "Mmp8"    "Eps8l1"  "Ddit4"   "Ktn1"    "Enpp2"   "Lcn2"    "Cxcl9"  
  [9] "Oasl2"   "Ngp"     "Ltf"     "Oas2"    "Cxcl10"  "Mid1"    "Ifi206"  "Chil3"  
  [17] "Ifit2"   "Tns1"    "S100a9"  "H2-Q7"   "H2-Q7"   "Ttr"     "Gm10163" "Oas1g"  
  [25] "H2-Q6"   "Ifi204"  "Gm10359" "Gm12671" "Gm26699" "Gm26527" "Gm26917"
  
  
  user581: If you print G_list, you'll see this half way down:
  1 ENSMUSG00000060550      15018      H2-Q7      Mus musculus histocompatibility 2, Q region locus 9 (H2-Q9), mRNA. [Source:RefSeq mRNA;Acc:NM_001201460]
  2 ENSMUSG00000060550     110558      H2-Q7      Mus musculus histocompatibility 2, Q region locus 9 (H2-Q9), mRNA. [Source:RefSeq mRNA;Acc:NM_001201460]
  
  So there are two entrez ids that map to the same Ensembl id. One of them maps to an alt locus.
  If you exclude "entrezgene" from the query, you'll get 30 results.
  
original_text: 2005: <p>I am supplying 30 ensembl ids into BioMart, but somehow it returns 31 result. What is going wrong here?
  Here you can see the code:</p>
  
  <pre><code>library('biomaRt')
  mart &lt;- useDataset("mmusculus_gene_ensembl", useMart("ensembl"))
  genes &lt;- rownames(mat)
  G_list &lt;- getBM(filters= "ensembl_gene_id", attributes= 
  c("ensembl_gene_id","entrezgene", 
  "mgi_symbol","description"),values=genes,mart= mart)
  </code></pre>
  
  <p>genes list is the following one: </p>
  
  <pre><code>[1] "ENSMUSG00000097971" "ENSMUSG00000097582" "ENSMUSG00000061808" "ENSMUSG00000097206"
  [5] "ENSMUSG00000022425" "ENSMUSG00000094708" "ENSMUSG00000095937" "ENSMUSG00000032484"
  [9] "ENSMUSG00000060550" "ENSMUSG00000073409" "ENSMUSG00000026822" "ENSMUSG00000056071"
  [13] "ENSMUSG00000035299" "ENSMUSG00000045932" "ENSMUSG00000006154" "ENSMUSG00000032496"
  [17] "ENSMUSG00000040809" "ENSMUSG00000032690" "ENSMUSG00000055322" "ENSMUSG00000066443"
  [21] "ENSMUSG00000005089" "ENSMUSG00000073489" "ENSMUSG00000005800" "ENSMUSG00000034855"
  [25] "ENSMUSG00000029417" "ENSMUSG00000029561" "ENSMUSG00000021843" "ENSMUSG00000020108"
  [29] "ENSMUSG00000037849" "ENSMUSG00000066861"
  </code></pre>
  
  <p>As you can see I have here 30 genes, but BioMart returns:</p>
  
  <pre><code>&gt; G_list$mgi_symbol
  [1] "Slc1a2"  "Mmp8"    "Eps8l1"  "Ddit4"   "Ktn1"    "Enpp2"   "Lcn2"    "Cxcl9"  
  [9] "Oasl2"   "Ngp"     "Ltf"     "Oas2"    "Cxcl10"  "Mid1"    "Ifi206"  "Chil3"  
  [17] "Ifit2"   "Tns1"    "S100a9"  "H2-Q7"   "H2-Q7"   "Ttr"     "Gm10163" "Oas1g"  
  [25] "H2-Q6"   "Ifi204"  "Gm10359" "Gm12671" "Gm26699" "Gm26527" "Gm26917"
  </code></pre>
   581: <p>If you print <code>G_list</code>, you'll see this half way down:</p>
  
  <pre><code>1 ENSMUSG00000060550      15018      H2-Q7      Mus musculus histocompatibility 2, Q region locus 9 (H2-Q9), mRNA. [Source:RefSeq mRNA;Acc:NM_001201460]
  2 ENSMUSG00000060550     110558      H2-Q7      Mus musculus histocompatibility 2, Q region locus 9 (H2-Q9), mRNA. [Source:RefSeq mRNA;Acc:NM_001201460]
  </code></pre>
  
  <p>So there are two <code>entrez</code> ids that map to the same <code>Ensembl</code> id. <a href="https://www.ncbi.nlm.nih.gov/gene/?term=110558" rel="noreferrer">One</a> of them maps to an alt locus.</p>
  
  <p>If you exclude <code>"entrezgene"</code> from the query, you'll get 30 results.</p>
  