This is a test version of Biostars. For the public version, visit https://www.biostars.org.
chromosome start & end for genes in biomart R not showing

I have a list of genes which i want to get their cordinates and ref-seq ids but "start" & "end" attributes in biomart keeps throwing error. could you please take a look?

library(biomart)
#define which database to use
ensembl102 <- useEnsembl(biomart = 'genes', 
                       dataset = 'mmusculus_gene_ensembl',
                       version = 102)

#define gene ids to query 
ids <- c("ENSMUSG00000047180", "ENSMUSG00000025964", "ENSMUSG00000012187", "ENSMUSG00000055980", "ENSMUSG00000034220",
"ENSMUSG00000026463","ENSMUSG00000026688", "ENSMUSG00000015090", "ENSMUSG00000026879", "ENSMUSG00000027254")

#run annotations
gene_annotations <- getBM(filters = "ensembl_gene_id",
               attributes = c("chromosome_name", "start", "end", "mgi_symbol"),
               values = ids, 
               mart = ensembl102)
Error in getBM(filters = "ensembl_gene_id", attributes = c("chromosome_name",  : 
  Invalid attribute(s): start, end 
Please use the function 'listAttributes' to get valid attribute names
ensembl bioconductor biomart

Looks like OP wants to use GRCm38 based on the other question so using the latest release would force them to use GRCm39.

1 answer

Invalid attribute(s): start, end 
Please use the function 'listAttributes' to get valid attribute names

That error message is on the point and even provides you with the solution! You are requesting start and end, but both don't exist. Use

listAttributes(ensembl102)

to list all available annotations.

Yay! I got it. it was labelled as "start_position" & "end_position" in listAttributes(ensembl102). Thank you!

Log in to answer this question.