This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problem with useMart in biomaRt

Hi, I have been trying to 'translate' some M. musculus Ensembl exon IDs (format 'ENSMUSE0000XXXXXXX') into their genes of origin and found another post that demonstrates how to do so using biomaRt. However, although I think I've installed biomaRt on R:

if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")

BiocManager::install("biomaRt")

(I get a message saying

Warning message: package(s) not installed when version(s) same as current; use force = TRUE to re-install: 'biomaRt'

)

I then have trouble with useMart, and get a message saying

could not find function "useMart"

Do you have an idea why this might be happening?

Thanks in advance!

rstudio usemart r biomart

Can you provide sessionInfo() output? Mike Smith Developer of biomaRt will want to see that.

Hi, I get the following:

R version 4.1.1 (2021-08-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 11.6

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices [6] utils datasets methods base

other attached packages: [1] BiocManager_1.30.16 org.Mm.eg.db_3.13.0 [3] AnnotationDbi_1.54.1 IRanges_2.26.0 [5] S4Vectors_0.30.2
Biobase_2.52.0 [7] BiocGenerics_0.38.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.7
XVector_0.32.0 [3] zlibbioc_1.38.0 bit_4.0.4
[5] R6_2.5.1 rlang_0.4.12 [7] fastmap_1.1.0
blob_1.2.2 [9] httr_1.4.2 GenomeInfoDb_1.28.4 [11] tools_4.1.1 png_0.1-7 [13] DBI_1.1.1
bit64_4.0.5 [15] crayon_1.4.1
GenomeInfoDbData_1.2.6 [17] bitops_1.0-7 vctrs_0.3.8
[19] KEGGREST_1.32.0 RCurl_1.98-1.5 [21] memoise_2.0.0 cachem_1.0.6 [23] RSQLite_2.2.8 compiler_4.1.1
[25] Biostrings_2.60.2 pkgconfig_2.0.3

1 answer

Please start a new R session and confirm what happens when you run this:

require(biomaRt)
ensembl <- useMart('ensembl', dataset = 'hsapiens_gene_ensembl')

annot <- getBM(
  attributes = c(
    'hgnc_symbol',
    'ensembl_gene_id',
    'gene_biotype'),
  mart = ensembl)

Hello, I get 'annot: 67135 obs. of 3 variables'' and 'ensembl: Large Mart (1.4 MB)' in the 'Environment' panel. It looks like I might have just needed to just start a new R session?

Maybe, or did you just not load the package? To load, you just need:

library(biomaRt)

or

require(biomaRt)

That might have also been the case. Thank you very much!

Log in to answer this question.