How to use the biodbMirbase connector and its methods.
biodbMirbase 1.4.0
biodbMirbase is a biodb extension package that implements a connector to miRBase mature database Kozomara and Griffiths-Jones (2013).
Install using Bioconductor:
if (!requireNamespace("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install('biodbMirbase')
The first step in using biodbMirbase, is to create an instance of the biodb
class Biodb
from the main biodb package. This is done by calling the
constructor of the class:
mybiodb <- biodb::newInst()
During this step the configuration is set up, the cache system is initialized and extension packages are loaded.
We will see at the end of this vignette that the biodb instance needs to be
terminated with a call to the terminate()
method.
In biodb the connection to a database is handled by a connector instance that you can get from the factory. biodbMirbase implements a connector to a remote database. Here is the code to instantiate a connector:
conn <- mybiodb$getFactory()$createConn('mirbase.mature')
## Loading required package: biodbMirbase
To get some of the first entry IDs (accession numbers) from the database, run:
ids <- conn$getEntryIds(2)
ids
## [1] "MIMAT0000001" "MIMAT0000002"
To retrieve entries, use:
entries <- conn$getEntry(ids)
entries
## [[1]]
## Biodb miRBase mature database entry instance MIMAT0000001.
##
## [[2]]
## Biodb miRBase mature database entry instance MIMAT0000002.
To convert a list of entries into a dataframe, run:
x <- mybiodb$entriesToDataframe(entries)
x
## accession description name
## 1 MIMAT0000001 Caenorhabditis elegans let-7-5p cel-let-7-5p
## 2 MIMAT0000002 Caenorhabditis elegans lin-4-5p cel-lin-4-5p
## aa.seq mirbase.mature.id
## 1 UGAGGUAGUAGGUUGUAUAGUU MIMAT0000001
## 2 UCCCUGAGACCUCAAGUGUGA MIMAT0000002
When done with your biodb instance you have to terminate it, in order to ensure release of resources (file handles, database connection, etc):
mybiodb$terminate()
## INFO [21:18:29.021] Closing BiodbMain instance...
## INFO [21:18:29.022] Connector "mirbase.mature" deleted.
sessionInfo()
## R version 4.3.0 RC (2023-04-13 r84266)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Monterey 12.6.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
##
## locale:
## [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] biodbMirbase_1.4.0 BiocStyle_2.28.0
##
## loaded via a namespace (and not attached):
## [1] rappdirs_0.3.3 sass_0.4.5 utf8_1.2.3
## [4] generics_0.1.3 stringi_1.7.12 RSQLite_2.3.1
## [7] hms_1.1.3 digest_0.6.31 magrittr_2.0.3
## [10] evaluate_0.20 bookdown_0.33 fastmap_1.1.1
## [13] blob_1.2.4 plyr_1.8.8 jsonlite_1.8.4
## [16] progress_1.2.2 DBI_1.1.3 BiocManager_1.30.20
## [19] httr_1.4.5 fansi_1.0.4 XML_3.99-0.14
## [22] jquerylib_0.1.4 cli_3.6.1 rlang_1.1.0
## [25] chk_0.8.1 crayon_1.5.2 dbplyr_2.3.2
## [28] bit64_4.0.5 withr_2.5.0 cachem_1.0.7
## [31] yaml_2.3.7 tools_4.3.0 memoise_2.0.1
## [34] biodb_1.8.0 dplyr_1.1.1 filelock_1.0.2
## [37] curl_5.0.0 vctrs_0.6.1 R6_2.5.1
## [40] BiocFileCache_2.8.0 lifecycle_1.0.3 stringr_1.5.0
## [43] bit_4.0.5 pkgconfig_2.0.3 pillar_1.9.0
## [46] bslib_0.4.2 glue_1.6.2 Rcpp_1.0.10
## [49] lgr_0.4.4 xfun_0.38 tibble_3.2.1
## [52] tidyselect_1.2.0 knitr_1.42 htmltools_0.5.5
## [55] rmarkdown_2.21 compiler_4.3.0 prettyunits_1.1.1
## [58] askpass_1.1 openssl_2.0.6