Entering edit mode
At support.bioconductor.org/p/130050/#9157234 James W. MacDonald gave a function which, if modified, might be of use with useMart ? (the post was referred to as old so I'm asking a new question). Any chance of getting a similar function for useMart rather than useEnsembl ? - or won't this work ? (I get an error saying no Port - details below). Many thanks. I've tried:
library("biomaRt")
getMart <- function(biomart, dataset, host, path, archive) {
e <- simpleError("")
while(is(e, "simpleError")) {
e <- tryCatch(useMart(biomart, dataset, host, path, archive), error = function(x) x)
}
e}
## Europe:
gene.db <- getMart(biomart = "ENSEMBL_MART_ENSEMBL", dataset = "hsapiens_gene_ensembl", host = "https://www.ensembl.org", path = "/biomart/martservice", archive = FALSE); gene.db
## East USA:
gene.db <- getMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl", host = "https://useast.ensembl.org", path = "/biomart/martservice", archive = FALSE); gene.db
## results from East USA:
error httr2_failure
Error in req_perform():
Failed to perform HTTP request.
Caused by error in curl::curl_fetch_memory():
URL rejected: Port number was not a decimal number between 0 and 65535
---
Backtrace:
1. global getMart(...)
2. base::tryCatch(...)
3. base (local) tryCatchList(expr, classes, parentenv, handlers)
4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1 L]])
5. base (local) doTryCatch(return(expr), name, parentenv, handler)
6. biomaRt::useMart(biomart, dataset, host, path, archive)
7. biomaRt:::.useMart(...)
8. biomaRt:::.listMarts(...)
9. biomaRt:::bmRequest(...)
10. httr2::req_perform(request)
11. base::tryCatch(...)
12. base (local) tryCatchList(expr, classes, parentenv, handlers)
13. base (local) tryCatchOne(expr, names, parentenv, handlers[[1 L]])
14. value[[3 L]](cond)
sessionInfo( )
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.6.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Berlin
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] biomaRt_2.60.1
loaded via a namespace (and not attached):
[1] bit_4.5.0 jsonlite_1.8.9
[3] dplyr_1.1.4 compiler_4.4.1
[5] crayon_1.5.3 filelock_1.0.3
[7] tidyselect_1.2.1 Biobase_2.64.0
[9] xml2_1.3.6 blob_1.2.4
[11] stringr_1.5.1 Biostrings_2.72.1
[13] IRanges_2.38.1 progress_1.2.3
[15] png_0.1-8 fastmap_1.2.0
[17] R6_2.5.1 XVector_0.44.0
[19] generics_0.1.3 curl_5.2.3
[21] httr2_1.0.4 GenomeInfoDb_1.40.1
[23] BiocGenerics_0.50.0 tibble_3.2.1
[25] AnnotationDbi_1.66.0 GenomeInfoDbData_1.2.12
[27] DBI_1.2.3 pillar_1.9.0
[29] rlang_1.1.4 utf8_1.2.4
[31] KEGGREST_1.44.1 cachem_1.1.0
[33] stringi_1.8.4 bit64_4.5.2
[35] RSQLite_2.3.7 memoise_2.0.1
[37] cli_3.6.3 magrittr_2.0.3
[39] zlibbioc_1.50.0 digest_0.6.37
[41] dbplyr_2.5.0 rappdirs_0.3.3
[43] hms_1.1.3 BiocFileCache_2.12.0
[45] lifecycle_1.0.4 S4Vectors_0.42.1
[47] prettyunits_1.2.0 vctrs_0.6.5
[49] glue_1.7.0 stats4_4.4.1
[51] fansi_1.0.6 httr_1.4.7
[53] tools_4.4.1 pkgconfig_2.0.3
[55] UCSC.utils_1.0.0
Why do you want to use
useMart()
rather thanuseEnsembl()
? They are essentially the same (useEnsembl()
will eventually calluseMart()
), but with some Ensembl specific defaults. The intention is foruseEnsembl()
to be more straightforward to connect to the most common BioMart instance. Is that not the case for you?