text: user506: I have a matrix of gene counts which I'm going to use as input for DESeq.  Right now, each gene is labeled by its Ensemble transcript ID, but I'd like to convert these to their HGNC symbols before I input them into DESeq for analysis. I'm attempting to do this conversion using biomaRt, however, this is my first time using the program, and I'm running into issues.  Here is my current code:
  library("biomaRt")
  mart <- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl")
  transcript.ids <- rownames(txi.kallisto$counts)
  hgnc_symbols <- getBM(attributes = "hgnc_symbol", filters = "ensembl_transcript_id", values = transcript.ids, mart = mart)
  
  Printing hgnc_symbols shows that it isn't what I want:
  >ghnc_symbols
  [1] hgnc_symbol
  <0 rows> (or 0-length row.names)
  
  Lastly, here is what the input transcript IDs look like:
  > head(rownames(txi.kallisto$counts))
  [1] "ENSMUST00000178862.1" "ENSMUST00000178537.1" "ENSMUST00000196221.1"
  [4] "ENSMUST00000179664.1" "ENSMUST00000177564.1" "ENSMUST00000179520.1"
  
  
  user48: You need to specify the number without the version. Instead of "ENSMUST00000178862.1" just "ENSMUST00000178862":
  You can do this with one more line:
  g <- gsub("\\..*", "", rownames(txi.kallisto$counts))
  (hgnc_symbols <- getBM(attributes = c("hgnc_symbol", "chromosome_name", "ensembl_transcript_id"), filters = "ensembl_transcript_id", values = g, mart = mart))
  ##  hgnc_symbol chromosome_name ensembl_transcript_id
  ##1          NA              14    ENSMUST00000177564
  ##2          NA               6    ENSMUST00000178537
  ##3          NA               6    ENSMUST00000178862
  ##4          NA              12    ENSMUST00000179520
  ##5          NA              14    ENSMUST00000179664
  ##6          NA              14    ENSMUST00000196221
  
  With these transcripts it doesn't seem that there is an equivalent hgnc_symbol. But is recognized, otherwise they are not recognized:
  (hgnc_symbols <- getBM(attributes = c("hgnc_symbol", "chromosome_name", "ensembl_transcript_id"), filters = "ensembl_transcript_id", values = rownames(txi.kallisto$counts), mart = mart))
  ## [1] hgnc_symbol           chromosome_name       ensembl_transcript_id
  ##<0 rows> (or 0-length row.names)
  
  However you might be interested in doing something like this:
  human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
  getLDS(attributes = "ensembl_transcript_id",
         filters = "ensembl_transcript_id", values = g,mart = mouse,
        attributesL = "hgnc_symbol", martL = human)
  ## The query to the BioMart webservice returned an invalid result: the number of 
  ## columns in the result table does not equal the number of 
  ## attributes in the query. Please report this to the mailing list.
  
  
original_text: 506: <p>I have a matrix of gene counts which I'm going to use as input for DESeq.  Right now, each gene is labeled by its Ensemble transcript ID, but I'd like to convert these to their HGNC symbols before I input them into DESeq for analysis. I'm attempting to do this conversion using biomaRt, however, this is my first time using the program, and I'm running into issues.  Here is my current code:</p>
  
  <pre class="lang-R prettyprint-override"><code>library("biomaRt")
  mart &lt;- useMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "mmusculus_gene_ensembl")
  transcript.ids &lt;- rownames(txi.kallisto$counts)
  hgnc_symbols &lt;- getBM(attributes = "hgnc_symbol", filters = "ensembl_transcript_id", values = transcript.ids, mart = mart)
  </code></pre>
  
  <p>Printing hgnc_symbols shows that it isn't what I want:</p>
  
  <pre class="lang-R prettyprint-override"><code>&gt;ghnc_symbols
  [1] hgnc_symbol
  &lt;0 rows&gt; (or 0-length row.names)
  </code></pre>
  
  <p>Lastly, here is what the input transcript IDs look like:</p>
  
  <pre class="lang-R prettyprint-override"><code>&gt; head(rownames(txi.kallisto$counts))
  [1] "ENSMUST00000178862.1" "ENSMUST00000178537.1" "ENSMUST00000196221.1"
  [4] "ENSMUST00000179664.1" "ENSMUST00000177564.1" "ENSMUST00000179520.1"
  </code></pre>
   48: <p>You need to specify the number without the version. Instead of "ENSMUST00000178862.1" just "ENSMUST00000178862":</p>
  
  <p>You can do this with one more line:</p>
  
  <pre class="lang-R prettyprint-override"><code>g &lt;- gsub("\\..*", "", rownames(txi.kallisto$counts))
  (hgnc_symbols &lt;- getBM(attributes = c("hgnc_symbol", "chromosome_name", "ensembl_transcript_id"), filters = "ensembl_transcript_id", values = g, mart = mart))
  ##  hgnc_symbol chromosome_name ensembl_transcript_id
  ##1          NA              14    ENSMUST00000177564
  ##2          NA               6    ENSMUST00000178537
  ##3          NA               6    ENSMUST00000178862
  ##4          NA              12    ENSMUST00000179520
  ##5          NA              14    ENSMUST00000179664
  ##6          NA              14    ENSMUST00000196221
  </code></pre>
  
  <p>With these transcripts it doesn't seem that there is an equivalent hgnc_symbol. But is recognized, otherwise they are not recognized:</p>
  
  <pre class="lang-R prettyprint-override"><code>(hgnc_symbols &lt;- getBM(attributes = c("hgnc_symbol", "chromosome_name", "ensembl_transcript_id"), filters = "ensembl_transcript_id", values = rownames(txi.kallisto$counts), mart = mart))
  ## [1] hgnc_symbol           chromosome_name       ensembl_transcript_id
  ##&lt;0 rows&gt; (or 0-length row.names)
  </code></pre>
  
  <p>However you might be interested in doing something like <a href="http://bioconductor.org/packages/release/bioc/vignettes/biomaRt/inst/doc/biomaRt.html#given-the-human-gene-tp53-retrieve-the-human-chromosomal-location-of-this-gene-and-also-retrieve-the-chromosomal-location-and-refseq-id-of-its-homolog-in-mouse." rel="noreferrer">this</a>:</p>
  
  <pre class="lang-R prettyprint-override"><code>human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
  getLDS(attributes = "ensembl_transcript_id",
         filters = "ensembl_transcript_id", values = g,mart = mouse,
        attributesL = "hgnc_symbol", martL = human)
  ## The query to the BioMart webservice returned an invalid result: the number of 
  ## columns in the result table does not equal the number of 
  ## attributes in the query. Please report this to the mailing list.
  </code></pre>
  