├── .Rbuildignore
├── .gitattributes
├── .github
├── .gitignore
├── CONTRIBUTING.md
├── issue_template.md
├── pull_request_template.md
└── workflows
│ └── R-CMD-check.yaml
├── .gitignore
├── CONTRIBUTING.md
├── CRAN-SUBMISSION
├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── NEWS.md
├── R
├── biomartr-tools.R
├── connection-tools.R
├── db-get-tools.R
├── db-setup-tools.R
├── download-tools.R
├── entrez-tools.R
├── extract-tools.R
├── filepath-tools.R
├── gb-get-tools.R
├── gb-setup-tools.R
├── log-tools.R
├── mock-tools.R
├── print-tools.R
├── rentrez-wrappers.R
├── restez.R
├── status-tools.R
├── test-tools.R
└── wrappers.R
├── README.Rmd
├── README.md
├── _pkgdown.yml
├── codemeta.json
├── cran-comments.md
├── data
└── record.rda
├── examples
├── count_db_ids.R
├── db_delete.R
├── demo_db_create.R
├── entrez_fetch.R
├── gb_definition_get.R
├── gb_extract.R
├── gb_fasta_get.R
├── gb_organism_get.R
├── gb_record_get.R
├── gb_sequence_get.R
├── gb_version_get.R
├── is_in_db.R
├── list_db_ids.R
├── restez_path_get.R
├── restez_ready.R
└── restez_status.R
├── inst
└── CITATION
├── logo.png
├── man
├── add_rcrd_log.Rd
├── cat_line.Rd
├── char.Rd
├── check_connection.Rd
├── cleanup.Rd
├── connected.Rd
├── connection_get.Rd
├── count_db_ids.Rd
├── db_create.Rd
├── db_delete.Rd
├── db_download.Rd
├── db_download_intern.Rd
├── db_sqlngths_get.Rd
├── db_sqlngths_log.Rd
├── demo_db_create.Rd
├── dir_size.Rd
├── dwnld_path_get.Rd
├── dwnld_rcrd_log.Rd
├── entrez_fasta_get.Rd
├── entrez_fetch.Rd
├── entrez_gb_get.Rd
├── extract_accession.Rd
├── extract_by_patterns.Rd
├── extract_clean_sequence.Rd
├── extract_definition.Rd
├── extract_features.Rd
├── extract_inforecpart.Rd
├── extract_keywords.Rd
├── extract_locus.Rd
├── extract_organism.Rd
├── extract_seqrecpart.Rd
├── extract_sequence.Rd
├── extract_version.Rd
├── file_download.Rd
├── filename_log.Rd
├── flatfile_read.Rd
├── gb_build.Rd
├── gb_definition_get.Rd
├── gb_df_create.Rd
├── gb_df_generate.Rd
├── gb_extract.Rd
├── gb_fasta_get.Rd
├── gb_organism_get.Rd
├── gb_record_get.Rd
├── gb_sequence_get.Rd
├── gb_sql_add.Rd
├── gb_sql_query.Rd
├── gb_version_get.Rd
├── gbrelease_check.Rd
├── gbrelease_get.Rd
├── gbrelease_log.Rd
├── has_data.Rd
├── identify_downloadable_files.Rd
├── is_in_db.Rd
├── last_add_get.Rd
├── last_dwnld_get.Rd
├── last_entry_get.Rd
├── latest_genbank_release.Rd
├── latest_genbank_release_notes.Rd
├── list_db_ids.Rd
├── message_missing.Rd
├── mock_def.Rd
├── mock_gb_df_generate.Rd
├── mock_org.Rd
├── mock_rec.Rd
├── mock_seq.Rd
├── ncbi_acc_get.Rd
├── predict_datasizes.Rd
├── print.status.Rd
├── readme_log.Rd
├── record.Rd
├── restez.Rd
├── restez_connect.Rd
├── restez_disconnect.Rd
├── restez_path_check.Rd
├── restez_path_get.Rd
├── restez_path_set.Rd
├── restez_path_unset.Rd
├── restez_ready.Rd
├── restez_rl.Rd
├── restez_status.Rd
├── search_gz.Rd
├── seshinfo_log.Rd
├── setup.Rd
├── slctn_get.Rd
├── slctn_log.Rd
├── sql_path_get.Rd
├── stat.Rd
├── status_class.Rd
└── testdatadir_get.Rd
├── other
├── demonstration_1.R
├── dev.R
├── generate_records_data.R
├── make_sure_things_work.R
├── phylotar_demo.R
├── random_file_tester.R
├── rodent_build_times.rds
├── rodent_db.R
├── spell_check.R
└── viral_lookup.R
├── paper
├── outline.png
├── paper.bib
├── paper.html
└── paper.md
├── pkgdown
└── favicon
│ ├── apple-touch-icon-120x120.png
│ ├── apple-touch-icon-152x152.png
│ ├── apple-touch-icon-180x180.png
│ ├── apple-touch-icon-60x60.png
│ ├── apple-touch-icon-76x76.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ └── favicon.ico
├── revdep
├── .gitignore
├── README.md
├── cran.md
├── email.yml
├── failures.md
└── problems.md
├── tests
├── test-all.R
└── testthat
│ ├── data
│ ├── records.RData
│ └── release_notes_gb224.RData
│ ├── test-biomartr-tools.R
│ ├── test-connection-tools.R
│ ├── test-db-tools.R
│ ├── test-entrez-tools.R
│ ├── test-extract-tools.R
│ ├── test-filepath-tools.R
│ ├── test-gb-setup-tools.R
│ ├── test-get-tools.R
│ ├── test-log-tools.R
│ ├── test-mock-tools.R
│ ├── test-print-tools.R
│ ├── test-rentrez-wrappers.R
│ ├── test-status-tools.R
│ └── test-test-tools.R
└── vignettes
├── 1_rodents.Rmd
├── 1_rodents.Rmd.orig
├── 2_search_and_fetch.Rmd
├── 2_search_and_fetch.Rmd.orig
├── 3_parsing.Rmd
├── 3_parsing.Rmd.orig
├── 4_phylotar.Rmd
├── 4_phylotar.Rmd.orig
├── 5_tips_and_tricks.Rmd
├── 5_tips_and_tricks.Rmd.orig
├── precompile.R
└── restez.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^codemeta\.json$
2 | ^restez_test$
3 | ^paper$
4 | ^other$
5 | ^rodents_copy$
6 | ^rodents$
7 | ^vignettes$
8 | ^examples$
9 | ^.*\.Rproj$
10 | ^\.Rproj\.user$
11 | ^README\.Rmd$
12 | ^README-.*\.png$
13 | ^docs$
14 | ^README\.html$
15 | ^CONTRIBUTING\.md$
16 | ^logo\.png$
17 | ^_pkgdown\.yml$
18 | ^\.gitattributes$
19 | ^pkgdown$
20 | ^cran-comments\.md$
21 | ^\.github$
22 | ^CRAN-SUBMISSION$
23 | ^revdep$
24 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.html linguist-documentation=true
2 |
3 |
--------------------------------------------------------------------------------
/.github/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # CONTRIBUTING #
2 |
3 | ### Fixing typos
4 |
5 | Small typos or grammatical errors in documentation may be edited directly using
6 | the GitHub web interface, so long as the changes are made in the _source_ file.
7 |
8 | * YES: you edit a roxygen comment in a `.R` file below `R/`.
9 | * NO: you edit an `.Rd` file below `man/`.
10 |
11 | ### Prerequisites
12 |
13 | Before you make a substantial pull request, you should always file an issue and
14 | make sure someone from the team agrees that it’s a problem. If you’ve found a
15 | bug, create an associated issue and illustrate the bug with a minimal
16 | [reprex](https://www.tidyverse.org/help/#reprex).
17 |
18 | ### Pull request process
19 |
20 | * We recommend that you create a Git branch for each pull request (PR).
21 | * Look at the Travis and AppVeyor build status before and after making changes.
22 | The `README` should contain badges for any continuous integration services used
23 | by the package.
24 | * We recommend the tidyverse [style guide](http://style.tidyverse.org).
25 | You can use the [styler](https://CRAN.R-project.org/package=styler) package to
26 | apply these styles, but please don't restyle code that has nothing to do with
27 | your PR.
28 | * We use [roxygen2](https://cran.r-project.org/package=roxygen2).
29 | * We use [testthat](https://cran.r-project.org/package=testthat). Contributions
30 | with test cases included are easier to accept.
31 | * For user-facing changes, add a bullet to the top of `NEWS.md` below the
32 | current development version header describing the changes made followed by your
33 | GitHub username, and links to relevant issue(s)/PR(s).
34 |
35 | ### Code of Conduct
36 |
37 | Please note that the restez project is released with a
38 | [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this
39 | project you agree to abide by its terms.
40 |
41 | ### See rOpenSci [contributing guide](https://ropensci.github.io/dev_guide/contributingguide.html)
42 | for further details.
43 |
44 | ### Discussion forum
45 |
46 | Check out our [discussion forum](https://discuss.ropensci.org) if you think your issue requires a longer form discussion.
47 |
48 | ### Prefer to Email?
49 |
50 | Email the person listed as maintainer in the `DESCRIPTION` file of this repo.
51 |
52 | Though note that private discussions over email don't help others - of course email is totally warranted if it's a sensitive problem of any kind.
53 |
54 | ### Thanks for contributing!
55 |
56 | This contributing guide is adapted from the tidyverse contributing guide available at https://raw.githubusercontent.com/r-lib/usethis/master/inst/templates/tidy-contributing.md
57 |
58 |
59 |
--------------------------------------------------------------------------------
/.github/issue_template.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Session Info
6 |
7 | ```r
8 |
9 | ```
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ## Description
8 |
9 |
10 | ## Related Issue
11 |
14 |
15 | ## Example
16 |
18 |
19 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.github/workflows/R-CMD-check.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 |
9 | name: R-CMD-check
10 |
11 | jobs:
12 | R-CMD-check:
13 | runs-on: ${{ matrix.config.os }}
14 |
15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16 |
17 | strategy:
18 | fail-fast: false
19 | matrix:
20 | config:
21 | - {os: macOS-latest, r: 'release'}
22 | - {os: windows-latest, r: 'release'}
23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24 | - {os: ubuntu-latest, r: 'release'}
25 | - {os: ubuntu-latest, r: 'oldrel-1'}
26 |
27 | env:
28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29 | R_KEEP_PKG_SOURCE: yes
30 |
31 | steps:
32 | - uses: actions/checkout@v2
33 |
34 | - uses: r-lib/actions/setup-pandoc@v2
35 |
36 | - uses: r-lib/actions/setup-r@v2
37 | with:
38 | r-version: ${{ matrix.config.r }}
39 | http-user-agent: ${{ matrix.config.http-user-agent }}
40 | use-public-rspm: true
41 |
42 | - uses: r-lib/actions/setup-r-dependencies@v2
43 | with:
44 | extra-packages: any::rcmdcheck, any::XML
45 | needs: check
46 |
47 | - uses: r-lib/actions/check-r-package@v2
48 | with:
49 | upload-snapshots: true
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | restez/
2 | # data
3 | *.seq
4 | restez_database
5 | .Rprofile
6 | README.html
7 | rodents/
8 | # Working files
9 | working*
10 | # History files
11 | .Rhistory
12 | .Rapp.history
13 | # Session Data files
14 | .RData
15 | restez.Rproj
16 | # Example code in package build process
17 | *-Ex.R
18 | # Output files from R CMD build
19 | /*.tar.gz
20 | # Output files from R CMD check
21 | /*.Rcheck/
22 | # RStudio files
23 | .Rproj.user/
24 | # produced vignettes
25 | vignettes/*.html
26 | vignettes/*.pdf
27 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
28 | .httr-oauth
29 | # knitr and R markdown default cache directories
30 | /*_cache/
31 | /cache/
32 | # Temporary files created by R markdown
33 | *.utf8.md
34 | *.knit.md
35 | .Rproj.user
36 | inst/doc
37 |
--------------------------------------------------------------------------------
/CRAN-SUBMISSION:
--------------------------------------------------------------------------------
1 | Version: 2.1.5
2 | Date: 2025-03-06 23:44:12 UTC
3 | SHA: 1c3d9896f0da0000a5c396dc90c0ad43bdf2c628
4 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: restez
2 | Type: Package
3 | Title: Create and Query a Local Copy of 'GenBank' in R
4 | Version: 2.1.5.9000
5 | Authors@R: c(
6 | person(
7 | given = "Joel H.",
8 | family = "Nitta",
9 | role = c("aut", "cre"),
10 | email = "joelnitta@gmail.com",
11 | comment = c(ORCID = "0000-0003-4719-7472")),
12 | person(
13 | given = "Dom",
14 | family = "Bennett",
15 | role = "aut",
16 | email = "dominic.john.bennett@gmail.com",
17 | comment = c(ORCID = "0000-0003-2722-1359"))
18 | )
19 | Maintainer: Joel H. Nitta
20 | Description: Download large sections of
21 | 'GenBank' and generate a local
22 | SQL-based database. A user can then query this database using 'restez'
23 | functions or through 'rentrez'
24 | wrappers.
25 | URL: https://github.com/ropensci/restez,
26 | https://docs.ropensci.org/restez/
27 | BugReports: https://github.com/ropensci/restez/issues
28 | License: MIT + file LICENSE
29 | Encoding: UTF-8
30 | LazyData: true
31 | Depends:
32 | R (>= 3.3.0)
33 | Imports:
34 | utils,
35 | rentrez,
36 | DBI (>= 1.0.0),
37 | curl,
38 | cli,
39 | crayon,
40 | stringi,
41 | duckdb,
42 | fs,
43 | assertthat,
44 | ape
45 | Suggests:
46 | sessioninfo,
47 | testthat,
48 | knitr,
49 | R.utils,
50 | rmarkdown,
51 | mockery
52 | RoxygenNote: 7.3.2
53 | Roxygen: list(markdown = TRUE)
54 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2022
2 | COPYRIGHT HOLDER: Antonelli Lab and Joel Nitta
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(print,status)
4 | export(count_db_ids)
5 | export(db_create)
6 | export(db_delete)
7 | export(db_download)
8 | export(demo_db_create)
9 | export(entrez_fetch)
10 | export(gb_definition_get)
11 | export(gb_extract)
12 | export(gb_fasta_get)
13 | export(gb_organism_get)
14 | export(gb_record_get)
15 | export(gb_sequence_get)
16 | export(gb_version_get)
17 | export(is_in_db)
18 | export(list_db_ids)
19 | export(ncbi_acc_get)
20 | export(restez_connect)
21 | export(restez_disconnect)
22 | export(restez_path_get)
23 | export(restez_path_set)
24 | export(restez_path_unset)
25 | export(restez_ready)
26 | export(restez_status)
27 |
--------------------------------------------------------------------------------
/R/biomartr-tools.R:
--------------------------------------------------------------------------------
1 | #' @title Helper function to test if a stable internet connection
2 | #' can be established.
3 | #' @description All retrieval functions need a stable
4 | #' internet connection to work properly. This internal function pings
5 | #' the google homepage and throws an error if it cannot be reached.
6 | #' @author Hajk-Georg Drost
7 | #' @family private
8 | # originally connected.to.internet
9 | check_connection <- function() {
10 | check_url <- "https://www.ncbi.nlm.nih.gov/"
11 | if (url_exists(check_url)) {
12 | TRUE
13 | } else {
14 | msg <- paste0("Unable to connect to ", char(check_url),
15 | "Are you connected to the internet?")
16 | stop(msg, call. = FALSE)
17 | }
18 | }
19 |
20 | url_exists <- function(url){
21 | h <- curl::new_handle(nobody = TRUE)
22 | tryCatch({
23 | req <- curl::curl_fetch_memory(url, handle = h)
24 | return(req$status_code < 400)
25 | }, error = function(e){FALSE})
26 | }
27 |
--------------------------------------------------------------------------------
/R/connection-tools.R:
--------------------------------------------------------------------------------
1 | #' @name restez_ready
2 | #' @title Is restez ready?
3 | #' @family setup
4 | #' @description Returns TRUE if a restez SQL database is available.
5 | #' Use restez_status() for more information.
6 | #' @return Logical
7 | #' @export
8 | #' @example examples/restez_ready.R
9 | restez_ready <- function() {
10 | fp <- sql_path_get()
11 | inherits(fp, 'character') && length(fp) == 1 && file.exists(fp)
12 | }
13 |
14 | #' @name connected
15 | #' @title Is restez connected?
16 | #' @family private
17 | #' @description Returns TRUE if a restez SQL database has been connected.
18 | #' @return Logical
19 | connected <- function() {
20 | res <- FALSE
21 | connection <- getOption('restez_connection')
22 | if (is.null(connection)) return(FALSE)
23 | if (inherits(x = connection, what = 'duckdb_connection')) {
24 | res <- TRUE
25 | }
26 | res
27 | }
28 |
29 | #' @name has_data
30 | #' @title Does the connected database have data?
31 | #' @family private
32 | #' @description Returns TRUE if a restez SQL database has data.
33 | #' @return Logical
34 | has_data <- function() {
35 | tryCatch(expr = {
36 | suppressWarnings(list_db_ids(n = 1))
37 | TRUE
38 | }, error = function(e) FALSE)
39 | }
40 |
41 | #' @name restez_connect
42 | #' @title Connect to the restez database
43 | #' @family private
44 | #' @description Sets a connection to the local database.
45 | #' @param read_only Logical; should the connection be made in read-only
46 | #' mode? Read-only mode is required for multiple R processes to access
47 | #' the database simultaneously. Default FALSE.
48 | #' @return NULL
49 | #' @export
50 | restez_connect <- function(read_only = FALSE) {
51 | restez_path_check()
52 | connection <- DBI::dbConnect(
53 | drv = duckdb::duckdb(),
54 | dbdir = sql_path_get(),
55 | read_only = read_only)
56 | options('restez_connection' = connection)
57 | invisible(NULL)
58 | }
59 |
60 | #' @name restez_disconnect
61 | #' @title Disconnect from restez database
62 | #' @family private
63 | #' @description Safely disconnect from the restez connection
64 | #' @return NULL
65 | #' @export
66 | restez_disconnect <- function() {
67 | if (connected()) {
68 | connection <- getOption('restez_connection')
69 | DBI::dbDisconnect(conn = connection, shutdown = TRUE)
70 | }
71 | options('restez_connection' = NULL)
72 | invisible(NULL)
73 | }
74 |
75 | #' @name connection_get
76 | #' @title Retrieve restez connection
77 | #' @family private
78 | #' @description Safely acquire the restez connection. Raises error if no
79 | #' connection set.
80 | #' @return connection
81 | connection_get <- function() {
82 | if (!connected()) {
83 | stop('No restez connection. Did you run `restez_connect`?', call. = FALSE)
84 | }
85 | getOption('restez_connection')
86 | }
87 |
--------------------------------------------------------------------------------
/R/db-get-tools.R:
--------------------------------------------------------------------------------
1 | #' @name list_db_ids
2 | #' @title List database IDs
3 | #' @family database
4 | #' @description Return a vector of all IDs in
5 | #' a database.
6 | #' @details Warning: can return very large vectors
7 | #' for large databases.
8 | #' @param db character, database name
9 | #' @param n Maximum number of IDs to return, if NULL returns all
10 | #' @return vector of characters
11 | #' @export
12 | #' @example examples/list_db_ids.R
13 | list_db_ids <- function(db = 'nucleotide', n=100) {
14 | on.exit(restez_disconnect())
15 | # first close any connection if one exists
16 | restez_disconnect()
17 | restez_connect(read_only = TRUE)
18 | connection <- connection_get()
19 | if (db == 'nucleotide') {
20 | sttmnt <- "SELECT accession FROM nucleotide"
21 | if (!is.null(n)) {
22 | sttmnt <- paste(sttmnt, 'LIMIT', as.integer(n))
23 | }
24 | res <- DBI::dbGetQuery(conn = connection, statement = sttmnt)
25 | }
26 | if (!is.null(n)) {
27 | msg <- paste0('Number of ids returned was limited to [', n, '].\n',
28 | 'Set `n=NULL` to return all ids.')
29 | warning(msg)
30 | }
31 | restez_disconnect()
32 | res[[1]]
33 | }
34 |
35 | #' @name is_in_db
36 | #' @title Is in db
37 | #' @family database
38 | #' @description Determine whether an id(s)
39 | #' is/are present in a database.
40 | #' @param id character, sequence accession ID(s)
41 | #' @param db character, database name
42 | #' @return named vector of booleans
43 | #' @export
44 | #' @example examples/is_in_db.R
45 | is_in_db <- function(id, db = 'nucleotide') {
46 | accssns <- sub(pattern = '\\.[0-9]+', replacement = '',
47 | x = id)
48 | db_res <- gb_sql_query(nm = 'version', id = id)
49 | res <- accssns %in% db_res[['accession']]
50 | names(res) <- id
51 | res
52 | }
53 |
54 | #' @name count_db_ids
55 | #' @title Return the number of ids
56 | #' @description Return the number of ids in a user's restez database.
57 | #' @details Requires an open connection. If no connection or db 0 is returned.
58 | #' @param db character, database name
59 | #' @return integer
60 | #' @family database
61 | #' @export
62 | #' @example examples/count_db_ids.R
63 | count_db_ids <- function(db = 'nucleotide') {
64 | on.exit(restez_disconnect())
65 | if (!restez_ready()) {
66 | warning('No database detected. Did you run `db_create()`?')
67 | return(0L)
68 | }
69 | # first close any connection if one exists
70 | restez_disconnect()
71 | restez_connect(read_only = TRUE)
72 | connection <- connection_get()
73 | res <- DBI::dbGetQuery(connection, "SELECT count(*) FROM nucleotide")
74 | restez_disconnect()
75 | as.integer(res[[1]])
76 | }
77 |
--------------------------------------------------------------------------------
/R/entrez-tools.R:
--------------------------------------------------------------------------------
1 | #' @name message_missing
2 | #' @title Produce message of missing IDs
3 | #' @description Sends message to console stating number of missing IDs.
4 | #' @param n Number of missing IDs
5 | #' @return NULL
6 | #' @family private
7 | message_missing <- function(n) {
8 | msg <- paste0('[', n, '] id(s) are unavailable locally, searching online.')
9 | message(msg)
10 | }
11 |
12 | #' Wrapper for rentrez::entrez_fetch(), used for mocking during tests
13 | #' @noRd
14 | entrez_fetch_wrap <- function(...) {
15 | rentrez::entrez_fetch(...)
16 | }
17 |
18 | #' @name entrez_fasta_get
19 | #' @title Get Entrez fasta
20 | #' @description Return fasta format as expected from
21 | #' an Entrez call. If not all IDs are returned, will
22 | #' run rentrez::entrez_fetch.
23 | #' @param id vector, unique ID(s) for record(s)
24 | #' @param ... arguments passed on to rentrez
25 | #' @return character string containing the file created
26 | #' @family private
27 | entrez_fasta_get <- function(id, ...) {
28 | id <- sub(pattern = '\\.[0-9]+', replacement = '', x = id)
29 | fastas <- gb_fasta_get(id = id)
30 | if (length(fastas) > 0) {
31 | res <- paste(fastas, collapse = '')
32 | mssng <- id[!id %in% names(fastas)]
33 | } else {
34 | mssng <- id
35 | res <- ''
36 | }
37 | if (length(mssng) > 0) {
38 | message_missing(length(mssng))
39 | rentrez_fastas <- entrez_fetch_wrap(id = mssng, ...)
40 | res <- paste0(res, rentrez_fastas)
41 | }
42 | res
43 | }
44 |
45 | #' @name entrez_gb_get
46 | #' @title Get Entrez GenBank record
47 | #' @description Return gb and gbwithparts format as expected from
48 | #' an Entrez call. If not all IDs are returned, will
49 | #' run rentrez::entrez_fetch.
50 | #' @param id vector, unique ID(s) for record(s)
51 | #' @param ... arguments passed on to rentrez
52 | #' @return character string containing the file created
53 | #' @family private
54 | entrez_gb_get <- function(id, ...) {
55 | id <- sub(pattern = '\\.[0-9]+', replacement = '', x = id)
56 | recs <- gb_record_get(id = id)
57 | if (length(recs) > 0) {
58 | res <- paste(recs, collapse = '\n\n')
59 | res <- paste0(res, '\n\n')
60 | mssng <- id[!id %in% names(recs)]
61 | } else {
62 | mssng <- id
63 | res <- ''
64 | }
65 | if (length(mssng) > 0) {
66 | message_missing(length(mssng))
67 | rentrez_recs <- entrez_fetch_wrap(id = mssng, ...)
68 | res <- paste0(res, rentrez_recs)
69 | }
70 | res
71 | }
72 |
--------------------------------------------------------------------------------
/R/print-tools.R:
--------------------------------------------------------------------------------
1 | # Framework copied from pkgdown
2 | #' @name stat
3 | #' @title Print blue
4 | #' @description Print to console blue text to indicate a number/statistic.
5 | #' @param ... Any number of text arguments to print, character
6 | #' @return coloured character encoding, character
7 | #' @family private
8 | stat <- function(...) {
9 | crayon::blue(...)
10 | }
11 |
12 | #' @name char
13 | #' @title Print green
14 | #' @description Print to console green text to indicate a name/filepath/text
15 | #' @param x Text to print, character
16 | #' @return coloured character encoding, character
17 | #' @family private
18 | char <- function(x) {
19 | crayon::green(encodeString(x, quote = "'"))
20 | }
21 |
22 | #' @name cat_line
23 | #' @title Cat lines
24 | #' @description Helper function for printing lines to console. Automatically
25 | #' formats lines by adding newlines.
26 | #' @param ... Text to print, character
27 | #' @return NULL
28 | #' @family private
29 | cat_line <- function(...) {
30 | cat(paste0(..., "\n"), sep = "")
31 | }
32 |
--------------------------------------------------------------------------------
/R/rentrez-wrappers.R:
--------------------------------------------------------------------------------
1 | #' @name entrez_fetch
2 | #' @title Entrez fetch
3 | #' @family entrez
4 | #' @description Wrapper for rentrez::entrez_fetch.
5 | #' @details Attempts to first search local database with user-specified
6 | #' parameters, if the record is missing in the database, the function then
7 | #' calls rentrez::entrez_fetch to search GenBank remotely.
8 | #'
9 | #' `rettype='fasta'` and `rettype='gb'` are respectively equivalent to
10 | #' [gb_fasta_get()] and [gb_record_get()].
11 | #'
12 | #' @note It is advisable to call restez and rentrez functions with '::' notation
13 | #' rather than library() calls to avoid namespace issues. e.g.
14 | #' restez::entrez_fetch().
15 | #'
16 | #' @section Supported return types and modes:
17 | #' XML retmode is not supported. Rettypes 'seqid', 'ft', 'acc' and 'uilist'
18 | #' are also not supported.
19 | #' @param db character, name of the database
20 | #' @param id vector, unique ID(s) for record(s)
21 | #' @param rettype character, data format
22 | #' @param retmode character, data mode
23 | #' @param ... Arguments to be passed on to rentrez
24 | #' @seealso [rentrez::entrez_fetch()]
25 | #' @return character string containing the file created
26 | #' @example examples/entrez_fetch.R
27 | #' @export
28 | entrez_fetch <- function(db, id=NULL, rettype, retmode="", ...) {
29 | # NCBI table https://tinyurl.com/yb5e7q9b
30 | if (db %in% c('nucleotide', 'nuccore')) {
31 | if (rettype == 'fasta' & retmode != 'xml') {
32 | return(entrez_fasta_get(db = db, id = id, rettype = rettype,
33 | retmode = retmode, ...))
34 | }
35 | if (rettype == 'gb' & retmode != 'xml') {
36 | return(entrez_gb_get(db = db, id = id, rettype = rettype,
37 | retmode = retmode, ...))
38 | }
39 | if (rettype == 'gbwithparts' & retmode != 'xml') {
40 | # TODO: I have detected no difference between gb and gbwithparts
41 | return(entrez_gb_get(db = db, id = id, rettype = rettype,
42 | retmode = retmode, ...))
43 | }
44 | # TODO
45 | # if (rettype == 'ft' & rettype != 'xml') {
46 | # return(entrez_ft_get(id = id))
47 | # }
48 | }
49 | message('Invalid args for restez, searching online ....')
50 | rentrez::entrez_fetch(db = db, id = id, rettype = rettype,
51 | retmode = retmode, ...)
52 | }
53 |
--------------------------------------------------------------------------------
/R/restez.R:
--------------------------------------------------------------------------------
1 | #' restez: Create and Query a Local Copy of GenBank in R
2 | #'
3 | #' The restez package comes with five families of functions:
4 | #' setup, database, get, entrez and internal/private.
5 | #'
6 | #' @section Setup functions:
7 | #' These functions allow a user to set the filepath for where the GenBank files
8 | #' should be stored, create connections and verify these settings.
9 | #'
10 | #' @section Database functions:
11 | #' These functions download specific parts of GenBank and create the local
12 | #' SQL-like database.
13 | #'
14 | #' @section GenBank functions:
15 | #' These functions allow a user to query the local SQL-like database. A
16 | #' user can use an NCBI accession ID to retrieve sequences or whole GenBank
17 | #' records.
18 | #'
19 | #' @section Entrez functions:
20 | #' The entrez functions are wrappers to the `entrez_*` functions in the
21 | #' rentrez package. e.g the restez's entrez_fetch will first try to search the
22 | #' local database, if it fails it will then call rentrez's
23 | #' [rentrez::entrez_fetch()] with the same arguments.
24 | #'
25 | #' @section Private/internal functions:
26 | #' These functions work behind the scenes to make everything work. If you're
27 | #' curious you can read their documentation using the form
28 | #' `?restez:::functionname`.
29 | #'
30 | #' @name restez
31 | #' @keywords internal
32 | "_PACKAGE"
33 |
--------------------------------------------------------------------------------
/R/test-tools.R:
--------------------------------------------------------------------------------
1 | #' @name cleanup
2 | #' @title Clean up test data
3 | #' @description Removes all temporary test data created.
4 | #' @return NULL
5 | #' @family private
6 | cleanup <- function() {
7 | restez_path_unset()
8 | if (dir.exists('test_db_fldr')) {
9 | unlink('test_db_fldr', recursive = TRUE)
10 | }
11 | if (file.exists('test_records.txt')) {
12 | file.remove('test_records.txt')
13 | }
14 | }
15 |
16 | #' @name setup
17 | #' @title Set up test common test data
18 | #' @description Creates temporary test folders.
19 | #' @return NULL
20 | #' @family private
21 | setup <- function() {
22 | dir.create('test_db_fldr')
23 | restez_path_set(filepath = 'test_db_fldr')
24 | }
25 |
26 | #' @name testdatadir_get
27 | #' @title Get test data directory
28 | #' @description Get the folder containing test data.
29 | #' @return NULL
30 | #' @family private
31 | testdatadir_get <- function() {
32 | wd <- getwd()
33 | if (grepl('testthat', wd)) {
34 | data_d <- file.path('data')
35 | } else {
36 | # for running test at package level
37 | data_d <- file.path('tests', 'testthat', 'data')
38 | }
39 | data_d
40 | }
41 |
--------------------------------------------------------------------------------
/R/wrappers.R:
--------------------------------------------------------------------------------
1 | #' @name restez_rl
2 | #' @title Restez readline
3 | #' @description Wrapper for base readline.
4 | #' @param prompt character, display text
5 | #' @return character
6 | #' @family private
7 | restez_rl <- function(prompt) {
8 | base::readline(prompt)
9 | }
10 |
--------------------------------------------------------------------------------
/cran-comments.md:
--------------------------------------------------------------------------------
1 | # restez v2.1.5
2 |
3 | This is a bug fix to address changed behavior of a dependency
4 | (https://github.com/ropensci/restez/issues/64) that is currently causing
5 | build failures. It also removes use of with_mock()
6 | (https://github.com/ropensci/restez/issues/63)
7 |
8 | ## Test environments
9 |
10 | * local OS X install, R 4.4.1
11 | * Windows Server 2022 x64 (winbuilder)
12 |
13 | ## R CMD check results
14 |
15 | There were no ERRORs, WARNINGs, or NOTEs.
16 |
17 | ## Reverse dependencies
18 |
19 | There are no reverse dependencies currently on CRAN.
20 |
--------------------------------------------------------------------------------
/data/record.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/data/record.rda
--------------------------------------------------------------------------------
/examples/count_db_ids.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (count_db_ids())
5 |
6 | # delete demo after example
7 | db_delete(everything = TRUE)
8 |
--------------------------------------------------------------------------------
/examples/db_delete.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | fp <- tempdir()
3 | restez_path_set(filepath = fp)
4 | demo_db_create(n = 10)
5 | db_delete(everything = FALSE)
6 | # Will not run: gb_sequence_get(id = 'demo_1')
7 | # only the SQL database is deleted
8 | db_delete(everything = TRUE)
9 | # Now returns NULL
10 | (restez_path_get())
11 |
--------------------------------------------------------------------------------
/examples/demo_db_create.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | # set the restez path to a temporary dir
3 | restez_path_set(filepath = tempdir())
4 | # create demo database
5 | demo_db_create(n = 5)
6 | # in the demo, IDs are 'demo_1', 'demo_2' ...
7 | (gb_sequence_get(id = 'demo_1'))
8 |
9 | # Delete a demo database after an example
10 | db_delete(everything = TRUE)
11 |
--------------------------------------------------------------------------------
/examples/entrez_fetch.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(tempdir())
3 | demo_db_create(n = 5)
4 | # return fasta record
5 | fasta_res <- entrez_fetch(db = 'nucleotide',
6 | id = c('demo_1', 'demo_2'),
7 | rettype = 'fasta')
8 | cat(fasta_res)
9 | # return whole GB record in text format
10 | gb_res <- entrez_fetch(db = 'nucleotide',
11 | id = c('demo_1', 'demo_2'),
12 | rettype = 'gb')
13 | cat(gb_res)
14 | # NOT RUN
15 | # whereas these request would go through rentrez
16 | # fasta_res <- entrez_fetch(db = 'nucleotide',
17 | # id = c('S71333', 'S71334'),
18 | # rettype = 'fasta')
19 | # gb_res <- entrez_fetch(db = 'nucleotide',
20 | # id = c('S71333', 'S71334'),
21 | # rettype = 'gb')
22 |
23 | # delete demo after example
24 | db_delete(everything = TRUE)
25 |
--------------------------------------------------------------------------------
/examples/gb_definition_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (def <- gb_definition_get(id = 'demo_1'))
5 | (defs <- gb_definition_get(id = c('demo_1', 'demo_2')))
6 |
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
--------------------------------------------------------------------------------
/examples/gb_extract.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | data('record')
3 | (gb_extract(record = record, what = 'locus'))
4 |
--------------------------------------------------------------------------------
/examples/gb_fasta_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (fasta <- gb_fasta_get(id = 'demo_1'))
5 | (fastas <- gb_fasta_get(id = c('demo_1', 'demo_2')))
6 |
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
--------------------------------------------------------------------------------
/examples/gb_organism_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (org <- gb_organism_get(id = 'demo_1'))
5 | (orgs <- gb_organism_get(id = c('demo_1', 'demo_2')))
6 |
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
--------------------------------------------------------------------------------
/examples/gb_record_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (rec <- gb_record_get(id = 'demo_1'))
5 | (recs <- gb_record_get(id = c('demo_1', 'demo_2')))
6 |
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
--------------------------------------------------------------------------------
/examples/gb_sequence_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (seq <- gb_sequence_get(id = 'demo_1'))
5 | (seqs <- gb_sequence_get(id = c('demo_1', 'demo_2')))
6 | (fasta_dnabin <- gb_sequence_get(id = 'demo_1', dnabin = TRUE))
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
11 |
--------------------------------------------------------------------------------
/examples/gb_version_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | (ver <- gb_version_get(id = 'demo_1'))
5 | (vers <- gb_version_get(id = c('demo_1', 'demo_2')))
6 |
7 |
8 | # delete demo after example
9 | db_delete(everything = TRUE)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/is_in_db.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | # set the restez path to a temporary dir
3 | restez_path_set(filepath = tempdir())
4 | # create demo database
5 | demo_db_create(n = 5)
6 | # in the demo, IDs are 'demo_1', 'demo_2' ...
7 | ids <- c('thisisnotanid', 'demo_1', 'demo_2')
8 | (is_in_db(id = ids))
9 |
10 |
11 | # delete demo after example
12 | db_delete(everything = TRUE)
13 |
--------------------------------------------------------------------------------
/examples/list_db_ids.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | restez_path_set(filepath = tempdir())
3 | demo_db_create(n = 5)
4 | # Warning: not recommended for real databases
5 | # with potentially millions of IDs
6 | all_ids <- list_db_ids()
7 |
8 |
9 | # What shall we do with these IDs?
10 | # ... how about make a mock fasta file
11 | seqs <- gb_sequence_get(id = all_ids)
12 | defs <- gb_definition_get(id = all_ids)
13 | # paste together
14 | fasta_seqs <- paste0('>', defs, '\n', seqs)
15 | fasta_file <- paste0(fasta_seqs, collapse = '\n')
16 | cat(fasta_file)
17 |
18 |
19 | # delete after example
20 | db_delete(everything = TRUE)
21 |
--------------------------------------------------------------------------------
/examples/restez_path_get.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | # set a restez path with a tempdir
3 | restez_path_set(filepath = tempdir())
4 | # check what the set path is
5 | (restez_path_get())
6 |
--------------------------------------------------------------------------------
/examples/restez_ready.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | fp <- tempdir()
3 | restez_path_set(filepath = fp)
4 | demo_db_create(n = 5)
5 | (restez_ready())
6 | db_delete(everything = TRUE)
7 | (restez_ready())
8 |
--------------------------------------------------------------------------------
/examples/restez_status.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | fp <- tempdir()
3 | restez_path_set(filepath = fp)
4 | demo_db_create(n = 5)
5 | restez_status()
6 | db_delete(everything = TRUE)
7 | # Errors:
8 | # restez_status()
9 |
--------------------------------------------------------------------------------
/inst/CITATION:
--------------------------------------------------------------------------------
1 | bibentry(
2 | bibtype = "Article",
3 | author = c(
4 | person(
5 | given = "Dominic J.",
6 | family = "Bennett",
7 | role = "aut"
8 | ),
9 | person(
10 | given = "Hannes",
11 | family = "Hettling",
12 | role = "aut"
13 | ),
14 | person(
15 | given = "Daniele",
16 | family = "Silvestro",
17 | role = "aut"
18 | ),
19 | person(
20 | given = "Rutger",
21 | family = "Vos",
22 | role = "aut"
23 | ),
24 | person(
25 | given = "Alexandre",
26 | family = "Antonelli",
27 | role = "aut"
28 | )
29 | ),
30 | title = "restez: Create and Query a Local Copy of GenBank in R",
31 | journal = "The Journal of Open Source Software",
32 | year = 2018,
33 | number = 31,
34 | pages = 1102,
35 | volume = 3,
36 | doi = "10.21105/joss.01102"
37 | )
38 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/logo.png
--------------------------------------------------------------------------------
/man/cat_line.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/print-tools.R
3 | \name{cat_line}
4 | \alias{cat_line}
5 | \title{Cat lines}
6 | \usage{
7 | cat_line(...)
8 | }
9 | \arguments{
10 | \item{...}{Text to print, character}
11 | }
12 | \description{
13 | Helper function for printing lines to console. Automatically
14 | formats lines by adding newlines.
15 | }
16 | \seealso{
17 | Other private:
18 | \code{\link{add_rcrd_log}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{message_missing}()},
63 | \code{\link{mock_def}()},
64 | \code{\link{mock_gb_df_generate}()},
65 | \code{\link{mock_org}()},
66 | \code{\link{mock_rec}()},
67 | \code{\link{mock_seq}()},
68 | \code{\link{predict_datasizes}()},
69 | \code{\link{readme_log}()},
70 | \code{\link{restez_connect}()},
71 | \code{\link{restez_disconnect}()},
72 | \code{\link{restez_path_check}()},
73 | \code{\link{restez_rl}()},
74 | \code{\link{search_gz}()},
75 | \code{\link{seshinfo_log}()},
76 | \code{\link{setup}()},
77 | \code{\link{slctn_get}()},
78 | \code{\link{slctn_log}()},
79 | \code{\link{sql_path_get}()},
80 | \code{\link{stat}()},
81 | \code{\link{status_class}()},
82 | \code{\link{testdatadir_get}()}
83 | }
84 | \concept{private}
85 |
--------------------------------------------------------------------------------
/man/char.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/print-tools.R
3 | \name{char}
4 | \alias{char}
5 | \title{Print green}
6 | \usage{
7 | char(x)
8 | }
9 | \arguments{
10 | \item{x}{Text to print, character}
11 | }
12 | \value{
13 | coloured character encoding, character
14 | }
15 | \description{
16 | Print to console green text to indicate a name/filepath/text
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{check_connection}()},
23 | \code{\link{cleanup}()},
24 | \code{\link{connected}()},
25 | \code{\link{connection_get}()},
26 | \code{\link{db_download_intern}()},
27 | \code{\link{db_sqlngths_get}()},
28 | \code{\link{db_sqlngths_log}()},
29 | \code{\link{dir_size}()},
30 | \code{\link{dwnld_path_get}()},
31 | \code{\link{dwnld_rcrd_log}()},
32 | \code{\link{entrez_fasta_get}()},
33 | \code{\link{entrez_gb_get}()},
34 | \code{\link{extract_accession}()},
35 | \code{\link{extract_by_patterns}()},
36 | \code{\link{extract_clean_sequence}()},
37 | \code{\link{extract_definition}()},
38 | \code{\link{extract_features}()},
39 | \code{\link{extract_inforecpart}()},
40 | \code{\link{extract_keywords}()},
41 | \code{\link{extract_locus}()},
42 | \code{\link{extract_organism}()},
43 | \code{\link{extract_seqrecpart}()},
44 | \code{\link{extract_sequence}()},
45 | \code{\link{extract_version}()},
46 | \code{\link{file_download}()},
47 | \code{\link{filename_log}()},
48 | \code{\link{flatfile_read}()},
49 | \code{\link{gb_build}()},
50 | \code{\link{gb_df_create}()},
51 | \code{\link{gb_df_generate}()},
52 | \code{\link{gb_sql_add}()},
53 | \code{\link{gb_sql_query}()},
54 | \code{\link{gbrelease_check}()},
55 | \code{\link{gbrelease_get}()},
56 | \code{\link{gbrelease_log}()},
57 | \code{\link{has_data}()},
58 | \code{\link{identify_downloadable_files}()},
59 | \code{\link{last_add_get}()},
60 | \code{\link{last_dwnld_get}()},
61 | \code{\link{last_entry_get}()},
62 | \code{\link{latest_genbank_release}()},
63 | \code{\link{latest_genbank_release_notes}()},
64 | \code{\link{message_missing}()},
65 | \code{\link{mock_def}()},
66 | \code{\link{mock_gb_df_generate}()},
67 | \code{\link{mock_org}()},
68 | \code{\link{mock_rec}()},
69 | \code{\link{mock_seq}()},
70 | \code{\link{predict_datasizes}()},
71 | \code{\link{readme_log}()},
72 | \code{\link{restez_connect}()},
73 | \code{\link{restez_disconnect}()},
74 | \code{\link{restez_path_check}()},
75 | \code{\link{restez_rl}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/cleanup.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test-tools.R
3 | \name{cleanup}
4 | \alias{cleanup}
5 | \title{Clean up test data}
6 | \usage{
7 | cleanup()
8 | }
9 | \description{
10 | Removes all temporary test data created.
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{connected}()},
19 | \code{\link{connection_get}()},
20 | \code{\link{db_download_intern}()},
21 | \code{\link{db_sqlngths_get}()},
22 | \code{\link{db_sqlngths_log}()},
23 | \code{\link{dir_size}()},
24 | \code{\link{dwnld_path_get}()},
25 | \code{\link{dwnld_rcrd_log}()},
26 | \code{\link{entrez_fasta_get}()},
27 | \code{\link{entrez_gb_get}()},
28 | \code{\link{extract_accession}()},
29 | \code{\link{extract_by_patterns}()},
30 | \code{\link{extract_clean_sequence}()},
31 | \code{\link{extract_definition}()},
32 | \code{\link{extract_features}()},
33 | \code{\link{extract_inforecpart}()},
34 | \code{\link{extract_keywords}()},
35 | \code{\link{extract_locus}()},
36 | \code{\link{extract_organism}()},
37 | \code{\link{extract_seqrecpart}()},
38 | \code{\link{extract_sequence}()},
39 | \code{\link{extract_version}()},
40 | \code{\link{file_download}()},
41 | \code{\link{filename_log}()},
42 | \code{\link{flatfile_read}()},
43 | \code{\link{gb_build}()},
44 | \code{\link{gb_df_create}()},
45 | \code{\link{gb_df_generate}()},
46 | \code{\link{gb_sql_add}()},
47 | \code{\link{gb_sql_query}()},
48 | \code{\link{gbrelease_check}()},
49 | \code{\link{gbrelease_get}()},
50 | \code{\link{gbrelease_log}()},
51 | \code{\link{has_data}()},
52 | \code{\link{identify_downloadable_files}()},
53 | \code{\link{last_add_get}()},
54 | \code{\link{last_dwnld_get}()},
55 | \code{\link{last_entry_get}()},
56 | \code{\link{latest_genbank_release}()},
57 | \code{\link{latest_genbank_release_notes}()},
58 | \code{\link{message_missing}()},
59 | \code{\link{mock_def}()},
60 | \code{\link{mock_gb_df_generate}()},
61 | \code{\link{mock_org}()},
62 | \code{\link{mock_rec}()},
63 | \code{\link{mock_seq}()},
64 | \code{\link{predict_datasizes}()},
65 | \code{\link{readme_log}()},
66 | \code{\link{restez_connect}()},
67 | \code{\link{restez_disconnect}()},
68 | \code{\link{restez_path_check}()},
69 | \code{\link{restez_rl}()},
70 | \code{\link{search_gz}()},
71 | \code{\link{seshinfo_log}()},
72 | \code{\link{setup}()},
73 | \code{\link{slctn_get}()},
74 | \code{\link{slctn_log}()},
75 | \code{\link{sql_path_get}()},
76 | \code{\link{stat}()},
77 | \code{\link{status_class}()},
78 | \code{\link{testdatadir_get}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/man/connected.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/connection-tools.R
3 | \name{connected}
4 | \alias{connected}
5 | \title{Is restez connected?}
6 | \usage{
7 | connected()
8 | }
9 | \value{
10 | Logical
11 | }
12 | \description{
13 | Returns TRUE if a restez SQL database has been connected.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connection_get}()},
23 | \code{\link{db_download_intern}()},
24 | \code{\link{db_sqlngths_get}()},
25 | \code{\link{db_sqlngths_log}()},
26 | \code{\link{dir_size}()},
27 | \code{\link{dwnld_path_get}()},
28 | \code{\link{dwnld_rcrd_log}()},
29 | \code{\link{entrez_fasta_get}()},
30 | \code{\link{entrez_gb_get}()},
31 | \code{\link{extract_accession}()},
32 | \code{\link{extract_by_patterns}()},
33 | \code{\link{extract_clean_sequence}()},
34 | \code{\link{extract_definition}()},
35 | \code{\link{extract_features}()},
36 | \code{\link{extract_inforecpart}()},
37 | \code{\link{extract_keywords}()},
38 | \code{\link{extract_locus}()},
39 | \code{\link{extract_organism}()},
40 | \code{\link{extract_seqrecpart}()},
41 | \code{\link{extract_sequence}()},
42 | \code{\link{extract_version}()},
43 | \code{\link{file_download}()},
44 | \code{\link{filename_log}()},
45 | \code{\link{flatfile_read}()},
46 | \code{\link{gb_build}()},
47 | \code{\link{gb_df_create}()},
48 | \code{\link{gb_df_generate}()},
49 | \code{\link{gb_sql_add}()},
50 | \code{\link{gb_sql_query}()},
51 | \code{\link{gbrelease_check}()},
52 | \code{\link{gbrelease_get}()},
53 | \code{\link{gbrelease_log}()},
54 | \code{\link{has_data}()},
55 | \code{\link{identify_downloadable_files}()},
56 | \code{\link{last_add_get}()},
57 | \code{\link{last_dwnld_get}()},
58 | \code{\link{last_entry_get}()},
59 | \code{\link{latest_genbank_release}()},
60 | \code{\link{latest_genbank_release_notes}()},
61 | \code{\link{message_missing}()},
62 | \code{\link{mock_def}()},
63 | \code{\link{mock_gb_df_generate}()},
64 | \code{\link{mock_org}()},
65 | \code{\link{mock_rec}()},
66 | \code{\link{mock_seq}()},
67 | \code{\link{predict_datasizes}()},
68 | \code{\link{readme_log}()},
69 | \code{\link{restez_connect}()},
70 | \code{\link{restez_disconnect}()},
71 | \code{\link{restez_path_check}()},
72 | \code{\link{restez_rl}()},
73 | \code{\link{search_gz}()},
74 | \code{\link{seshinfo_log}()},
75 | \code{\link{setup}()},
76 | \code{\link{slctn_get}()},
77 | \code{\link{slctn_log}()},
78 | \code{\link{sql_path_get}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/connection_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/connection-tools.R
3 | \name{connection_get}
4 | \alias{connection_get}
5 | \title{Retrieve restez connection}
6 | \usage{
7 | connection_get()
8 | }
9 | \value{
10 | connection
11 | }
12 | \description{
13 | Safely acquire the restez connection. Raises error if no
14 | connection set.
15 | }
16 | \seealso{
17 | Other private:
18 | \code{\link{add_rcrd_log}()},
19 | \code{\link{cat_line}()},
20 | \code{\link{char}()},
21 | \code{\link{check_connection}()},
22 | \code{\link{cleanup}()},
23 | \code{\link{connected}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{message_missing}()},
63 | \code{\link{mock_def}()},
64 | \code{\link{mock_gb_df_generate}()},
65 | \code{\link{mock_org}()},
66 | \code{\link{mock_rec}()},
67 | \code{\link{mock_seq}()},
68 | \code{\link{predict_datasizes}()},
69 | \code{\link{readme_log}()},
70 | \code{\link{restez_connect}()},
71 | \code{\link{restez_disconnect}()},
72 | \code{\link{restez_path_check}()},
73 | \code{\link{restez_rl}()},
74 | \code{\link{search_gz}()},
75 | \code{\link{seshinfo_log}()},
76 | \code{\link{setup}()},
77 | \code{\link{slctn_get}()},
78 | \code{\link{slctn_log}()},
79 | \code{\link{sql_path_get}()},
80 | \code{\link{stat}()},
81 | \code{\link{status_class}()},
82 | \code{\link{testdatadir_get}()}
83 | }
84 | \concept{private}
85 |
--------------------------------------------------------------------------------
/man/count_db_ids.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-get-tools.R
3 | \name{count_db_ids}
4 | \alias{count_db_ids}
5 | \title{Return the number of ids}
6 | \usage{
7 | count_db_ids(db = "nucleotide")
8 | }
9 | \arguments{
10 | \item{db}{character, database name}
11 | }
12 | \value{
13 | integer
14 | }
15 | \description{
16 | Return the number of ids in a user's restez database.
17 | }
18 | \details{
19 | Requires an open connection. If no connection or db 0 is returned.
20 | }
21 | \examples{
22 | library(restez)
23 | restez_path_set(filepath = tempdir())
24 | demo_db_create(n = 5)
25 | (count_db_ids())
26 |
27 | # delete demo after example
28 | db_delete(everything = TRUE)
29 | }
30 | \seealso{
31 | Other database:
32 | \code{\link{db_create}()},
33 | \code{\link{db_delete}()},
34 | \code{\link{db_download}()},
35 | \code{\link{demo_db_create}()},
36 | \code{\link{is_in_db}()},
37 | \code{\link{list_db_ids}()}
38 | }
39 | \concept{database}
40 |
--------------------------------------------------------------------------------
/man/db_delete.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-setup-tools.R
3 | \name{db_delete}
4 | \alias{db_delete}
5 | \title{Delete database}
6 | \usage{
7 | db_delete(everything = FALSE)
8 | }
9 | \arguments{
10 | \item{everything}{T/F, delete the whole restez folder as well?}
11 | }
12 | \description{
13 | Delete the local SQL database and/or restez folder.
14 | }
15 | \details{
16 | Any connected database will be automatically disconnected.
17 | }
18 | \examples{
19 | library(restez)
20 | fp <- tempdir()
21 | restez_path_set(filepath = fp)
22 | demo_db_create(n = 10)
23 | db_delete(everything = FALSE)
24 | # Will not run: gb_sequence_get(id = 'demo_1')
25 | # only the SQL database is deleted
26 | db_delete(everything = TRUE)
27 | # Now returns NULL
28 | (restez_path_get())
29 | }
30 | \seealso{
31 | Other database:
32 | \code{\link{count_db_ids}()},
33 | \code{\link{db_create}()},
34 | \code{\link{db_download}()},
35 | \code{\link{demo_db_create}()},
36 | \code{\link{is_in_db}()},
37 | \code{\link{list_db_ids}()}
38 | }
39 | \concept{database}
40 |
--------------------------------------------------------------------------------
/man/db_download.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-setup-tools.R
3 | \name{db_download}
4 | \alias{db_download}
5 | \title{Download database}
6 | \usage{
7 | db_download(
8 | db = "nucleotide",
9 | overwrite = FALSE,
10 | preselection = NULL,
11 | max_tries = 1
12 | )
13 | }
14 | \arguments{
15 | \item{db}{Database type, only 'nucleotide' currently available.}
16 |
17 | \item{overwrite}{T/F, overwrite pre-existing downloaded files?}
18 |
19 | \item{preselection}{Character vector of length 1; GenBank domains to
20 | download. If not specified (default), a menu will be provided for
21 | selection.
22 | To specify, provide either a single number or a single character string
23 | of numbers separated by spaces, e.g. "19 20" for 'Phage' (19) and
24 | 'Unannotated' (20).}
25 |
26 | \item{max_tries}{Numeric vector of length 1; maximum number of times to
27 | attempt downloading database (default 1).}
28 | }
29 | \value{
30 | T/F, if all files download correctly, TRUE else FALSE.
31 | }
32 | \description{
33 | Download .seq.tar files from the latest GenBank release.
34 | }
35 | \details{
36 | In default mode, the user interactively selects the parts (i.e., "domains")
37 | of GenBank to download (e.g. primates, plants, bacteria ...). Alternatively,
38 | the selected domains can be provided as a character string to \code{preselection}.
39 |
40 | The \code{max_tries} argument is useful for large databases that may otherwise
41 | fail due to periodic lapses in internet connectivity. This value can be set
42 | to \code{Inf} to continuously try until the database download succeeds (not
43 | recommended if you do not have an internet connection!).
44 | }
45 | \examples{
46 | \dontrun{
47 | library(restez)
48 | restez_path_set(filepath = 'path/for/downloads')
49 | db_download()
50 | }
51 | }
52 | \seealso{
53 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
54 |
55 | Other database:
56 | \code{\link{count_db_ids}()},
57 | \code{\link{db_create}()},
58 | \code{\link{db_delete}()},
59 | \code{\link{demo_db_create}()},
60 | \code{\link{is_in_db}()},
61 | \code{\link{list_db_ids}()}
62 | }
63 | \concept{database}
64 |
--------------------------------------------------------------------------------
/man/db_sqlngths_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{db_sqlngths_get}
4 | \alias{db_sqlngths_get}
5 | \title{Return the minimum and maximum sequence lengths in db}
6 | \usage{
7 | db_sqlngths_get()
8 | }
9 | \value{
10 | vector of integers
11 | }
12 | \description{
13 | Returns the maximum and minimum sequence lengths as set by the
14 | user upon db creation.
15 | }
16 | \details{
17 | If no file found, returns empty character vector.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/db_sqlngths_log.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{db_sqlngths_log}
4 | \alias{db_sqlngths_log}
5 | \title{Log the min and max sequence lengths}
6 | \usage{
7 | db_sqlngths_log(min_lngth, max_lngth)
8 | }
9 | \arguments{
10 | \item{min_lngth}{Minimum length}
11 |
12 | \item{max_lngth}{Maximum length}
13 | }
14 | \description{
15 | Log the min and maximum sequence length used in the created db.
16 | }
17 | \seealso{
18 | Other private:
19 | \code{\link{add_rcrd_log}()},
20 | \code{\link{cat_line}()},
21 | \code{\link{char}()},
22 | \code{\link{check_connection}()},
23 | \code{\link{cleanup}()},
24 | \code{\link{connected}()},
25 | \code{\link{connection_get}()},
26 | \code{\link{db_download_intern}()},
27 | \code{\link{db_sqlngths_get}()},
28 | \code{\link{dir_size}()},
29 | \code{\link{dwnld_path_get}()},
30 | \code{\link{dwnld_rcrd_log}()},
31 | \code{\link{entrez_fasta_get}()},
32 | \code{\link{entrez_gb_get}()},
33 | \code{\link{extract_accession}()},
34 | \code{\link{extract_by_patterns}()},
35 | \code{\link{extract_clean_sequence}()},
36 | \code{\link{extract_definition}()},
37 | \code{\link{extract_features}()},
38 | \code{\link{extract_inforecpart}()},
39 | \code{\link{extract_keywords}()},
40 | \code{\link{extract_locus}()},
41 | \code{\link{extract_organism}()},
42 | \code{\link{extract_seqrecpart}()},
43 | \code{\link{extract_sequence}()},
44 | \code{\link{extract_version}()},
45 | \code{\link{file_download}()},
46 | \code{\link{filename_log}()},
47 | \code{\link{flatfile_read}()},
48 | \code{\link{gb_build}()},
49 | \code{\link{gb_df_create}()},
50 | \code{\link{gb_df_generate}()},
51 | \code{\link{gb_sql_add}()},
52 | \code{\link{gb_sql_query}()},
53 | \code{\link{gbrelease_check}()},
54 | \code{\link{gbrelease_get}()},
55 | \code{\link{gbrelease_log}()},
56 | \code{\link{has_data}()},
57 | \code{\link{identify_downloadable_files}()},
58 | \code{\link{last_add_get}()},
59 | \code{\link{last_dwnld_get}()},
60 | \code{\link{last_entry_get}()},
61 | \code{\link{latest_genbank_release}()},
62 | \code{\link{latest_genbank_release_notes}()},
63 | \code{\link{message_missing}()},
64 | \code{\link{mock_def}()},
65 | \code{\link{mock_gb_df_generate}()},
66 | \code{\link{mock_org}()},
67 | \code{\link{mock_rec}()},
68 | \code{\link{mock_seq}()},
69 | \code{\link{predict_datasizes}()},
70 | \code{\link{readme_log}()},
71 | \code{\link{restez_connect}()},
72 | \code{\link{restez_disconnect}()},
73 | \code{\link{restez_path_check}()},
74 | \code{\link{restez_rl}()},
75 | \code{\link{search_gz}()},
76 | \code{\link{seshinfo_log}()},
77 | \code{\link{setup}()},
78 | \code{\link{slctn_get}()},
79 | \code{\link{slctn_log}()},
80 | \code{\link{sql_path_get}()},
81 | \code{\link{stat}()},
82 | \code{\link{status_class}()},
83 | \code{\link{testdatadir_get}()}
84 | }
85 | \concept{private}
86 |
--------------------------------------------------------------------------------
/man/demo_db_create.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-setup-tools.R
3 | \name{demo_db_create}
4 | \alias{demo_db_create}
5 | \title{Create demo database}
6 | \usage{
7 | demo_db_create(db_type = "nucleotide", n = 100)
8 | }
9 | \arguments{
10 | \item{db_type}{character, database type}
11 |
12 | \item{n}{integer, number of mock sequences}
13 | }
14 | \description{
15 | Creates a local mock SQL database
16 | from package test data for demonstration purposes.
17 | No internet connection required.
18 | }
19 | \examples{
20 | library(restez)
21 | # set the restez path to a temporary dir
22 | restez_path_set(filepath = tempdir())
23 | # create demo database
24 | demo_db_create(n = 5)
25 | # in the demo, IDs are 'demo_1', 'demo_2' ...
26 | (gb_sequence_get(id = 'demo_1'))
27 |
28 | # Delete a demo database after an example
29 | db_delete(everything = TRUE)
30 | }
31 | \seealso{
32 | Other database:
33 | \code{\link{count_db_ids}()},
34 | \code{\link{db_create}()},
35 | \code{\link{db_delete}()},
36 | \code{\link{db_download}()},
37 | \code{\link{is_in_db}()},
38 | \code{\link{list_db_ids}()}
39 | }
40 | \concept{database}
41 |
--------------------------------------------------------------------------------
/man/dir_size.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{dir_size}
4 | \alias{dir_size}
5 | \title{Calculate the size of a directory}
6 | \usage{
7 | dir_size(fp)
8 | }
9 | \arguments{
10 | \item{fp}{File path, character}
11 | }
12 | \value{
13 | numeric
14 | }
15 | \description{
16 | Returns the size of directory in GB
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dwnld_path_get}()},
31 | \code{\link{dwnld_rcrd_log}()},
32 | \code{\link{entrez_fasta_get}()},
33 | \code{\link{entrez_gb_get}()},
34 | \code{\link{extract_accession}()},
35 | \code{\link{extract_by_patterns}()},
36 | \code{\link{extract_clean_sequence}()},
37 | \code{\link{extract_definition}()},
38 | \code{\link{extract_features}()},
39 | \code{\link{extract_inforecpart}()},
40 | \code{\link{extract_keywords}()},
41 | \code{\link{extract_locus}()},
42 | \code{\link{extract_organism}()},
43 | \code{\link{extract_seqrecpart}()},
44 | \code{\link{extract_sequence}()},
45 | \code{\link{extract_version}()},
46 | \code{\link{file_download}()},
47 | \code{\link{filename_log}()},
48 | \code{\link{flatfile_read}()},
49 | \code{\link{gb_build}()},
50 | \code{\link{gb_df_create}()},
51 | \code{\link{gb_df_generate}()},
52 | \code{\link{gb_sql_add}()},
53 | \code{\link{gb_sql_query}()},
54 | \code{\link{gbrelease_check}()},
55 | \code{\link{gbrelease_get}()},
56 | \code{\link{gbrelease_log}()},
57 | \code{\link{has_data}()},
58 | \code{\link{identify_downloadable_files}()},
59 | \code{\link{last_add_get}()},
60 | \code{\link{last_dwnld_get}()},
61 | \code{\link{last_entry_get}()},
62 | \code{\link{latest_genbank_release}()},
63 | \code{\link{latest_genbank_release_notes}()},
64 | \code{\link{message_missing}()},
65 | \code{\link{mock_def}()},
66 | \code{\link{mock_gb_df_generate}()},
67 | \code{\link{mock_org}()},
68 | \code{\link{mock_rec}()},
69 | \code{\link{mock_seq}()},
70 | \code{\link{predict_datasizes}()},
71 | \code{\link{readme_log}()},
72 | \code{\link{restez_connect}()},
73 | \code{\link{restez_disconnect}()},
74 | \code{\link{restez_path_check}()},
75 | \code{\link{restez_rl}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/dwnld_path_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{dwnld_path_get}
4 | \alias{dwnld_path_get}
5 | \title{Get dwnld path}
6 | \usage{
7 | dwnld_path_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Return path to folder where raw .seq files
14 | are stored.
15 | }
16 | \seealso{
17 | Other private:
18 | \code{\link{add_rcrd_log}()},
19 | \code{\link{cat_line}()},
20 | \code{\link{char}()},
21 | \code{\link{check_connection}()},
22 | \code{\link{cleanup}()},
23 | \code{\link{connected}()},
24 | \code{\link{connection_get}()},
25 | \code{\link{db_download_intern}()},
26 | \code{\link{db_sqlngths_get}()},
27 | \code{\link{db_sqlngths_log}()},
28 | \code{\link{dir_size}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{message_missing}()},
63 | \code{\link{mock_def}()},
64 | \code{\link{mock_gb_df_generate}()},
65 | \code{\link{mock_org}()},
66 | \code{\link{mock_rec}()},
67 | \code{\link{mock_seq}()},
68 | \code{\link{predict_datasizes}()},
69 | \code{\link{readme_log}()},
70 | \code{\link{restez_connect}()},
71 | \code{\link{restez_disconnect}()},
72 | \code{\link{restez_path_check}()},
73 | \code{\link{restez_rl}()},
74 | \code{\link{search_gz}()},
75 | \code{\link{seshinfo_log}()},
76 | \code{\link{setup}()},
77 | \code{\link{slctn_get}()},
78 | \code{\link{slctn_log}()},
79 | \code{\link{sql_path_get}()},
80 | \code{\link{stat}()},
81 | \code{\link{status_class}()},
82 | \code{\link{testdatadir_get}()}
83 | }
84 | \concept{private}
85 |
--------------------------------------------------------------------------------
/man/entrez_fetch.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rentrez-wrappers.R
3 | \name{entrez_fetch}
4 | \alias{entrez_fetch}
5 | \title{Entrez fetch}
6 | \usage{
7 | entrez_fetch(db, id = NULL, rettype, retmode = "", ...)
8 | }
9 | \arguments{
10 | \item{db}{character, name of the database}
11 |
12 | \item{id}{vector, unique ID(s) for record(s)}
13 |
14 | \item{rettype}{character, data format}
15 |
16 | \item{retmode}{character, data mode}
17 |
18 | \item{...}{Arguments to be passed on to rentrez}
19 | }
20 | \value{
21 | character string containing the file created
22 | }
23 | \description{
24 | Wrapper for rentrez::entrez_fetch.
25 | }
26 | \details{
27 | Attempts to first search local database with user-specified
28 | parameters, if the record is missing in the database, the function then
29 | calls rentrez::entrez_fetch to search GenBank remotely.
30 |
31 | \code{rettype='fasta'} and \code{rettype='gb'} are respectively equivalent to
32 | \code{\link[=gb_fasta_get]{gb_fasta_get()}} and \code{\link[=gb_record_get]{gb_record_get()}}.
33 | }
34 | \note{
35 | It is advisable to call restez and rentrez functions with '::' notation
36 | rather than library() calls to avoid namespace issues. e.g.
37 | restez::entrez_fetch().
38 | }
39 | \section{Supported return types and modes}{
40 |
41 | XML retmode is not supported. Rettypes 'seqid', 'ft', 'acc' and 'uilist'
42 | are also not supported.
43 | }
44 |
45 | \examples{
46 | library(restez)
47 | restez_path_set(tempdir())
48 | demo_db_create(n = 5)
49 | # return fasta record
50 | fasta_res <- entrez_fetch(db = 'nucleotide',
51 | id = c('demo_1', 'demo_2'),
52 | rettype = 'fasta')
53 | cat(fasta_res)
54 | # return whole GB record in text format
55 | gb_res <- entrez_fetch(db = 'nucleotide',
56 | id = c('demo_1', 'demo_2'),
57 | rettype = 'gb')
58 | cat(gb_res)
59 | # NOT RUN
60 | # whereas these request would go through rentrez
61 | # fasta_res <- entrez_fetch(db = 'nucleotide',
62 | # id = c('S71333', 'S71334'),
63 | # rettype = 'fasta')
64 | # gb_res <- entrez_fetch(db = 'nucleotide',
65 | # id = c('S71333', 'S71334'),
66 | # rettype = 'gb')
67 |
68 | # delete demo after example
69 | db_delete(everything = TRUE)
70 | }
71 | \seealso{
72 | \code{\link[rentrez:entrez_fetch]{rentrez::entrez_fetch()}}
73 | }
74 | \concept{entrez}
75 |
--------------------------------------------------------------------------------
/man/extract_accession.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_accession}
4 | \alias{extract_accession}
5 | \title{Extract accession}
6 | \usage{
7 | extract_accession(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Return accession ID from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_by_patterns}()},
39 | \code{\link{extract_clean_sequence}()},
40 | \code{\link{extract_definition}()},
41 | \code{\link{extract_features}()},
42 | \code{\link{extract_inforecpart}()},
43 | \code{\link{extract_keywords}()},
44 | \code{\link{extract_locus}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_definition.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_definition}
4 | \alias{extract_definition}
5 | \title{Extract definition}
6 | \usage{
7 | extract_definition(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Return definition from GenBank record.
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_features}()},
42 | \code{\link{extract_inforecpart}()},
43 | \code{\link{extract_keywords}()},
44 | \code{\link{extract_locus}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_features.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_features}
4 | \alias{extract_features}
5 | \title{Extract features}
6 | \usage{
7 | extract_features(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | list of lists
14 | }
15 | \description{
16 | Return feature table as list from GenBank record
17 | }
18 | \details{
19 | If element is not found, empty list returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_inforecpart}()},
43 | \code{\link{extract_keywords}()},
44 | \code{\link{extract_locus}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_keywords.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_keywords}
4 | \alias{extract_keywords}
5 | \title{Extract keywords}
6 | \usage{
7 | extract_keywords(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character vector
14 | }
15 | \description{
16 | Return keywords as list from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_locus}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_locus.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_locus}
4 | \alias{extract_locus}
5 | \title{Extract locus}
6 | \usage{
7 | extract_locus(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | named character vector
14 | }
15 | \description{
16 | Return locus information from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_keywords}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_organism.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_organism}
4 | \alias{extract_organism}
5 | \title{Extract organism}
6 | \usage{
7 | extract_organism(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Return organism name from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_keywords}()},
45 | \code{\link{extract_locus}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_sequence.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_sequence}
4 | \alias{extract_sequence}
5 | \title{Extract sequence}
6 | \usage{
7 | extract_sequence(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Return sequence from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_keywords}()},
45 | \code{\link{extract_locus}()},
46 | \code{\link{extract_organism}()},
47 | \code{\link{extract_seqrecpart}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/extract_version.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{extract_version}
4 | \alias{extract_version}
5 | \title{Extract version}
6 | \usage{
7 | extract_version(record)
8 | }
9 | \arguments{
10 | \item{record}{GenBank record in text format, character}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Return accession + version ID from GenBank record
17 | }
18 | \details{
19 | If element is not found, '' returned.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_keywords}()},
45 | \code{\link{extract_locus}()},
46 | \code{\link{extract_organism}()},
47 | \code{\link{extract_seqrecpart}()},
48 | \code{\link{extract_sequence}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/filename_log.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{filename_log}
4 | \alias{filename_log}
5 | \title{Write filenames to log files}
6 | \usage{
7 | filename_log(fl, fp)
8 | }
9 | \arguments{
10 | \item{fl}{file name, character}
11 |
12 | \item{fp}{filepath to log file, character}
13 | }
14 | \description{
15 | Record a filename in a log file along with GB release and time.
16 | }
17 | \seealso{
18 | Other private:
19 | \code{\link{add_rcrd_log}()},
20 | \code{\link{cat_line}()},
21 | \code{\link{char}()},
22 | \code{\link{check_connection}()},
23 | \code{\link{cleanup}()},
24 | \code{\link{connected}()},
25 | \code{\link{connection_get}()},
26 | \code{\link{db_download_intern}()},
27 | \code{\link{db_sqlngths_get}()},
28 | \code{\link{db_sqlngths_log}()},
29 | \code{\link{dir_size}()},
30 | \code{\link{dwnld_path_get}()},
31 | \code{\link{dwnld_rcrd_log}()},
32 | \code{\link{entrez_fasta_get}()},
33 | \code{\link{entrez_gb_get}()},
34 | \code{\link{extract_accession}()},
35 | \code{\link{extract_by_patterns}()},
36 | \code{\link{extract_clean_sequence}()},
37 | \code{\link{extract_definition}()},
38 | \code{\link{extract_features}()},
39 | \code{\link{extract_inforecpart}()},
40 | \code{\link{extract_keywords}()},
41 | \code{\link{extract_locus}()},
42 | \code{\link{extract_organism}()},
43 | \code{\link{extract_seqrecpart}()},
44 | \code{\link{extract_sequence}()},
45 | \code{\link{extract_version}()},
46 | \code{\link{file_download}()},
47 | \code{\link{flatfile_read}()},
48 | \code{\link{gb_build}()},
49 | \code{\link{gb_df_create}()},
50 | \code{\link{gb_df_generate}()},
51 | \code{\link{gb_sql_add}()},
52 | \code{\link{gb_sql_query}()},
53 | \code{\link{gbrelease_check}()},
54 | \code{\link{gbrelease_get}()},
55 | \code{\link{gbrelease_log}()},
56 | \code{\link{has_data}()},
57 | \code{\link{identify_downloadable_files}()},
58 | \code{\link{last_add_get}()},
59 | \code{\link{last_dwnld_get}()},
60 | \code{\link{last_entry_get}()},
61 | \code{\link{latest_genbank_release}()},
62 | \code{\link{latest_genbank_release_notes}()},
63 | \code{\link{message_missing}()},
64 | \code{\link{mock_def}()},
65 | \code{\link{mock_gb_df_generate}()},
66 | \code{\link{mock_org}()},
67 | \code{\link{mock_rec}()},
68 | \code{\link{mock_seq}()},
69 | \code{\link{predict_datasizes}()},
70 | \code{\link{readme_log}()},
71 | \code{\link{restez_connect}()},
72 | \code{\link{restez_disconnect}()},
73 | \code{\link{restez_path_check}()},
74 | \code{\link{restez_rl}()},
75 | \code{\link{search_gz}()},
76 | \code{\link{seshinfo_log}()},
77 | \code{\link{setup}()},
78 | \code{\link{slctn_get}()},
79 | \code{\link{slctn_log}()},
80 | \code{\link{sql_path_get}()},
81 | \code{\link{stat}()},
82 | \code{\link{status_class}()},
83 | \code{\link{testdatadir_get}()}
84 | }
85 | \concept{private}
86 |
--------------------------------------------------------------------------------
/man/flatfile_read.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-setup-tools.R
3 | \name{flatfile_read}
4 | \alias{flatfile_read}
5 | \title{Read flatfile sequence records}
6 | \usage{
7 | flatfile_read(flpth)
8 | }
9 | \arguments{
10 | \item{flpth}{Path to .seq file}
11 | }
12 | \value{
13 | list of GenBank records in text format
14 | }
15 | \description{
16 | Read records from a .seq file.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{gb_build}()},
50 | \code{\link{gb_df_create}()},
51 | \code{\link{gb_df_generate}()},
52 | \code{\link{gb_sql_add}()},
53 | \code{\link{gb_sql_query}()},
54 | \code{\link{gbrelease_check}()},
55 | \code{\link{gbrelease_get}()},
56 | \code{\link{gbrelease_log}()},
57 | \code{\link{has_data}()},
58 | \code{\link{identify_downloadable_files}()},
59 | \code{\link{last_add_get}()},
60 | \code{\link{last_dwnld_get}()},
61 | \code{\link{last_entry_get}()},
62 | \code{\link{latest_genbank_release}()},
63 | \code{\link{latest_genbank_release_notes}()},
64 | \code{\link{message_missing}()},
65 | \code{\link{mock_def}()},
66 | \code{\link{mock_gb_df_generate}()},
67 | \code{\link{mock_org}()},
68 | \code{\link{mock_rec}()},
69 | \code{\link{mock_seq}()},
70 | \code{\link{predict_datasizes}()},
71 | \code{\link{readme_log}()},
72 | \code{\link{restez_connect}()},
73 | \code{\link{restez_disconnect}()},
74 | \code{\link{restez_path_check}()},
75 | \code{\link{restez_rl}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/gb_definition_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_definition_get}
4 | \alias{gb_definition_get}
5 | \title{Get definition from GenBank}
6 | \usage{
7 | gb_definition_get(id)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 | }
12 | \value{
13 | named vector of definitions, if no results found NULL
14 | }
15 | \description{
16 | Return the definition line
17 | for an accession ID.
18 | }
19 | \examples{
20 | library(restez)
21 | restez_path_set(filepath = tempdir())
22 | demo_db_create(n = 5)
23 | (def <- gb_definition_get(id = 'demo_1'))
24 | (defs <- gb_definition_get(id = c('demo_1', 'demo_2')))
25 |
26 |
27 | # delete demo after example
28 | db_delete(everything = TRUE)
29 | }
30 | \seealso{
31 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
32 |
33 | Other get:
34 | \code{\link{gb_fasta_get}()},
35 | \code{\link{gb_organism_get}()},
36 | \code{\link{gb_record_get}()},
37 | \code{\link{gb_sequence_get}()},
38 | \code{\link{gb_version_get}()}
39 | }
40 | \concept{get}
41 |
--------------------------------------------------------------------------------
/man/gb_extract.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/extract-tools.R
3 | \name{gb_extract}
4 | \alias{gb_extract}
5 | \title{Extract elements of a GenBank record}
6 | \usage{
7 | gb_extract(
8 | record,
9 | what = c("accession", "version", "organism", "sequence", "definition", "locus",
10 | "features", "keywords")
11 | )
12 | }
13 | \arguments{
14 | \item{record}{GenBank record in text format, character}
15 |
16 | \item{what}{Which element to extract}
17 | }
18 | \value{
19 | character or list of lists (what='features') or named character
20 | vector (what='locus')
21 | }
22 | \description{
23 | Return elements of GenBank record e.g. sequence, definition ...
24 | }
25 | \details{
26 | This function uses a REGEX to extract particular elements of a
27 | GenBank record. All of the what options return a single character with the
28 | exception of 'locus' or 'keywords' that return character vectors and
29 | 'features' that returns a list of lists for all features.
30 |
31 | The accuracy of these functions cannot be guaranteed due to the enormity of
32 | the GenBank database. But the function is regularly tested on a range of
33 | GenBank records.
34 |
35 | Note: all non-latin1 characters are converted to '-'.
36 | }
37 | \examples{
38 | library(restez)
39 | data('record')
40 | (gb_extract(record = record, what = 'locus'))
41 | }
42 | \concept{parse}
43 |
--------------------------------------------------------------------------------
/man/gb_fasta_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_fasta_get}
4 | \alias{gb_fasta_get}
5 | \title{Get fasta from GenBank}
6 | \usage{
7 | gb_fasta_get(id, width = 70)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 |
12 | \item{width}{integer, maximum number of characters in a line}
13 | }
14 | \value{
15 | named vector of fasta sequences, if no results found NULL
16 | }
17 | \description{
18 | Get sequence and definition data in FASTA format. Equivalent to
19 | \code{rettype='fasta'} in \code{\link[rentrez:entrez_fetch]{rentrez::entrez_fetch()}}.
20 | }
21 | \examples{
22 | library(restez)
23 | restez_path_set(filepath = tempdir())
24 | demo_db_create(n = 5)
25 | (fasta <- gb_fasta_get(id = 'demo_1'))
26 | (fastas <- gb_fasta_get(id = c('demo_1', 'demo_2')))
27 |
28 |
29 | # delete demo after example
30 | db_delete(everything = TRUE)
31 | }
32 | \seealso{
33 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
34 |
35 | Other get:
36 | \code{\link{gb_definition_get}()},
37 | \code{\link{gb_organism_get}()},
38 | \code{\link{gb_record_get}()},
39 | \code{\link{gb_sequence_get}()},
40 | \code{\link{gb_version_get}()}
41 | }
42 | \concept{get}
43 |
--------------------------------------------------------------------------------
/man/gb_organism_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_organism_get}
4 | \alias{gb_organism_get}
5 | \title{Get organism from GenBank}
6 | \usage{
7 | gb_organism_get(id)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 | }
12 | \value{
13 | named vector of definitions, if no results found NULL
14 | }
15 | \description{
16 | Return the organism name
17 | for an accession ID.
18 | }
19 | \examples{
20 | library(restez)
21 | restez_path_set(filepath = tempdir())
22 | demo_db_create(n = 5)
23 | (org <- gb_organism_get(id = 'demo_1'))
24 | (orgs <- gb_organism_get(id = c('demo_1', 'demo_2')))
25 |
26 |
27 | # delete demo after example
28 | db_delete(everything = TRUE)
29 | }
30 | \seealso{
31 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
32 |
33 | Other get:
34 | \code{\link{gb_definition_get}()},
35 | \code{\link{gb_fasta_get}()},
36 | \code{\link{gb_record_get}()},
37 | \code{\link{gb_sequence_get}()},
38 | \code{\link{gb_version_get}()}
39 | }
40 | \concept{get}
41 |
--------------------------------------------------------------------------------
/man/gb_record_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_record_get}
4 | \alias{gb_record_get}
5 | \title{Get record from GenBank}
6 | \usage{
7 | gb_record_get(id)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 | }
12 | \value{
13 | named vector of records, if no results found NULL
14 | }
15 | \description{
16 | Return the entire GenBank record for an accession ID.
17 | Equivalent to \code{rettype='gb'} in \code{\link[rentrez:entrez_fetch]{rentrez::entrez_fetch()}}.
18 | }
19 | \examples{
20 | library(restez)
21 | restez_path_set(filepath = tempdir())
22 | demo_db_create(n = 5)
23 | (rec <- gb_record_get(id = 'demo_1'))
24 | (recs <- gb_record_get(id = c('demo_1', 'demo_2')))
25 |
26 |
27 | # delete demo after example
28 | db_delete(everything = TRUE)
29 | }
30 | \seealso{
31 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
32 |
33 | Other get:
34 | \code{\link{gb_definition_get}()},
35 | \code{\link{gb_fasta_get}()},
36 | \code{\link{gb_organism_get}()},
37 | \code{\link{gb_sequence_get}()},
38 | \code{\link{gb_version_get}()}
39 | }
40 | \concept{get}
41 |
--------------------------------------------------------------------------------
/man/gb_sequence_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_sequence_get}
4 | \alias{gb_sequence_get}
5 | \title{Get sequence from GenBank}
6 | \usage{
7 | gb_sequence_get(id, dnabin = FALSE)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 |
12 | \item{dnabin}{Logical vector of length 1; should the sequences
13 | be returned using the bit-level coding scheme of the ape package?
14 | Default FALSE.}
15 | }
16 | \value{
17 | named vector of sequences, if no results found NULL
18 | }
19 | \description{
20 | Return the sequence(s) for a record(s)
21 | from the accession ID(s).
22 | }
23 | \details{
24 | For more information about the \code{dnabin} format, see \code{\link[ape:DNAbin]{ape::DNAbin()}}.
25 | }
26 | \examples{
27 | library(restez)
28 | restez_path_set(filepath = tempdir())
29 | demo_db_create(n = 5)
30 | (seq <- gb_sequence_get(id = 'demo_1'))
31 | (seqs <- gb_sequence_get(id = c('demo_1', 'demo_2')))
32 | (fasta_dnabin <- gb_sequence_get(id = 'demo_1', dnabin = TRUE))
33 |
34 | # delete demo after example
35 | db_delete(everything = TRUE)
36 |
37 | }
38 | \seealso{
39 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
40 |
41 | Other get:
42 | \code{\link{gb_definition_get}()},
43 | \code{\link{gb_fasta_get}()},
44 | \code{\link{gb_organism_get}()},
45 | \code{\link{gb_record_get}()},
46 | \code{\link{gb_version_get}()}
47 | }
48 | \concept{get}
49 |
--------------------------------------------------------------------------------
/man/gb_sql_add.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-setup-tools.R
3 | \name{gb_sql_add}
4 | \alias{gb_sql_add}
5 | \title{Add to GenBank SQL database}
6 | \usage{
7 | gb_sql_add(df)
8 | }
9 | \arguments{
10 | \item{df}{Records data.frame}
11 | }
12 | \description{
13 | Add records data.frame to SQL-like database.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_query}()},
51 | \code{\link{gbrelease_check}()},
52 | \code{\link{gbrelease_get}()},
53 | \code{\link{gbrelease_log}()},
54 | \code{\link{has_data}()},
55 | \code{\link{identify_downloadable_files}()},
56 | \code{\link{last_add_get}()},
57 | \code{\link{last_dwnld_get}()},
58 | \code{\link{last_entry_get}()},
59 | \code{\link{latest_genbank_release}()},
60 | \code{\link{latest_genbank_release_notes}()},
61 | \code{\link{message_missing}()},
62 | \code{\link{mock_def}()},
63 | \code{\link{mock_gb_df_generate}()},
64 | \code{\link{mock_org}()},
65 | \code{\link{mock_rec}()},
66 | \code{\link{mock_seq}()},
67 | \code{\link{predict_datasizes}()},
68 | \code{\link{readme_log}()},
69 | \code{\link{restez_connect}()},
70 | \code{\link{restez_disconnect}()},
71 | \code{\link{restez_path_check}()},
72 | \code{\link{restez_rl}()},
73 | \code{\link{search_gz}()},
74 | \code{\link{seshinfo_log}()},
75 | \code{\link{setup}()},
76 | \code{\link{slctn_get}()},
77 | \code{\link{slctn_log}()},
78 | \code{\link{sql_path_get}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/gb_sql_query.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_sql_query}
4 | \alias{gb_sql_query}
5 | \title{Query the GenBank SQL}
6 | \usage{
7 | gb_sql_query(nm, id)
8 | }
9 | \arguments{
10 | \item{nm}{character, column name}
11 |
12 | \item{id}{character, sequence accession ID(s)}
13 | }
14 | \value{
15 | data.frame
16 | }
17 | \description{
18 | Generic query function for retrieving
19 | data from the SQL database for the get functions.
20 | }
21 | \seealso{
22 | Other private:
23 | \code{\link{add_rcrd_log}()},
24 | \code{\link{cat_line}()},
25 | \code{\link{char}()},
26 | \code{\link{check_connection}()},
27 | \code{\link{cleanup}()},
28 | \code{\link{connected}()},
29 | \code{\link{connection_get}()},
30 | \code{\link{db_download_intern}()},
31 | \code{\link{db_sqlngths_get}()},
32 | \code{\link{db_sqlngths_log}()},
33 | \code{\link{dir_size}()},
34 | \code{\link{dwnld_path_get}()},
35 | \code{\link{dwnld_rcrd_log}()},
36 | \code{\link{entrez_fasta_get}()},
37 | \code{\link{entrez_gb_get}()},
38 | \code{\link{extract_accession}()},
39 | \code{\link{extract_by_patterns}()},
40 | \code{\link{extract_clean_sequence}()},
41 | \code{\link{extract_definition}()},
42 | \code{\link{extract_features}()},
43 | \code{\link{extract_inforecpart}()},
44 | \code{\link{extract_keywords}()},
45 | \code{\link{extract_locus}()},
46 | \code{\link{extract_organism}()},
47 | \code{\link{extract_seqrecpart}()},
48 | \code{\link{extract_sequence}()},
49 | \code{\link{extract_version}()},
50 | \code{\link{file_download}()},
51 | \code{\link{filename_log}()},
52 | \code{\link{flatfile_read}()},
53 | \code{\link{gb_build}()},
54 | \code{\link{gb_df_create}()},
55 | \code{\link{gb_df_generate}()},
56 | \code{\link{gb_sql_add}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{mock_seq}()},
73 | \code{\link{predict_datasizes}()},
74 | \code{\link{readme_log}()},
75 | \code{\link{restez_connect}()},
76 | \code{\link{restez_disconnect}()},
77 | \code{\link{restez_path_check}()},
78 | \code{\link{restez_rl}()},
79 | \code{\link{search_gz}()},
80 | \code{\link{seshinfo_log}()},
81 | \code{\link{setup}()},
82 | \code{\link{slctn_get}()},
83 | \code{\link{slctn_log}()},
84 | \code{\link{sql_path_get}()},
85 | \code{\link{stat}()},
86 | \code{\link{status_class}()},
87 | \code{\link{testdatadir_get}()}
88 | }
89 | \concept{private}
90 |
--------------------------------------------------------------------------------
/man/gb_version_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/gb-get-tools.R
3 | \name{gb_version_get}
4 | \alias{gb_version_get}
5 | \title{Get version from GenBank}
6 | \usage{
7 | gb_version_get(id)
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 | }
12 | \value{
13 | named vector of versions, if no results found NULL
14 | }
15 | \description{
16 | Return the accession version
17 | for an accession ID.
18 | }
19 | \examples{
20 | library(restez)
21 | restez_path_set(filepath = tempdir())
22 | demo_db_create(n = 5)
23 | (ver <- gb_version_get(id = 'demo_1'))
24 | (vers <- gb_version_get(id = c('demo_1', 'demo_2')))
25 |
26 |
27 | # delete demo after example
28 | db_delete(everything = TRUE)
29 |
30 |
31 | }
32 | \seealso{
33 | \code{\link[=ncbi_acc_get]{ncbi_acc_get()}}
34 |
35 | Other get:
36 | \code{\link{gb_definition_get}()},
37 | \code{\link{gb_fasta_get}()},
38 | \code{\link{gb_organism_get}()},
39 | \code{\link{gb_record_get}()},
40 | \code{\link{gb_sequence_get}()}
41 | }
42 | \concept{get}
43 |
--------------------------------------------------------------------------------
/man/gbrelease_check.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{gbrelease_check}
4 | \alias{gbrelease_check}
5 | \title{Check if the last GenBank release number is the latest}
6 | \usage{
7 | gbrelease_check()
8 | }
9 | \value{
10 | logical
11 | }
12 | \description{
13 | Returns TRUE if the GenBank release number is the most recent
14 | GenBank release available.
15 | }
16 | \seealso{
17 | Other private:
18 | \code{\link{add_rcrd_log}()},
19 | \code{\link{cat_line}()},
20 | \code{\link{char}()},
21 | \code{\link{check_connection}()},
22 | \code{\link{cleanup}()},
23 | \code{\link{connected}()},
24 | \code{\link{connection_get}()},
25 | \code{\link{db_download_intern}()},
26 | \code{\link{db_sqlngths_get}()},
27 | \code{\link{db_sqlngths_log}()},
28 | \code{\link{dir_size}()},
29 | \code{\link{dwnld_path_get}()},
30 | \code{\link{dwnld_rcrd_log}()},
31 | \code{\link{entrez_fasta_get}()},
32 | \code{\link{entrez_gb_get}()},
33 | \code{\link{extract_accession}()},
34 | \code{\link{extract_by_patterns}()},
35 | \code{\link{extract_clean_sequence}()},
36 | \code{\link{extract_definition}()},
37 | \code{\link{extract_features}()},
38 | \code{\link{extract_inforecpart}()},
39 | \code{\link{extract_keywords}()},
40 | \code{\link{extract_locus}()},
41 | \code{\link{extract_organism}()},
42 | \code{\link{extract_seqrecpart}()},
43 | \code{\link{extract_sequence}()},
44 | \code{\link{extract_version}()},
45 | \code{\link{file_download}()},
46 | \code{\link{filename_log}()},
47 | \code{\link{flatfile_read}()},
48 | \code{\link{gb_build}()},
49 | \code{\link{gb_df_create}()},
50 | \code{\link{gb_df_generate}()},
51 | \code{\link{gb_sql_add}()},
52 | \code{\link{gb_sql_query}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{message_missing}()},
63 | \code{\link{mock_def}()},
64 | \code{\link{mock_gb_df_generate}()},
65 | \code{\link{mock_org}()},
66 | \code{\link{mock_rec}()},
67 | \code{\link{mock_seq}()},
68 | \code{\link{predict_datasizes}()},
69 | \code{\link{readme_log}()},
70 | \code{\link{restez_connect}()},
71 | \code{\link{restez_disconnect}()},
72 | \code{\link{restez_path_check}()},
73 | \code{\link{restez_rl}()},
74 | \code{\link{search_gz}()},
75 | \code{\link{seshinfo_log}()},
76 | \code{\link{setup}()},
77 | \code{\link{slctn_get}()},
78 | \code{\link{slctn_log}()},
79 | \code{\link{sql_path_get}()},
80 | \code{\link{stat}()},
81 | \code{\link{status_class}()},
82 | \code{\link{testdatadir_get}()}
83 | }
84 | \concept{private}
85 |
--------------------------------------------------------------------------------
/man/gbrelease_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{gbrelease_get}
4 | \alias{gbrelease_get}
5 | \title{Get the GenBank release number in the restez path}
6 | \usage{
7 | gbrelease_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Returns the GenBank release number. Returns empty character
14 | if none found.
15 | }
16 | \details{
17 | If no file found, returns empty character vector.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/has_data.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/connection-tools.R
3 | \name{has_data}
4 | \alias{has_data}
5 | \title{Does the connected database have data?}
6 | \usage{
7 | has_data()
8 | }
9 | \value{
10 | Logical
11 | }
12 | \description{
13 | Returns TRUE if a restez SQL database has data.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{identify_downloadable_files}()},
56 | \code{\link{last_add_get}()},
57 | \code{\link{last_dwnld_get}()},
58 | \code{\link{last_entry_get}()},
59 | \code{\link{latest_genbank_release}()},
60 | \code{\link{latest_genbank_release_notes}()},
61 | \code{\link{message_missing}()},
62 | \code{\link{mock_def}()},
63 | \code{\link{mock_gb_df_generate}()},
64 | \code{\link{mock_org}()},
65 | \code{\link{mock_rec}()},
66 | \code{\link{mock_seq}()},
67 | \code{\link{predict_datasizes}()},
68 | \code{\link{readme_log}()},
69 | \code{\link{restez_connect}()},
70 | \code{\link{restez_disconnect}()},
71 | \code{\link{restez_path_check}()},
72 | \code{\link{restez_rl}()},
73 | \code{\link{search_gz}()},
74 | \code{\link{seshinfo_log}()},
75 | \code{\link{setup}()},
76 | \code{\link{slctn_get}()},
77 | \code{\link{slctn_log}()},
78 | \code{\link{sql_path_get}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/identify_downloadable_files.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/download-tools.R
3 | \name{identify_downloadable_files}
4 | \alias{identify_downloadable_files}
5 | \title{Identify downloadable files}
6 | \usage{
7 | identify_downloadable_files()
8 | }
9 | \value{
10 | data.frame
11 | }
12 | \description{
13 | Searches through the release notes
14 | for a GenBank release to find all listed .seq files.
15 | Returns a data.frame for all .seq files and their
16 | description.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{last_add_get}()},
60 | \code{\link{last_dwnld_get}()},
61 | \code{\link{last_entry_get}()},
62 | \code{\link{latest_genbank_release}()},
63 | \code{\link{latest_genbank_release_notes}()},
64 | \code{\link{message_missing}()},
65 | \code{\link{mock_def}()},
66 | \code{\link{mock_gb_df_generate}()},
67 | \code{\link{mock_org}()},
68 | \code{\link{mock_rec}()},
69 | \code{\link{mock_seq}()},
70 | \code{\link{predict_datasizes}()},
71 | \code{\link{readme_log}()},
72 | \code{\link{restez_connect}()},
73 | \code{\link{restez_disconnect}()},
74 | \code{\link{restez_path_check}()},
75 | \code{\link{restez_rl}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/is_in_db.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-get-tools.R
3 | \name{is_in_db}
4 | \alias{is_in_db}
5 | \title{Is in db}
6 | \usage{
7 | is_in_db(id, db = "nucleotide")
8 | }
9 | \arguments{
10 | \item{id}{character, sequence accession ID(s)}
11 |
12 | \item{db}{character, database name}
13 | }
14 | \value{
15 | named vector of booleans
16 | }
17 | \description{
18 | Determine whether an id(s)
19 | is/are present in a database.
20 | }
21 | \examples{
22 | library(restez)
23 | # set the restez path to a temporary dir
24 | restez_path_set(filepath = tempdir())
25 | # create demo database
26 | demo_db_create(n = 5)
27 | # in the demo, IDs are 'demo_1', 'demo_2' ...
28 | ids <- c('thisisnotanid', 'demo_1', 'demo_2')
29 | (is_in_db(id = ids))
30 |
31 |
32 | # delete demo after example
33 | db_delete(everything = TRUE)
34 | }
35 | \seealso{
36 | Other database:
37 | \code{\link{count_db_ids}()},
38 | \code{\link{db_create}()},
39 | \code{\link{db_delete}()},
40 | \code{\link{db_download}()},
41 | \code{\link{demo_db_create}()},
42 | \code{\link{list_db_ids}()}
43 | }
44 | \concept{database}
45 |
--------------------------------------------------------------------------------
/man/last_add_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{last_add_get}
4 | \alias{last_add_get}
5 | \title{Return date and time of the last added sequence}
6 | \usage{
7 | last_add_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Return the date and time of the last added sequence as
14 | determined using the 'add_log.tsv'.
15 | }
16 | \details{
17 | If no file found, returns empty character vector.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_get}()},
58 | \code{\link{gbrelease_log}()},
59 | \code{\link{has_data}()},
60 | \code{\link{identify_downloadable_files}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/last_dwnld_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{last_dwnld_get}
4 | \alias{last_dwnld_get}
5 | \title{Return date and time of the last download}
6 | \usage{
7 | last_dwnld_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Return the date and time of the last download as determined
14 | using the 'download_log.tsv'.
15 | }
16 | \details{
17 | If no file found, returns empty character vector.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_get}()},
58 | \code{\link{gbrelease_log}()},
59 | \code{\link{has_data}()},
60 | \code{\link{identify_downloadable_files}()},
61 | \code{\link{last_add_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/last_entry_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{last_entry_get}
4 | \alias{last_entry_get}
5 | \title{Return the last entry}
6 | \usage{
7 | last_entry_get(fp)
8 | }
9 | \arguments{
10 | \item{fp}{Filepath, character}
11 | }
12 | \value{
13 | vector
14 | }
15 | \description{
16 | Return the last entry from a tab-delimited log file.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{latest_genbank_release}()},
63 | \code{\link{latest_genbank_release_notes}()},
64 | \code{\link{message_missing}()},
65 | \code{\link{mock_def}()},
66 | \code{\link{mock_gb_df_generate}()},
67 | \code{\link{mock_org}()},
68 | \code{\link{mock_rec}()},
69 | \code{\link{mock_seq}()},
70 | \code{\link{predict_datasizes}()},
71 | \code{\link{readme_log}()},
72 | \code{\link{restez_connect}()},
73 | \code{\link{restez_disconnect}()},
74 | \code{\link{restez_path_check}()},
75 | \code{\link{restez_rl}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/latest_genbank_release.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/download-tools.R
3 | \name{latest_genbank_release}
4 | \alias{latest_genbank_release}
5 | \title{Retrieve latest GenBank release number}
6 | \usage{
7 | latest_genbank_release()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Downloads the latest GenBank release number and returns it.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release_notes}()},
61 | \code{\link{message_missing}()},
62 | \code{\link{mock_def}()},
63 | \code{\link{mock_gb_df_generate}()},
64 | \code{\link{mock_org}()},
65 | \code{\link{mock_rec}()},
66 | \code{\link{mock_seq}()},
67 | \code{\link{predict_datasizes}()},
68 | \code{\link{readme_log}()},
69 | \code{\link{restez_connect}()},
70 | \code{\link{restez_disconnect}()},
71 | \code{\link{restez_path_check}()},
72 | \code{\link{restez_rl}()},
73 | \code{\link{search_gz}()},
74 | \code{\link{seshinfo_log}()},
75 | \code{\link{setup}()},
76 | \code{\link{slctn_get}()},
77 | \code{\link{slctn_log}()},
78 | \code{\link{sql_path_get}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/latest_genbank_release_notes.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/download-tools.R
3 | \name{latest_genbank_release_notes}
4 | \alias{latest_genbank_release_notes}
5 | \title{Download the latest GenBank Release Notes}
6 | \usage{
7 | latest_genbank_release_notes()
8 | }
9 | \description{
10 | Downloads the latest GenBank release notes to a user's restez
11 | download path.
12 | }
13 | \seealso{
14 | Other private:
15 | \code{\link{add_rcrd_log}()},
16 | \code{\link{cat_line}()},
17 | \code{\link{char}()},
18 | \code{\link{check_connection}()},
19 | \code{\link{cleanup}()},
20 | \code{\link{connected}()},
21 | \code{\link{connection_get}()},
22 | \code{\link{db_download_intern}()},
23 | \code{\link{db_sqlngths_get}()},
24 | \code{\link{db_sqlngths_log}()},
25 | \code{\link{dir_size}()},
26 | \code{\link{dwnld_path_get}()},
27 | \code{\link{dwnld_rcrd_log}()},
28 | \code{\link{entrez_fasta_get}()},
29 | \code{\link{entrez_gb_get}()},
30 | \code{\link{extract_accession}()},
31 | \code{\link{extract_by_patterns}()},
32 | \code{\link{extract_clean_sequence}()},
33 | \code{\link{extract_definition}()},
34 | \code{\link{extract_features}()},
35 | \code{\link{extract_inforecpart}()},
36 | \code{\link{extract_keywords}()},
37 | \code{\link{extract_locus}()},
38 | \code{\link{extract_organism}()},
39 | \code{\link{extract_seqrecpart}()},
40 | \code{\link{extract_sequence}()},
41 | \code{\link{extract_version}()},
42 | \code{\link{file_download}()},
43 | \code{\link{filename_log}()},
44 | \code{\link{flatfile_read}()},
45 | \code{\link{gb_build}()},
46 | \code{\link{gb_df_create}()},
47 | \code{\link{gb_df_generate}()},
48 | \code{\link{gb_sql_add}()},
49 | \code{\link{gb_sql_query}()},
50 | \code{\link{gbrelease_check}()},
51 | \code{\link{gbrelease_get}()},
52 | \code{\link{gbrelease_log}()},
53 | \code{\link{has_data}()},
54 | \code{\link{identify_downloadable_files}()},
55 | \code{\link{last_add_get}()},
56 | \code{\link{last_dwnld_get}()},
57 | \code{\link{last_entry_get}()},
58 | \code{\link{latest_genbank_release}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{readme_log}()},
67 | \code{\link{restez_connect}()},
68 | \code{\link{restez_disconnect}()},
69 | \code{\link{restez_path_check}()},
70 | \code{\link{restez_rl}()},
71 | \code{\link{search_gz}()},
72 | \code{\link{seshinfo_log}()},
73 | \code{\link{setup}()},
74 | \code{\link{slctn_get}()},
75 | \code{\link{slctn_log}()},
76 | \code{\link{sql_path_get}()},
77 | \code{\link{stat}()},
78 | \code{\link{status_class}()},
79 | \code{\link{testdatadir_get}()}
80 | }
81 | \concept{private}
82 |
--------------------------------------------------------------------------------
/man/list_db_ids.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-get-tools.R
3 | \name{list_db_ids}
4 | \alias{list_db_ids}
5 | \title{List database IDs}
6 | \usage{
7 | list_db_ids(db = "nucleotide", n = 100)
8 | }
9 | \arguments{
10 | \item{db}{character, database name}
11 |
12 | \item{n}{Maximum number of IDs to return, if NULL returns all}
13 | }
14 | \value{
15 | vector of characters
16 | }
17 | \description{
18 | Return a vector of all IDs in
19 | a database.
20 | }
21 | \details{
22 | Warning: can return very large vectors
23 | for large databases.
24 | }
25 | \examples{
26 | library(restez)
27 | restez_path_set(filepath = tempdir())
28 | demo_db_create(n = 5)
29 | # Warning: not recommended for real databases
30 | # with potentially millions of IDs
31 | all_ids <- list_db_ids()
32 |
33 |
34 | # What shall we do with these IDs?
35 | # ... how about make a mock fasta file
36 | seqs <- gb_sequence_get(id = all_ids)
37 | defs <- gb_definition_get(id = all_ids)
38 | # paste together
39 | fasta_seqs <- paste0('>', defs, '\n', seqs)
40 | fasta_file <- paste0(fasta_seqs, collapse = '\n')
41 | cat(fasta_file)
42 |
43 |
44 | # delete after example
45 | db_delete(everything = TRUE)
46 | }
47 | \seealso{
48 | Other database:
49 | \code{\link{count_db_ids}()},
50 | \code{\link{db_create}()},
51 | \code{\link{db_delete}()},
52 | \code{\link{db_download}()},
53 | \code{\link{demo_db_create}()},
54 | \code{\link{is_in_db}()}
55 | }
56 | \concept{database}
57 |
--------------------------------------------------------------------------------
/man/message_missing.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/entrez-tools.R
3 | \name{message_missing}
4 | \alias{message_missing}
5 | \title{Produce message of missing IDs}
6 | \usage{
7 | message_missing(n)
8 | }
9 | \arguments{
10 | \item{n}{Number of missing IDs}
11 | }
12 | \description{
13 | Sends message to console stating number of missing IDs.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{mock_def}()},
63 | \code{\link{mock_gb_df_generate}()},
64 | \code{\link{mock_org}()},
65 | \code{\link{mock_rec}()},
66 | \code{\link{mock_seq}()},
67 | \code{\link{predict_datasizes}()},
68 | \code{\link{readme_log}()},
69 | \code{\link{restez_connect}()},
70 | \code{\link{restez_disconnect}()},
71 | \code{\link{restez_path_check}()},
72 | \code{\link{restez_rl}()},
73 | \code{\link{search_gz}()},
74 | \code{\link{seshinfo_log}()},
75 | \code{\link{setup}()},
76 | \code{\link{slctn_get}()},
77 | \code{\link{slctn_log}()},
78 | \code{\link{sql_path_get}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/mock_def.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mock-tools.R
3 | \name{mock_def}
4 | \alias{mock_def}
5 | \title{Mock def}
6 | \usage{
7 | mock_def(i)
8 | }
9 | \arguments{
10 | \item{i}{integer, iterator}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Make a mock sequence definition.
17 | Designed to be part of a loop.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_get}()},
58 | \code{\link{gbrelease_log}()},
59 | \code{\link{has_data}()},
60 | \code{\link{identify_downloadable_files}()},
61 | \code{\link{last_add_get}()},
62 | \code{\link{last_dwnld_get}()},
63 | \code{\link{last_entry_get}()},
64 | \code{\link{latest_genbank_release}()},
65 | \code{\link{latest_genbank_release_notes}()},
66 | \code{\link{message_missing}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/mock_gb_df_generate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mock-tools.R
3 | \name{mock_gb_df_generate}
4 | \alias{mock_gb_df_generate}
5 | \title{Generate mock GenBank records data.frame}
6 | \usage{
7 | mock_gb_df_generate(n)
8 | }
9 | \arguments{
10 | \item{n}{integer, number of entries}
11 | }
12 | \value{
13 | data.frame
14 | }
15 | \description{
16 | Make a mock nucleotide data.frame
17 | for entry into a demonstration SQL database.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_get}()},
58 | \code{\link{gbrelease_log}()},
59 | \code{\link{has_data}()},
60 | \code{\link{identify_downloadable_files}()},
61 | \code{\link{last_add_get}()},
62 | \code{\link{last_dwnld_get}()},
63 | \code{\link{last_entry_get}()},
64 | \code{\link{latest_genbank_release}()},
65 | \code{\link{latest_genbank_release_notes}()},
66 | \code{\link{message_missing}()},
67 | \code{\link{mock_def}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/mock_org.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mock-tools.R
3 | \name{mock_org}
4 | \alias{mock_org}
5 | \title{Mock org}
6 | \usage{
7 | mock_org(i)
8 | }
9 | \arguments{
10 | \item{i}{integer, iterator}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Make a mock sequence organism.
17 | Designed to be part of a loop.
18 | }
19 | \seealso{
20 | Other private:
21 | \code{\link{add_rcrd_log}()},
22 | \code{\link{cat_line}()},
23 | \code{\link{char}()},
24 | \code{\link{check_connection}()},
25 | \code{\link{cleanup}()},
26 | \code{\link{connected}()},
27 | \code{\link{connection_get}()},
28 | \code{\link{db_download_intern}()},
29 | \code{\link{db_sqlngths_get}()},
30 | \code{\link{db_sqlngths_log}()},
31 | \code{\link{dir_size}()},
32 | \code{\link{dwnld_path_get}()},
33 | \code{\link{dwnld_rcrd_log}()},
34 | \code{\link{entrez_fasta_get}()},
35 | \code{\link{entrez_gb_get}()},
36 | \code{\link{extract_accession}()},
37 | \code{\link{extract_by_patterns}()},
38 | \code{\link{extract_clean_sequence}()},
39 | \code{\link{extract_definition}()},
40 | \code{\link{extract_features}()},
41 | \code{\link{extract_inforecpart}()},
42 | \code{\link{extract_keywords}()},
43 | \code{\link{extract_locus}()},
44 | \code{\link{extract_organism}()},
45 | \code{\link{extract_seqrecpart}()},
46 | \code{\link{extract_sequence}()},
47 | \code{\link{extract_version}()},
48 | \code{\link{file_download}()},
49 | \code{\link{filename_log}()},
50 | \code{\link{flatfile_read}()},
51 | \code{\link{gb_build}()},
52 | \code{\link{gb_df_create}()},
53 | \code{\link{gb_df_generate}()},
54 | \code{\link{gb_sql_add}()},
55 | \code{\link{gb_sql_query}()},
56 | \code{\link{gbrelease_check}()},
57 | \code{\link{gbrelease_get}()},
58 | \code{\link{gbrelease_log}()},
59 | \code{\link{has_data}()},
60 | \code{\link{identify_downloadable_files}()},
61 | \code{\link{last_add_get}()},
62 | \code{\link{last_dwnld_get}()},
63 | \code{\link{last_entry_get}()},
64 | \code{\link{latest_genbank_release}()},
65 | \code{\link{latest_genbank_release_notes}()},
66 | \code{\link{message_missing}()},
67 | \code{\link{mock_def}()},
68 | \code{\link{mock_gb_df_generate}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{stat}()},
84 | \code{\link{status_class}()},
85 | \code{\link{testdatadir_get}()}
86 | }
87 | \concept{private}
88 |
--------------------------------------------------------------------------------
/man/mock_seq.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mock-tools.R
3 | \name{mock_seq}
4 | \alias{mock_seq}
5 | \title{Mock seq}
6 | \usage{
7 | mock_seq(i, sqlngth = 10)
8 | }
9 | \arguments{
10 | \item{i}{integer, iterator}
11 |
12 | \item{sqlngth}{integer, sequence length}
13 | }
14 | \value{
15 | character
16 | }
17 | \description{
18 | Make a mock sequence. Designed to be part of a loop.
19 | }
20 | \seealso{
21 | Other private:
22 | \code{\link{add_rcrd_log}()},
23 | \code{\link{cat_line}()},
24 | \code{\link{char}()},
25 | \code{\link{check_connection}()},
26 | \code{\link{cleanup}()},
27 | \code{\link{connected}()},
28 | \code{\link{connection_get}()},
29 | \code{\link{db_download_intern}()},
30 | \code{\link{db_sqlngths_get}()},
31 | \code{\link{db_sqlngths_log}()},
32 | \code{\link{dir_size}()},
33 | \code{\link{dwnld_path_get}()},
34 | \code{\link{dwnld_rcrd_log}()},
35 | \code{\link{entrez_fasta_get}()},
36 | \code{\link{entrez_gb_get}()},
37 | \code{\link{extract_accession}()},
38 | \code{\link{extract_by_patterns}()},
39 | \code{\link{extract_clean_sequence}()},
40 | \code{\link{extract_definition}()},
41 | \code{\link{extract_features}()},
42 | \code{\link{extract_inforecpart}()},
43 | \code{\link{extract_keywords}()},
44 | \code{\link{extract_locus}()},
45 | \code{\link{extract_organism}()},
46 | \code{\link{extract_seqrecpart}()},
47 | \code{\link{extract_sequence}()},
48 | \code{\link{extract_version}()},
49 | \code{\link{file_download}()},
50 | \code{\link{filename_log}()},
51 | \code{\link{flatfile_read}()},
52 | \code{\link{gb_build}()},
53 | \code{\link{gb_df_create}()},
54 | \code{\link{gb_df_generate}()},
55 | \code{\link{gb_sql_add}()},
56 | \code{\link{gb_sql_query}()},
57 | \code{\link{gbrelease_check}()},
58 | \code{\link{gbrelease_get}()},
59 | \code{\link{gbrelease_log}()},
60 | \code{\link{has_data}()},
61 | \code{\link{identify_downloadable_files}()},
62 | \code{\link{last_add_get}()},
63 | \code{\link{last_dwnld_get}()},
64 | \code{\link{last_entry_get}()},
65 | \code{\link{latest_genbank_release}()},
66 | \code{\link{latest_genbank_release_notes}()},
67 | \code{\link{message_missing}()},
68 | \code{\link{mock_def}()},
69 | \code{\link{mock_gb_df_generate}()},
70 | \code{\link{mock_org}()},
71 | \code{\link{mock_rec}()},
72 | \code{\link{predict_datasizes}()},
73 | \code{\link{readme_log}()},
74 | \code{\link{restez_connect}()},
75 | \code{\link{restez_disconnect}()},
76 | \code{\link{restez_path_check}()},
77 | \code{\link{restez_rl}()},
78 | \code{\link{search_gz}()},
79 | \code{\link{seshinfo_log}()},
80 | \code{\link{setup}()},
81 | \code{\link{slctn_get}()},
82 | \code{\link{slctn_log}()},
83 | \code{\link{sql_path_get}()},
84 | \code{\link{stat}()},
85 | \code{\link{status_class}()},
86 | \code{\link{testdatadir_get}()}
87 | }
88 | \concept{private}
89 |
--------------------------------------------------------------------------------
/man/ncbi_acc_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/db-setup-tools.R
3 | \name{ncbi_acc_get}
4 | \alias{ncbi_acc_get}
5 | \title{Get accession numbers by querying NCBI GenBank}
6 | \usage{
7 | ncbi_acc_get(query, strict = TRUE, drop_ver = TRUE)
8 | }
9 | \arguments{
10 | \item{query}{Character vector of length 1; query string to search GenBank.}
11 |
12 | \item{strict}{Logical vector of length 1; should an error be issued if
13 | the number of unique accessions retrieved does not match the number of hits
14 | from GenBank? Default TRUE.}
15 |
16 | \item{drop_ver}{Logical vector of length 1; should the version part of the
17 | accession number (e.g., '.1' in 'AB001538.1') be dropped? Default TRUE.}
18 | }
19 | \value{
20 | Character vector; accession numbers resulting from query.
21 | }
22 | \description{
23 | The query string can be formatted using
24 | \href{https://www.ncbi.nlm.nih.gov/nuccore/advanced}{GenBank advanced query terms}
25 | to obtain accession numbers corresponding to a specific set of criteria.
26 | }
27 | \details{
28 | Note this queries NCBI GenBank, not the local database generated with restez.
29 |
30 | It can be used either to restrict the accessions used to construct the local
31 | database (\code{acc_filter} argument of \code{\link[=db_create]{db_create()}}) or to specify accessions
32 | to read from the local database (\code{id} argument of \code{\link[=gb_fasta_get]{gb_fasta_get()}} and other
33 | gb_*_get() functions).
34 | }
35 | \examples{
36 | \dontrun{
37 | # requires an internet connection
38 | cmin_accs <- ncbi_acc_get("Crepidomanes minutum")
39 | length(cmin_accs)
40 | head(cmin_accs)
41 | }
42 | }
43 | \seealso{
44 | \code{\link[=db_create]{db_create()}}, \code{\link[=gb_fasta_get]{gb_fasta_get()}}
45 | }
46 |
--------------------------------------------------------------------------------
/man/print.status.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/status-tools.R
3 | \name{print.status}
4 | \alias{print.status}
5 | \title{Print method for status class}
6 | \usage{
7 | \method{print}{status}(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{Status object}
11 |
12 | \item{...}{Other arguments (not used by this function)}
13 | }
14 | \description{
15 | Prints to screen the three sections of the status class. Not
16 | meant to be used interactively.
17 | }
18 |
--------------------------------------------------------------------------------
/man/readme_log.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{readme_log}
4 | \alias{readme_log}
5 | \title{Create README in restez_path}
6 | \usage{
7 | readme_log()
8 | }
9 | \description{
10 | Write notes for the curious sorts who peruse the restez_path.
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{cleanup}()},
19 | \code{\link{connected}()},
20 | \code{\link{connection_get}()},
21 | \code{\link{db_download_intern}()},
22 | \code{\link{db_sqlngths_get}()},
23 | \code{\link{db_sqlngths_log}()},
24 | \code{\link{dir_size}()},
25 | \code{\link{dwnld_path_get}()},
26 | \code{\link{dwnld_rcrd_log}()},
27 | \code{\link{entrez_fasta_get}()},
28 | \code{\link{entrez_gb_get}()},
29 | \code{\link{extract_accession}()},
30 | \code{\link{extract_by_patterns}()},
31 | \code{\link{extract_clean_sequence}()},
32 | \code{\link{extract_definition}()},
33 | \code{\link{extract_features}()},
34 | \code{\link{extract_inforecpart}()},
35 | \code{\link{extract_keywords}()},
36 | \code{\link{extract_locus}()},
37 | \code{\link{extract_organism}()},
38 | \code{\link{extract_seqrecpart}()},
39 | \code{\link{extract_sequence}()},
40 | \code{\link{extract_version}()},
41 | \code{\link{file_download}()},
42 | \code{\link{filename_log}()},
43 | \code{\link{flatfile_read}()},
44 | \code{\link{gb_build}()},
45 | \code{\link{gb_df_create}()},
46 | \code{\link{gb_df_generate}()},
47 | \code{\link{gb_sql_add}()},
48 | \code{\link{gb_sql_query}()},
49 | \code{\link{gbrelease_check}()},
50 | \code{\link{gbrelease_get}()},
51 | \code{\link{gbrelease_log}()},
52 | \code{\link{has_data}()},
53 | \code{\link{identify_downloadable_files}()},
54 | \code{\link{last_add_get}()},
55 | \code{\link{last_dwnld_get}()},
56 | \code{\link{last_entry_get}()},
57 | \code{\link{latest_genbank_release}()},
58 | \code{\link{latest_genbank_release_notes}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{restez_connect}()},
67 | \code{\link{restez_disconnect}()},
68 | \code{\link{restez_path_check}()},
69 | \code{\link{restez_rl}()},
70 | \code{\link{search_gz}()},
71 | \code{\link{seshinfo_log}()},
72 | \code{\link{setup}()},
73 | \code{\link{slctn_get}()},
74 | \code{\link{slctn_log}()},
75 | \code{\link{sql_path_get}()},
76 | \code{\link{stat}()},
77 | \code{\link{status_class}()},
78 | \code{\link{testdatadir_get}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/man/record.Rd:
--------------------------------------------------------------------------------
1 | \name{record}
2 | \alias{record}
3 | \docType{data}
4 | \title{
5 | Example GenBank record
6 | }
7 | \description{
8 | Example GenBank record in text format for demonstration purposes.
9 | }
10 | \usage{data("record")}
11 | \format{
12 | A large character object containing record information and DNA sequence.
13 | }
14 | \source{
15 | \url{https://www.ncbi.nlm.nih.gov/nuccore/AY952423.1}
16 | }
17 | \references{
18 | GenBank
19 | }
20 | \examples{
21 | data(record)
22 | cat(record)
23 | }
24 | \keyword{datasets}
25 |
--------------------------------------------------------------------------------
/man/restez.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/restez.R
3 | \docType{package}
4 | \name{restez}
5 | \alias{restez-package}
6 | \alias{restez}
7 | \title{restez: Create and Query a Local Copy of GenBank in R}
8 | \description{
9 | The restez package comes with five families of functions:
10 | setup, database, get, entrez and internal/private.
11 | }
12 | \section{Setup functions}{
13 |
14 | These functions allow a user to set the filepath for where the GenBank files
15 | should be stored, create connections and verify these settings.
16 | }
17 |
18 | \section{Database functions}{
19 |
20 | These functions download specific parts of GenBank and create the local
21 | SQL-like database.
22 | }
23 |
24 | \section{GenBank functions}{
25 |
26 | These functions allow a user to query the local SQL-like database. A
27 | user can use an NCBI accession ID to retrieve sequences or whole GenBank
28 | records.
29 | }
30 |
31 | \section{Entrez functions}{
32 |
33 | The entrez functions are wrappers to the \verb{entrez_*} functions in the
34 | rentrez package. e.g the restez's entrez_fetch will first try to search the
35 | local database, if it fails it will then call rentrez's
36 | \code{\link[rentrez:entrez_fetch]{rentrez::entrez_fetch()}} with the same arguments.
37 | }
38 |
39 | \section{Private/internal functions}{
40 |
41 | These functions work behind the scenes to make everything work. If you're
42 | curious you can read their documentation using the form
43 | \code{?restez:::functionname}.
44 | }
45 |
46 | \seealso{
47 | Useful links:
48 | \itemize{
49 | \item \url{https://github.com/ropensci/restez}
50 | \item \url{https://docs.ropensci.org/restez/}
51 | \item Report bugs at \url{https://github.com/ropensci/restez/issues}
52 | }
53 |
54 | }
55 | \author{
56 | \strong{Maintainer}: Joel H. Nitta \email{joelnitta@gmail.com} (\href{https://orcid.org/0000-0003-4719-7472}{ORCID})
57 |
58 | Authors:
59 | \itemize{
60 | \item Dom Bennett \email{dominic.john.bennett@gmail.com} (\href{https://orcid.org/0000-0003-2722-1359}{ORCID})
61 | }
62 |
63 | }
64 | \keyword{internal}
65 |
--------------------------------------------------------------------------------
/man/restez_disconnect.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/connection-tools.R
3 | \name{restez_disconnect}
4 | \alias{restez_disconnect}
5 | \title{Disconnect from restez database}
6 | \usage{
7 | restez_disconnect()
8 | }
9 | \description{
10 | Safely disconnect from the restez connection
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{cleanup}()},
19 | \code{\link{connected}()},
20 | \code{\link{connection_get}()},
21 | \code{\link{db_download_intern}()},
22 | \code{\link{db_sqlngths_get}()},
23 | \code{\link{db_sqlngths_log}()},
24 | \code{\link{dir_size}()},
25 | \code{\link{dwnld_path_get}()},
26 | \code{\link{dwnld_rcrd_log}()},
27 | \code{\link{entrez_fasta_get}()},
28 | \code{\link{entrez_gb_get}()},
29 | \code{\link{extract_accession}()},
30 | \code{\link{extract_by_patterns}()},
31 | \code{\link{extract_clean_sequence}()},
32 | \code{\link{extract_definition}()},
33 | \code{\link{extract_features}()},
34 | \code{\link{extract_inforecpart}()},
35 | \code{\link{extract_keywords}()},
36 | \code{\link{extract_locus}()},
37 | \code{\link{extract_organism}()},
38 | \code{\link{extract_seqrecpart}()},
39 | \code{\link{extract_sequence}()},
40 | \code{\link{extract_version}()},
41 | \code{\link{file_download}()},
42 | \code{\link{filename_log}()},
43 | \code{\link{flatfile_read}()},
44 | \code{\link{gb_build}()},
45 | \code{\link{gb_df_create}()},
46 | \code{\link{gb_df_generate}()},
47 | \code{\link{gb_sql_add}()},
48 | \code{\link{gb_sql_query}()},
49 | \code{\link{gbrelease_check}()},
50 | \code{\link{gbrelease_get}()},
51 | \code{\link{gbrelease_log}()},
52 | \code{\link{has_data}()},
53 | \code{\link{identify_downloadable_files}()},
54 | \code{\link{last_add_get}()},
55 | \code{\link{last_dwnld_get}()},
56 | \code{\link{last_entry_get}()},
57 | \code{\link{latest_genbank_release}()},
58 | \code{\link{latest_genbank_release_notes}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{readme_log}()},
67 | \code{\link{restez_connect}()},
68 | \code{\link{restez_path_check}()},
69 | \code{\link{restez_rl}()},
70 | \code{\link{search_gz}()},
71 | \code{\link{seshinfo_log}()},
72 | \code{\link{setup}()},
73 | \code{\link{slctn_get}()},
74 | \code{\link{slctn_log}()},
75 | \code{\link{sql_path_get}()},
76 | \code{\link{stat}()},
77 | \code{\link{status_class}()},
78 | \code{\link{testdatadir_get}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/man/restez_path_check.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{restez_path_check}
4 | \alias{restez_path_check}
5 | \title{Check restez filepath}
6 | \usage{
7 | restez_path_check()
8 | }
9 | \description{
10 | Raises error if restez path does
11 | not exist.
12 | }
13 | \seealso{
14 | Other private:
15 | \code{\link{add_rcrd_log}()},
16 | \code{\link{cat_line}()},
17 | \code{\link{char}()},
18 | \code{\link{check_connection}()},
19 | \code{\link{cleanup}()},
20 | \code{\link{connected}()},
21 | \code{\link{connection_get}()},
22 | \code{\link{db_download_intern}()},
23 | \code{\link{db_sqlngths_get}()},
24 | \code{\link{db_sqlngths_log}()},
25 | \code{\link{dir_size}()},
26 | \code{\link{dwnld_path_get}()},
27 | \code{\link{dwnld_rcrd_log}()},
28 | \code{\link{entrez_fasta_get}()},
29 | \code{\link{entrez_gb_get}()},
30 | \code{\link{extract_accession}()},
31 | \code{\link{extract_by_patterns}()},
32 | \code{\link{extract_clean_sequence}()},
33 | \code{\link{extract_definition}()},
34 | \code{\link{extract_features}()},
35 | \code{\link{extract_inforecpart}()},
36 | \code{\link{extract_keywords}()},
37 | \code{\link{extract_locus}()},
38 | \code{\link{extract_organism}()},
39 | \code{\link{extract_seqrecpart}()},
40 | \code{\link{extract_sequence}()},
41 | \code{\link{extract_version}()},
42 | \code{\link{file_download}()},
43 | \code{\link{filename_log}()},
44 | \code{\link{flatfile_read}()},
45 | \code{\link{gb_build}()},
46 | \code{\link{gb_df_create}()},
47 | \code{\link{gb_df_generate}()},
48 | \code{\link{gb_sql_add}()},
49 | \code{\link{gb_sql_query}()},
50 | \code{\link{gbrelease_check}()},
51 | \code{\link{gbrelease_get}()},
52 | \code{\link{gbrelease_log}()},
53 | \code{\link{has_data}()},
54 | \code{\link{identify_downloadable_files}()},
55 | \code{\link{last_add_get}()},
56 | \code{\link{last_dwnld_get}()},
57 | \code{\link{last_entry_get}()},
58 | \code{\link{latest_genbank_release}()},
59 | \code{\link{latest_genbank_release_notes}()},
60 | \code{\link{message_missing}()},
61 | \code{\link{mock_def}()},
62 | \code{\link{mock_gb_df_generate}()},
63 | \code{\link{mock_org}()},
64 | \code{\link{mock_rec}()},
65 | \code{\link{mock_seq}()},
66 | \code{\link{predict_datasizes}()},
67 | \code{\link{readme_log}()},
68 | \code{\link{restez_connect}()},
69 | \code{\link{restez_disconnect}()},
70 | \code{\link{restez_rl}()},
71 | \code{\link{search_gz}()},
72 | \code{\link{seshinfo_log}()},
73 | \code{\link{setup}()},
74 | \code{\link{slctn_get}()},
75 | \code{\link{slctn_log}()},
76 | \code{\link{sql_path_get}()},
77 | \code{\link{stat}()},
78 | \code{\link{status_class}()},
79 | \code{\link{testdatadir_get}()}
80 | }
81 | \concept{private}
82 |
--------------------------------------------------------------------------------
/man/restez_path_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{restez_path_get}
4 | \alias{restez_path_get}
5 | \title{Get restez path}
6 | \usage{
7 | restez_path_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Return filepath to where the restez
14 | database is stored.
15 | }
16 | \examples{
17 | library(restez)
18 | # set a restez path with a tempdir
19 | restez_path_set(filepath = tempdir())
20 | # check what the set path is
21 | (restez_path_get())
22 | }
23 | \seealso{
24 | Other setup:
25 | \code{\link{restez_path_set}()},
26 | \code{\link{restez_path_unset}()},
27 | \code{\link{restez_ready}()},
28 | \code{\link{restez_status}()}
29 | }
30 | \concept{setup}
31 |
--------------------------------------------------------------------------------
/man/restez_path_set.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{restez_path_set}
4 | \alias{restez_path_set}
5 | \title{Set restez path}
6 | \usage{
7 | restez_path_set(filepath)
8 | }
9 | \arguments{
10 | \item{filepath}{character, valid filepath to the folder where the
11 | database should be stored.}
12 | }
13 | \description{
14 | Specify the filepath for the local GenBank database.
15 | }
16 | \details{
17 | Adds 'restez_path' to options(). In this path
18 | the folder 'restez' will be created and all downloaded and
19 | database files will be stored there.
20 | }
21 | \examples{
22 | \dontrun{
23 | library(restez)
24 | restez_path_set(filepath = 'path/to/where/you/want/files/to/download')
25 | }
26 | }
27 | \seealso{
28 | Other setup:
29 | \code{\link{restez_path_get}()},
30 | \code{\link{restez_path_unset}()},
31 | \code{\link{restez_ready}()},
32 | \code{\link{restez_status}()}
33 | }
34 | \concept{setup}
35 |
--------------------------------------------------------------------------------
/man/restez_path_unset.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{restez_path_unset}
4 | \alias{restez_path_unset}
5 | \title{Unset restez path}
6 | \usage{
7 | restez_path_unset()
8 | }
9 | \description{
10 | Set the restez path to NULL
11 | }
12 | \seealso{
13 | Other setup:
14 | \code{\link{restez_path_get}()},
15 | \code{\link{restez_path_set}()},
16 | \code{\link{restez_ready}()},
17 | \code{\link{restez_status}()}
18 | }
19 | \concept{setup}
20 |
--------------------------------------------------------------------------------
/man/restez_ready.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/connection-tools.R
3 | \name{restez_ready}
4 | \alias{restez_ready}
5 | \title{Is restez ready?}
6 | \usage{
7 | restez_ready()
8 | }
9 | \value{
10 | Logical
11 | }
12 | \description{
13 | Returns TRUE if a restez SQL database is available.
14 | Use restez_status() for more information.
15 | }
16 | \examples{
17 | library(restez)
18 | fp <- tempdir()
19 | restez_path_set(filepath = fp)
20 | demo_db_create(n = 5)
21 | (restez_ready())
22 | db_delete(everything = TRUE)
23 | (restez_ready())
24 | }
25 | \seealso{
26 | Other setup:
27 | \code{\link{restez_path_get}()},
28 | \code{\link{restez_path_set}()},
29 | \code{\link{restez_path_unset}()},
30 | \code{\link{restez_status}()}
31 | }
32 | \concept{setup}
33 |
--------------------------------------------------------------------------------
/man/restez_rl.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/wrappers.R
3 | \name{restez_rl}
4 | \alias{restez_rl}
5 | \title{Restez readline}
6 | \usage{
7 | restez_rl(prompt)
8 | }
9 | \arguments{
10 | \item{prompt}{character, display text}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Wrapper for base readline.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{search_gz}()},
77 | \code{\link{seshinfo_log}()},
78 | \code{\link{setup}()},
79 | \code{\link{slctn_get}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/restez_status.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/status-tools.R
3 | \name{restez_status}
4 | \alias{restez_status}
5 | \title{Check restez status}
6 | \usage{
7 | restez_status(gb_check = FALSE)
8 | }
9 | \arguments{
10 | \item{gb_check}{Check whether last download was from latest GenBank release?
11 | Default FALSE.}
12 | }
13 | \value{
14 | Status class
15 | }
16 | \description{
17 | Report to console current setup status of restez.
18 | }
19 | \details{
20 | Set gb_check=TRUE to see if your downloads are up-to-date.
21 | }
22 | \examples{
23 | library(restez)
24 | fp <- tempdir()
25 | restez_path_set(filepath = fp)
26 | demo_db_create(n = 5)
27 | restez_status()
28 | db_delete(everything = TRUE)
29 | # Errors:
30 | # restez_status()
31 | }
32 | \seealso{
33 | Other setup:
34 | \code{\link{restez_path_get}()},
35 | \code{\link{restez_path_set}()},
36 | \code{\link{restez_path_unset}()},
37 | \code{\link{restez_ready}()}
38 | }
39 | \concept{setup}
40 |
--------------------------------------------------------------------------------
/man/seshinfo_log.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{seshinfo_log}
4 | \alias{seshinfo_log}
5 | \title{Log the system session information in restez path}
6 | \usage{
7 | seshinfo_log()
8 | }
9 | \description{
10 | Records the session and system information to file.
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{cleanup}()},
19 | \code{\link{connected}()},
20 | \code{\link{connection_get}()},
21 | \code{\link{db_download_intern}()},
22 | \code{\link{db_sqlngths_get}()},
23 | \code{\link{db_sqlngths_log}()},
24 | \code{\link{dir_size}()},
25 | \code{\link{dwnld_path_get}()},
26 | \code{\link{dwnld_rcrd_log}()},
27 | \code{\link{entrez_fasta_get}()},
28 | \code{\link{entrez_gb_get}()},
29 | \code{\link{extract_accession}()},
30 | \code{\link{extract_by_patterns}()},
31 | \code{\link{extract_clean_sequence}()},
32 | \code{\link{extract_definition}()},
33 | \code{\link{extract_features}()},
34 | \code{\link{extract_inforecpart}()},
35 | \code{\link{extract_keywords}()},
36 | \code{\link{extract_locus}()},
37 | \code{\link{extract_organism}()},
38 | \code{\link{extract_seqrecpart}()},
39 | \code{\link{extract_sequence}()},
40 | \code{\link{extract_version}()},
41 | \code{\link{file_download}()},
42 | \code{\link{filename_log}()},
43 | \code{\link{flatfile_read}()},
44 | \code{\link{gb_build}()},
45 | \code{\link{gb_df_create}()},
46 | \code{\link{gb_df_generate}()},
47 | \code{\link{gb_sql_add}()},
48 | \code{\link{gb_sql_query}()},
49 | \code{\link{gbrelease_check}()},
50 | \code{\link{gbrelease_get}()},
51 | \code{\link{gbrelease_log}()},
52 | \code{\link{has_data}()},
53 | \code{\link{identify_downloadable_files}()},
54 | \code{\link{last_add_get}()},
55 | \code{\link{last_dwnld_get}()},
56 | \code{\link{last_entry_get}()},
57 | \code{\link{latest_genbank_release}()},
58 | \code{\link{latest_genbank_release_notes}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{readme_log}()},
67 | \code{\link{restez_connect}()},
68 | \code{\link{restez_disconnect}()},
69 | \code{\link{restez_path_check}()},
70 | \code{\link{restez_rl}()},
71 | \code{\link{search_gz}()},
72 | \code{\link{setup}()},
73 | \code{\link{slctn_get}()},
74 | \code{\link{slctn_log}()},
75 | \code{\link{sql_path_get}()},
76 | \code{\link{stat}()},
77 | \code{\link{status_class}()},
78 | \code{\link{testdatadir_get}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/man/setup.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test-tools.R
3 | \name{setup}
4 | \alias{setup}
5 | \title{Set up test common test data}
6 | \usage{
7 | setup()
8 | }
9 | \description{
10 | Creates temporary test folders.
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{cleanup}()},
19 | \code{\link{connected}()},
20 | \code{\link{connection_get}()},
21 | \code{\link{db_download_intern}()},
22 | \code{\link{db_sqlngths_get}()},
23 | \code{\link{db_sqlngths_log}()},
24 | \code{\link{dir_size}()},
25 | \code{\link{dwnld_path_get}()},
26 | \code{\link{dwnld_rcrd_log}()},
27 | \code{\link{entrez_fasta_get}()},
28 | \code{\link{entrez_gb_get}()},
29 | \code{\link{extract_accession}()},
30 | \code{\link{extract_by_patterns}()},
31 | \code{\link{extract_clean_sequence}()},
32 | \code{\link{extract_definition}()},
33 | \code{\link{extract_features}()},
34 | \code{\link{extract_inforecpart}()},
35 | \code{\link{extract_keywords}()},
36 | \code{\link{extract_locus}()},
37 | \code{\link{extract_organism}()},
38 | \code{\link{extract_seqrecpart}()},
39 | \code{\link{extract_sequence}()},
40 | \code{\link{extract_version}()},
41 | \code{\link{file_download}()},
42 | \code{\link{filename_log}()},
43 | \code{\link{flatfile_read}()},
44 | \code{\link{gb_build}()},
45 | \code{\link{gb_df_create}()},
46 | \code{\link{gb_df_generate}()},
47 | \code{\link{gb_sql_add}()},
48 | \code{\link{gb_sql_query}()},
49 | \code{\link{gbrelease_check}()},
50 | \code{\link{gbrelease_get}()},
51 | \code{\link{gbrelease_log}()},
52 | \code{\link{has_data}()},
53 | \code{\link{identify_downloadable_files}()},
54 | \code{\link{last_add_get}()},
55 | \code{\link{last_dwnld_get}()},
56 | \code{\link{last_entry_get}()},
57 | \code{\link{latest_genbank_release}()},
58 | \code{\link{latest_genbank_release_notes}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{readme_log}()},
67 | \code{\link{restez_connect}()},
68 | \code{\link{restez_disconnect}()},
69 | \code{\link{restez_path_check}()},
70 | \code{\link{restez_rl}()},
71 | \code{\link{search_gz}()},
72 | \code{\link{seshinfo_log}()},
73 | \code{\link{slctn_get}()},
74 | \code{\link{slctn_log}()},
75 | \code{\link{sql_path_get}()},
76 | \code{\link{stat}()},
77 | \code{\link{status_class}()},
78 | \code{\link{testdatadir_get}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/man/slctn_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/log-tools.R
3 | \name{slctn_get}
4 | \alias{slctn_get}
5 | \title{Retrieve GenBank selections made by user}
6 | \usage{
7 | slctn_get()
8 | }
9 | \value{
10 | character vector
11 | }
12 | \description{
13 | Returns the selections made by the user.
14 | }
15 | \details{
16 | If no file found, returns empty character vector.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_log}()},
81 | \code{\link{sql_path_get}()},
82 | \code{\link{stat}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/sql_path_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/filepath-tools.R
3 | \name{sql_path_get}
4 | \alias{sql_path_get}
5 | \title{Get SQL path}
6 | \usage{
7 | sql_path_get()
8 | }
9 | \value{
10 | character
11 | }
12 | \description{
13 | Return path to where SQL database is stored.
14 | }
15 | \seealso{
16 | Other private:
17 | \code{\link{add_rcrd_log}()},
18 | \code{\link{cat_line}()},
19 | \code{\link{char}()},
20 | \code{\link{check_connection}()},
21 | \code{\link{cleanup}()},
22 | \code{\link{connected}()},
23 | \code{\link{connection_get}()},
24 | \code{\link{db_download_intern}()},
25 | \code{\link{db_sqlngths_get}()},
26 | \code{\link{db_sqlngths_log}()},
27 | \code{\link{dir_size}()},
28 | \code{\link{dwnld_path_get}()},
29 | \code{\link{dwnld_rcrd_log}()},
30 | \code{\link{entrez_fasta_get}()},
31 | \code{\link{entrez_gb_get}()},
32 | \code{\link{extract_accession}()},
33 | \code{\link{extract_by_patterns}()},
34 | \code{\link{extract_clean_sequence}()},
35 | \code{\link{extract_definition}()},
36 | \code{\link{extract_features}()},
37 | \code{\link{extract_inforecpart}()},
38 | \code{\link{extract_keywords}()},
39 | \code{\link{extract_locus}()},
40 | \code{\link{extract_organism}()},
41 | \code{\link{extract_seqrecpart}()},
42 | \code{\link{extract_sequence}()},
43 | \code{\link{extract_version}()},
44 | \code{\link{file_download}()},
45 | \code{\link{filename_log}()},
46 | \code{\link{flatfile_read}()},
47 | \code{\link{gb_build}()},
48 | \code{\link{gb_df_create}()},
49 | \code{\link{gb_df_generate}()},
50 | \code{\link{gb_sql_add}()},
51 | \code{\link{gb_sql_query}()},
52 | \code{\link{gbrelease_check}()},
53 | \code{\link{gbrelease_get}()},
54 | \code{\link{gbrelease_log}()},
55 | \code{\link{has_data}()},
56 | \code{\link{identify_downloadable_files}()},
57 | \code{\link{last_add_get}()},
58 | \code{\link{last_dwnld_get}()},
59 | \code{\link{last_entry_get}()},
60 | \code{\link{latest_genbank_release}()},
61 | \code{\link{latest_genbank_release_notes}()},
62 | \code{\link{message_missing}()},
63 | \code{\link{mock_def}()},
64 | \code{\link{mock_gb_df_generate}()},
65 | \code{\link{mock_org}()},
66 | \code{\link{mock_rec}()},
67 | \code{\link{mock_seq}()},
68 | \code{\link{predict_datasizes}()},
69 | \code{\link{readme_log}()},
70 | \code{\link{restez_connect}()},
71 | \code{\link{restez_disconnect}()},
72 | \code{\link{restez_path_check}()},
73 | \code{\link{restez_rl}()},
74 | \code{\link{search_gz}()},
75 | \code{\link{seshinfo_log}()},
76 | \code{\link{setup}()},
77 | \code{\link{slctn_get}()},
78 | \code{\link{slctn_log}()},
79 | \code{\link{stat}()},
80 | \code{\link{status_class}()},
81 | \code{\link{testdatadir_get}()}
82 | }
83 | \concept{private}
84 |
--------------------------------------------------------------------------------
/man/stat.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/print-tools.R
3 | \name{stat}
4 | \alias{stat}
5 | \title{Print blue}
6 | \usage{
7 | stat(...)
8 | }
9 | \arguments{
10 | \item{...}{Any number of text arguments to print, character}
11 | }
12 | \value{
13 | coloured character encoding, character
14 | }
15 | \description{
16 | Print to console blue text to indicate a number/statistic.
17 | }
18 | \seealso{
19 | Other private:
20 | \code{\link{add_rcrd_log}()},
21 | \code{\link{cat_line}()},
22 | \code{\link{char}()},
23 | \code{\link{check_connection}()},
24 | \code{\link{cleanup}()},
25 | \code{\link{connected}()},
26 | \code{\link{connection_get}()},
27 | \code{\link{db_download_intern}()},
28 | \code{\link{db_sqlngths_get}()},
29 | \code{\link{db_sqlngths_log}()},
30 | \code{\link{dir_size}()},
31 | \code{\link{dwnld_path_get}()},
32 | \code{\link{dwnld_rcrd_log}()},
33 | \code{\link{entrez_fasta_get}()},
34 | \code{\link{entrez_gb_get}()},
35 | \code{\link{extract_accession}()},
36 | \code{\link{extract_by_patterns}()},
37 | \code{\link{extract_clean_sequence}()},
38 | \code{\link{extract_definition}()},
39 | \code{\link{extract_features}()},
40 | \code{\link{extract_inforecpart}()},
41 | \code{\link{extract_keywords}()},
42 | \code{\link{extract_locus}()},
43 | \code{\link{extract_organism}()},
44 | \code{\link{extract_seqrecpart}()},
45 | \code{\link{extract_sequence}()},
46 | \code{\link{extract_version}()},
47 | \code{\link{file_download}()},
48 | \code{\link{filename_log}()},
49 | \code{\link{flatfile_read}()},
50 | \code{\link{gb_build}()},
51 | \code{\link{gb_df_create}()},
52 | \code{\link{gb_df_generate}()},
53 | \code{\link{gb_sql_add}()},
54 | \code{\link{gb_sql_query}()},
55 | \code{\link{gbrelease_check}()},
56 | \code{\link{gbrelease_get}()},
57 | \code{\link{gbrelease_log}()},
58 | \code{\link{has_data}()},
59 | \code{\link{identify_downloadable_files}()},
60 | \code{\link{last_add_get}()},
61 | \code{\link{last_dwnld_get}()},
62 | \code{\link{last_entry_get}()},
63 | \code{\link{latest_genbank_release}()},
64 | \code{\link{latest_genbank_release_notes}()},
65 | \code{\link{message_missing}()},
66 | \code{\link{mock_def}()},
67 | \code{\link{mock_gb_df_generate}()},
68 | \code{\link{mock_org}()},
69 | \code{\link{mock_rec}()},
70 | \code{\link{mock_seq}()},
71 | \code{\link{predict_datasizes}()},
72 | \code{\link{readme_log}()},
73 | \code{\link{restez_connect}()},
74 | \code{\link{restez_disconnect}()},
75 | \code{\link{restez_path_check}()},
76 | \code{\link{restez_rl}()},
77 | \code{\link{search_gz}()},
78 | \code{\link{seshinfo_log}()},
79 | \code{\link{setup}()},
80 | \code{\link{slctn_get}()},
81 | \code{\link{slctn_log}()},
82 | \code{\link{sql_path_get}()},
83 | \code{\link{status_class}()},
84 | \code{\link{testdatadir_get}()}
85 | }
86 | \concept{private}
87 |
--------------------------------------------------------------------------------
/man/status_class.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/status-tools.R
3 | \name{status_class}
4 | \alias{status_class}
5 | \title{Generate a list class for storing status information}
6 | \usage{
7 | status_class()
8 | }
9 | \value{
10 | Status class
11 | }
12 | \description{
13 | Creates a three-part list for holding information on the
14 | status of the restez file path.
15 | }
16 | \seealso{
17 | Other private:
18 | \code{\link{add_rcrd_log}()},
19 | \code{\link{cat_line}()},
20 | \code{\link{char}()},
21 | \code{\link{check_connection}()},
22 | \code{\link{cleanup}()},
23 | \code{\link{connected}()},
24 | \code{\link{connection_get}()},
25 | \code{\link{db_download_intern}()},
26 | \code{\link{db_sqlngths_get}()},
27 | \code{\link{db_sqlngths_log}()},
28 | \code{\link{dir_size}()},
29 | \code{\link{dwnld_path_get}()},
30 | \code{\link{dwnld_rcrd_log}()},
31 | \code{\link{entrez_fasta_get}()},
32 | \code{\link{entrez_gb_get}()},
33 | \code{\link{extract_accession}()},
34 | \code{\link{extract_by_patterns}()},
35 | \code{\link{extract_clean_sequence}()},
36 | \code{\link{extract_definition}()},
37 | \code{\link{extract_features}()},
38 | \code{\link{extract_inforecpart}()},
39 | \code{\link{extract_keywords}()},
40 | \code{\link{extract_locus}()},
41 | \code{\link{extract_organism}()},
42 | \code{\link{extract_seqrecpart}()},
43 | \code{\link{extract_sequence}()},
44 | \code{\link{extract_version}()},
45 | \code{\link{file_download}()},
46 | \code{\link{filename_log}()},
47 | \code{\link{flatfile_read}()},
48 | \code{\link{gb_build}()},
49 | \code{\link{gb_df_create}()},
50 | \code{\link{gb_df_generate}()},
51 | \code{\link{gb_sql_add}()},
52 | \code{\link{gb_sql_query}()},
53 | \code{\link{gbrelease_check}()},
54 | \code{\link{gbrelease_get}()},
55 | \code{\link{gbrelease_log}()},
56 | \code{\link{has_data}()},
57 | \code{\link{identify_downloadable_files}()},
58 | \code{\link{last_add_get}()},
59 | \code{\link{last_dwnld_get}()},
60 | \code{\link{last_entry_get}()},
61 | \code{\link{latest_genbank_release}()},
62 | \code{\link{latest_genbank_release_notes}()},
63 | \code{\link{message_missing}()},
64 | \code{\link{mock_def}()},
65 | \code{\link{mock_gb_df_generate}()},
66 | \code{\link{mock_org}()},
67 | \code{\link{mock_rec}()},
68 | \code{\link{mock_seq}()},
69 | \code{\link{predict_datasizes}()},
70 | \code{\link{readme_log}()},
71 | \code{\link{restez_connect}()},
72 | \code{\link{restez_disconnect}()},
73 | \code{\link{restez_path_check}()},
74 | \code{\link{restez_rl}()},
75 | \code{\link{search_gz}()},
76 | \code{\link{seshinfo_log}()},
77 | \code{\link{setup}()},
78 | \code{\link{slctn_get}()},
79 | \code{\link{slctn_log}()},
80 | \code{\link{sql_path_get}()},
81 | \code{\link{stat}()},
82 | \code{\link{testdatadir_get}()}
83 | }
84 | \concept{private}
85 |
--------------------------------------------------------------------------------
/man/testdatadir_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/test-tools.R
3 | \name{testdatadir_get}
4 | \alias{testdatadir_get}
5 | \title{Get test data directory}
6 | \usage{
7 | testdatadir_get()
8 | }
9 | \description{
10 | Get the folder containing test data.
11 | }
12 | \seealso{
13 | Other private:
14 | \code{\link{add_rcrd_log}()},
15 | \code{\link{cat_line}()},
16 | \code{\link{char}()},
17 | \code{\link{check_connection}()},
18 | \code{\link{cleanup}()},
19 | \code{\link{connected}()},
20 | \code{\link{connection_get}()},
21 | \code{\link{db_download_intern}()},
22 | \code{\link{db_sqlngths_get}()},
23 | \code{\link{db_sqlngths_log}()},
24 | \code{\link{dir_size}()},
25 | \code{\link{dwnld_path_get}()},
26 | \code{\link{dwnld_rcrd_log}()},
27 | \code{\link{entrez_fasta_get}()},
28 | \code{\link{entrez_gb_get}()},
29 | \code{\link{extract_accession}()},
30 | \code{\link{extract_by_patterns}()},
31 | \code{\link{extract_clean_sequence}()},
32 | \code{\link{extract_definition}()},
33 | \code{\link{extract_features}()},
34 | \code{\link{extract_inforecpart}()},
35 | \code{\link{extract_keywords}()},
36 | \code{\link{extract_locus}()},
37 | \code{\link{extract_organism}()},
38 | \code{\link{extract_seqrecpart}()},
39 | \code{\link{extract_sequence}()},
40 | \code{\link{extract_version}()},
41 | \code{\link{file_download}()},
42 | \code{\link{filename_log}()},
43 | \code{\link{flatfile_read}()},
44 | \code{\link{gb_build}()},
45 | \code{\link{gb_df_create}()},
46 | \code{\link{gb_df_generate}()},
47 | \code{\link{gb_sql_add}()},
48 | \code{\link{gb_sql_query}()},
49 | \code{\link{gbrelease_check}()},
50 | \code{\link{gbrelease_get}()},
51 | \code{\link{gbrelease_log}()},
52 | \code{\link{has_data}()},
53 | \code{\link{identify_downloadable_files}()},
54 | \code{\link{last_add_get}()},
55 | \code{\link{last_dwnld_get}()},
56 | \code{\link{last_entry_get}()},
57 | \code{\link{latest_genbank_release}()},
58 | \code{\link{latest_genbank_release_notes}()},
59 | \code{\link{message_missing}()},
60 | \code{\link{mock_def}()},
61 | \code{\link{mock_gb_df_generate}()},
62 | \code{\link{mock_org}()},
63 | \code{\link{mock_rec}()},
64 | \code{\link{mock_seq}()},
65 | \code{\link{predict_datasizes}()},
66 | \code{\link{readme_log}()},
67 | \code{\link{restez_connect}()},
68 | \code{\link{restez_disconnect}()},
69 | \code{\link{restez_path_check}()},
70 | \code{\link{restez_rl}()},
71 | \code{\link{search_gz}()},
72 | \code{\link{seshinfo_log}()},
73 | \code{\link{setup}()},
74 | \code{\link{slctn_get}()},
75 | \code{\link{slctn_log}()},
76 | \code{\link{sql_path_get}()},
77 | \code{\link{stat}()},
78 | \code{\link{status_class}()}
79 | }
80 | \concept{private}
81 |
--------------------------------------------------------------------------------
/other/demonstration_1.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(restez)
3 |
4 | # SETUP
5 | fp <- file.path(getwd(), 'demo')
6 | dir.create(fp)
7 | restez_path_set(fp)
8 | gb_download()
9 | db_create()
10 |
11 | # LOOK UP ACCESSIONS
12 | # 33553 - Sciuromorpha - squirrel-like things
13 | search_term <- 'txid33553[Organism:exp] AND COI [GENE]'
14 | search_object <- rentrez::entrez_search(db = 'nucleotide', term = search_term,
15 | use_history = TRUE, retmax = 0)
16 | accessions <- rentrez::entrez_fetch(db = 'nucleotide',
17 | web_history = search_object$web_history,
18 | rettype = 'acc')
19 | accessions <- strsplit(x = accessions, split = '\\n')[[1]]
20 | accessions <- sub(pattern = '\\.[0-9]+', replacement = '', x = accessions)
21 |
22 | # FETCH
23 | coi_sequences <- gb_fasta_get(id = accessions)
24 | # are all accessions in results?
25 | all(accessions %in% names(coi_sequences))
26 | # .... no
27 | accessions[!accessions %in% names(coi_sequences)]
28 | # NC* refers to RefSeq sequences and are not currently available through restez
29 | # The sequence however exists in GB under a different id which we can find like so
30 | smmry <- rentrez::entrez_summary(db = 'nucleotide', id = 'NC_027278')
31 | # This ID does exist in our results.
32 | smmry$assemblyacc %in% accessions
33 |
34 | # TAKE DOWN
35 | db_delete()
36 |
--------------------------------------------------------------------------------
/other/dev.R:
--------------------------------------------------------------------------------
1 | # Problem record
2 | devtools::load_all()
3 | record <- rentrez::entrez_fetch(db = 'nucleotide', id = 'AB467315',
4 | rettype = 'gb', retmode = 'text')
5 | extract_features(record)
6 |
7 |
8 | # TODO:
9 | problem_files <- c('gbinv17.seq', 'gbpln118.seq', 'gbpln12.seq')
10 | restez_path_set('.')
11 | for (problem_file in problem_files) {
12 | file_download(problem_file)
13 | }
14 |
15 | db_create()
16 |
17 | devtools::load_all('.')
18 |
19 | db_delete(everything = TRUE)
20 | restez_path_set('.')
21 | db_download()
22 |
23 | restez_connect()
24 | db_create(min_length = 10, max_length = 1000)
25 | restez_status()
26 | db_delete()
27 | restez_connect()
28 | db_create()
29 | restez_status()
30 | restez_disconnect()
31 |
32 |
33 |
--------------------------------------------------------------------------------
/other/generate_records_data.R:
--------------------------------------------------------------------------------
1 | filepath <- file.path('other', "gbpri10.seq")
2 | records <- restez:::flatfile_read(filepath)
3 | records <- sample(records, 25)
4 | save(records, file = file.path('data', 'records.rda'), compress = 'xz')
5 |
--------------------------------------------------------------------------------
/other/make_sure_things_work.R:
--------------------------------------------------------------------------------
1 | library(restez)
2 | # On my linux computer and I specify my desktop
3 | fp <- '~/Desktop'
4 | restez_path_set(filepath = fp)
5 |
6 | db_download(preselection = '15')
7 | db_create(db_type = 'nucleotide', min_length = 250, max_length = 2000)
8 |
--------------------------------------------------------------------------------
/other/phylotar_demo.R:
--------------------------------------------------------------------------------
1 | # SPEED TEST DOWNLOAD STAGE WITH AND WITHOUT RESTEZ
2 | # LIBS ----
3 | devtools::load_all('~/Coding/restez')
4 | devtools::load_all('~/Coding/phylotaR')
5 |
6 | # VARS ----
7 | wd <- 'beavers'
8 | restez_path <- '~/Desktop/beavers_restez'
9 | txid <- 1963757
10 | ncbi_dr <- '/usr/bin'
11 |
12 | # RUN PHYLOTAR ----
13 | if (dir.exists(wd)) {
14 | unlink(x = wd, recursive = TRUE)
15 | }
16 | dir.create(wd)
17 | phylotaR::setup(wd = wd, txid = txid, ncbi_dr = ncbi_dr, v = TRUE, btchsz = 100)
18 | taxise_run(wd = wd)
19 |
20 | # SPEED TEST 1
21 | without_restez <- system.time(expr = {
22 | download_run(wd = wd)
23 | })
24 | # user system elapsed
25 | # 121.104 32.604 467.001
26 | # user system elapsed
27 | # 63.128 0.883 438.626
28 |
29 | # SET-UP RESTEZ ----
30 | restez_path_set(filepath = restez_path)
31 | db_download(preselection = '15') # select 15 for rodents
32 | restez_connect()
33 | db_create()
34 | restez_disconnect()
35 | restez_status()
36 |
37 | # RESET PHYLOTAR ----
38 | reset(wd = wd, stage = 'download', hard = TRUE)
39 |
40 | # SPEED TEST 2
41 | restez_path_set(filepath = restez_path)
42 | restez_connect()
43 | with_restez <- system.time(expr = {
44 | download_run(wd = wd)
45 | })
46 | restez_disconnect()
47 | # user system elapsed
48 | # 71.983 14.783 234.640
49 |
50 | # TAKE HOME STAT
51 | # twice as faster
52 | pfaster <- signif((467.001/234.640), 3)
53 | cat(pfaster, 'x faster with restez\n', sep = '')
54 |
--------------------------------------------------------------------------------
/other/rodent_build_times.rds:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/other/rodent_build_times.rds
--------------------------------------------------------------------------------
/other/rodent_db.R:
--------------------------------------------------------------------------------
1 | rodents_path <- file.path(getwd(), 'rodents')
2 | if (!dir.exists(rodents_path)) {
3 | dir.create(rodents_path)
4 | }
5 |
6 | # Dynamically get Rodent index (may change with future GenBank updates)
7 | restez_path_set(tempdir())
8 | latest_genbank_release_notes()
9 | downloadable_table <- identify_downloadable_files()
10 | types <- sort(table(downloadable_table[['descripts']]), decreasing = TRUE)
11 | rodent_index <- grep("Rodent|rodent", names(types))
12 |
13 | if (length(rodent_index) != 1) stop("multiple rodent indexes detected")
14 | if (!is.numeric(rodent_index)) stop("rodent index should be numeric")
15 |
16 | # set the restez path to a memorable location
17 | restez_path_set(rodents_path)
18 | # download domain 10 and build db, record times
19 | dl_time <- system.time(
20 | db_download(preselection = rodent_index, max_tries = 100))
21 |
22 | db_time <- system.time(db_create(min_length = 100, max_length = 1000))
23 |
24 | # save times to RDS for documentation in vignette
25 | rodent_times <- list(
26 | dl_time = dl_time,
27 | db_time = db_time
28 | )
29 |
30 | saveRDS(rodent_times, "other/rodent_build_times.rds")
--------------------------------------------------------------------------------
/other/spell_check.R:
--------------------------------------------------------------------------------
1 | ignore <- c('restez',
2 | 'db',
3 | "restez's",
4 | 'acc',
5 | 'booleans',
6 | 'entrez',
7 | 'Entrez',
8 | 'fasta',
9 | 'FASTA',
10 | 'filepath',
11 | 'GenBank',
12 | 'nuccore',
13 | 'REGEX',
14 | 'rentrez',
15 | "rentrez's",
16 | 'retmode',
17 | 'Rettypes',
18 | 'seq',
19 | 'seqid',
20 | 'SQLite')
21 | #'uilist')
22 | devtools::spell_check(ignore = ignore, dict = 'en_GB')
23 | vignette_files <- file.path(getwd(), 'vignettes',
24 | list.files('vignettes', pattern = 'Rmd'))
25 | for (fl in vignette_files) {
26 | print(fl)
27 | print(devtools:::spell_check_file(fl, ignore = ignore, dict = 'en_GB'))
28 | }
29 |
--------------------------------------------------------------------------------
/other/viral_lookup.R:
--------------------------------------------------------------------------------
1 | # How long does it take to get the definition of a single ID from viral sequences?
2 | # setup
3 | devtools::load_all('~/Coding/restez')
4 | restez_path_set('~/Desktop/viral')
5 | db_delete(everything = TRUE)
6 | restez_path_set('~/Desktop/viral')
7 | db_download(preselection = '13')
8 | restez_connect()
9 | db_create()
10 | restez_disconnect()
11 |
12 | # get def
13 | devtools::load_all('~/Coding/restez')
14 | restez_path_set('~/Desktop/viral')
15 | restez_connect()
16 | id <- sample(list_db_ids(), 1)
17 | system.time(gb_definition_get(id))
18 | # user system elapsed
19 | # 0.048 0.000 0.024
--------------------------------------------------------------------------------
/paper/outline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/paper/outline.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/revdep/.gitignore:
--------------------------------------------------------------------------------
1 | checks
2 | library
3 | checks.noindex
4 | library.noindex
5 | cloud.noindex
6 | data.sqlite
7 | *.html
8 |
--------------------------------------------------------------------------------
/revdep/README.md:
--------------------------------------------------------------------------------
1 | # Platform
2 |
3 | |field |value |
4 | |:--------|:-----------------------------|
5 | |version |R version 4.4.1 (2024-06-14) |
6 | |os |macOS Sonoma 14.6.1 |
7 | |system |aarch64, darwin20 |
8 | |ui |X11 |
9 | |language |(EN) |
10 | |collate |ja_JP.UTF-8 |
11 | |ctype |ja_JP.UTF-8 |
12 | |tz |Asia/Tokyo |
13 | |date |2025-03-07 |
14 | |pandoc |3.1.2 @ /usr/local/bin/pandoc |
15 |
16 | # Dependencies
17 |
18 | |package |old |new |Δ |
19 | |:--------|:-----|:----------|:--|
20 | |restez |2.1.4 |2.1.4.9000 |* |
21 | |ape |NA |5.8-1 |* |
22 | |askpass |NA |1.2.1 |* |
23 | |cli |NA |3.6.4 |* |
24 | |curl |NA |6.2.1 |* |
25 | |digest |NA |0.6.37 |* |
26 | |fs |NA |1.6.5 |* |
27 | |jsonlite |NA |1.9.1 |* |
28 | |openssl |NA |2.3.2 |* |
29 | |R6 |NA |2.6.1 |* |
30 | |Rcpp |NA |1.0.14 |* |
31 | |sys |NA |3.4.3 |* |
32 | |XML |NA |3.99-0.18 |* |
33 |
34 | # Revdeps
35 |
36 |
--------------------------------------------------------------------------------
/revdep/cran.md:
--------------------------------------------------------------------------------
1 | ## revdepcheck results
2 |
3 | We checked 0 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
4 |
5 | * We saw 0 new problems
6 | * We failed to check 0 packages
7 |
8 |
--------------------------------------------------------------------------------
/revdep/email.yml:
--------------------------------------------------------------------------------
1 | release_date: ???
2 | rel_release_date: ???
3 | my_news_url: ???
4 | release_version: ???
5 | release_details: ???
6 |
--------------------------------------------------------------------------------
/revdep/failures.md:
--------------------------------------------------------------------------------
1 | *Wow, no problems at all. :)*
--------------------------------------------------------------------------------
/revdep/problems.md:
--------------------------------------------------------------------------------
1 | *Wow, no problems at all. :)*
--------------------------------------------------------------------------------
/tests/test-all.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | test_check("restez")
3 |
--------------------------------------------------------------------------------
/tests/testthat/data/records.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/tests/testthat/data/records.RData
--------------------------------------------------------------------------------
/tests/testthat/data/release_notes_gb224.RData:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/restez/2fca23308ad67f064e01cf7e88328a0f98540c28/tests/testthat/data/release_notes_gb224.RData
--------------------------------------------------------------------------------
/tests/testthat/test-biomartr-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | test_that("check_connection() works", {
6 | local_mocked_bindings(
7 | check_connection = function(...) TRUE
8 | )
9 | expect_true(check_connection())
10 | })
11 |
12 | test_that("url_exists() works", {
13 | local_mocked_bindings(
14 | url_exists = function(...) FALSE
15 | )
16 | expect_error(
17 | check_connection(),
18 | "Unable to connect to"
19 | )
20 | })
21 |
--------------------------------------------------------------------------------
/tests/testthat/test-connection-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | cleanup()
6 | context('Testing \'connection-tools\'')
7 | test_that('restez_ready() works', {
8 | on.exit(cleanup())
9 | expect_false(restez_ready())
10 | setup()
11 | demo_db_create()
12 | expect_true(restez_ready())
13 | cleanup()
14 | })
15 | test_that('restez_connect() works', {
16 | on.exit({
17 | restez_disconnect()
18 | cleanup()
19 | })
20 | expect_error(restez_connect())
21 | restez_disconnect()
22 | setup()
23 | restez_connect()
24 | expect_true(is(connection_get(), 'duckdb_connection'))
25 | restez_disconnect()
26 | cleanup()
27 | })
28 | test_that('restez_connect() works in read-only mode', {
29 | on.exit({
30 | cleanup()
31 | restez_disconnect()
32 | })
33 | setup()
34 | demo_db_create(n = 10)
35 | restez_connect(read_only = TRUE)
36 | expect_true(is(connection_get(), 'duckdb_connection'))
37 | restez_disconnect()
38 | cleanup()
39 | })
40 | test_that('restez_disconnect() works', {
41 | on.exit({
42 | cleanup()
43 | restez_disconnect()
44 | })
45 | expect_null(restez_disconnect())
46 | setup()
47 | restez_connect()
48 | expect_true(is(connection_get(), 'duckdb_connection'))
49 | restez_disconnect()
50 | expect_error(connection_get())
51 | cleanup()
52 | })
53 | test_that('connected() works', {
54 | on.exit({
55 | cleanup()
56 | restez_disconnect()
57 | })
58 | expect_false(connected())
59 | setup()
60 | expect_false(connected())
61 | restez_connect()
62 | expect_true(connected())
63 | cleanup()
64 | restez_disconnect()
65 | })
66 | test_that('has_data() works', {
67 | on.exit({
68 | cleanup()
69 | restez_disconnect()
70 | })
71 | expect_false(has_data())
72 | setup()
73 | expect_false(has_data())
74 | demo_db_create(n = 10)
75 | expect_true(has_data())
76 | cleanup()
77 | restez_disconnect()
78 | })
79 | test_that('connection_get() works', {
80 | on.exit({
81 | cleanup()
82 | restez_disconnect()
83 | })
84 | setup()
85 | restez_connect()
86 | expect_true(is(connection_get(), 'duckdb_connection'))
87 | restez_disconnect()
88 | cleanup()
89 | expect_error(connection_get())
90 | })
91 | cleanup()
92 |
--------------------------------------------------------------------------------
/tests/testthat/test-entrez-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # VARS
5 | nrcrds <- 10 # how many fake records to test on?
6 | data_d <- testdatadir_get()
7 |
8 | # DATA
9 | records <- readRDS(file = file.path(data_d, 'records.RData'))
10 |
11 | # SETUP
12 | cleanup()
13 | setup()
14 | df <- gb_df_generate(records = sample(records, size = nrcrds))
15 | df <- gb_df_generate(records = records)
16 | ids <- as.character(df[['accession']])
17 | gb_sql_add(df = df)
18 |
19 | # RUNNING
20 | context('Testing \'entrez-tools\'')
21 | test_that('entrez_fasta_get() works', {
22 | # rentrez_fastas <- rentrez::entrez_fetch(id = id, db = 'nucleotide',
23 | # rettype = 'fasta')
24 | res <- entrez_fasta_get(id = sample(ids, 2))
25 | expect_true(inherits(res, 'character'))
26 | mtch_obj <- gregexpr(pattern = '\n\n', text = res)[[1]]
27 | expect_true(length(mtch_obj) == 2)
28 | expect_true(grepl(pattern = '^>.*', x = res))
29 | # if not in local, should search internet
30 | local_mocked_bindings(
31 | entrez_fetch_wrap = function(...) '>notanid\nATCG\n\n'
32 | )
33 | res <- entrez_fasta_get(id = 'notanid')
34 | expect_true(grepl('>notanid', res))
35 | # should be able to handle mixture
36 | res <- entrez_fasta_get(id = c(sample(ids, 2), 'notanid'))
37 | expect_true(grepl('>notanid', res))
38 | mtch_obj <- gregexpr(pattern = '\n\n', text = res)[[1]]
39 | expect_true(length(mtch_obj) == 3)
40 | })
41 | test_that('entrez_gb_get() works', {
42 | # id <- c('S71333', 'AY952423')
43 | # rentrez_records <- rentrez::entrez_fetch(id = id, db = 'nucleotide',
44 | # rettype = 'gb')
45 | id <- sample(ids, 2)
46 | res <- entrez_gb_get(id = id, db = 'nucleotide',
47 | rettype = 'gb')
48 | # res == rentrez_records
49 | expect_true(inherits(res, 'character'))
50 | mtch_obj <- gregexpr(pattern = '\n\n', text = res)[[1]]
51 | expect_true(length(mtch_obj) == 2)
52 | expect_true(grepl(pattern = 'LOCUS', x = res))
53 | # if not in local, should search internet
54 | local_mocked_bindings(
55 | entrez_fetch_wrap = function(...) 'LOCUS notanid\n//\n\n'
56 | )
57 | res <- entrez_gb_get(id = 'notanid')
58 | expect_true(grepl('notanid', res))
59 | # should be able to handle mixture
60 | res <- entrez_gb_get(id = c(sample(ids, 2), 'notanid'))
61 | expect_true(grepl('notanid', res))
62 | mtch_obj <- gregexpr(pattern = 'LOCUS', text = res)[[1]]
63 | expect_true(length(mtch_obj) == 3)
64 | })
65 | cleanup()
66 |
--------------------------------------------------------------------------------
/tests/testthat/test-extract-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # VARS
5 | data_d <- testdatadir_get()
6 |
7 | # DATA
8 | # TODO: get ten random records of each NCBI domain
9 | records <- readRDS(file = file.path(data_d, 'records.RData'))
10 |
11 | # RUNNING
12 | context('Testing \'extract-tools\'')
13 | test_that('extract_by_patterns() works', {
14 | record <- sample(records, 1)[[1]]
15 | res <- extract_by_patterns(record = record,
16 | start_pattern = '\nFEATURES\\s{2,}')
17 | expect_true(grepl('Location/Qualifiers', res))
18 | })
19 | test_that('extract_version() works', {
20 | record <- sample(records, 1)[[1]]
21 | accession_version <- extract_version(record = record)
22 | # print(accession_version)
23 | expect_true(grepl('^[a-z0-9_]+\\.[0-9]+$', accession_version,
24 | ignore.case = TRUE))
25 | })
26 | test_that('extract_organism() works', {
27 | record <- sample(records, 1)[[1]]
28 | organism <- extract_organism(record = record)
29 | # print(organism)
30 | expect_false(grepl('\\s{2,}', organism,
31 | ignore.case = TRUE))
32 | expect_false(grepl('\n', organism, ignore.case = TRUE))
33 | })
34 | test_that('extract_definition() works', {
35 | record <- sample(records, 1)[[1]]
36 | definition <- extract_definition(record = record)
37 | #print(definition)
38 | expect_false(grepl('\\s{2,}', definition,
39 | ignore.case = TRUE))
40 | expect_false(grepl('\n', definition, ignore.case = TRUE))
41 | })
42 | test_that('extract_sequence() works', {
43 | record <- sample(records, 1)[[1]]
44 | sequence <- extract_sequence(record = record)
45 | expect_false(grepl('[0-9]', sequence,
46 | ignore.case = TRUE))
47 | })
48 | test_that('extract_features() works', {
49 | record <- sample(records, 1)[[1]]
50 | features <- extract_features(record = record)
51 | # print(features)
52 | expect_true(inherits(features, 'list'))
53 | })
54 | test_that('extract_locus() works', {
55 | record <- sample(records, 1)[[1]]
56 | locus <- extract_locus(record = record)
57 | # print(locus)
58 | expect_true(inherits(locus, 'character'))
59 | })
60 | test_that('extract_keywords() works', {
61 | record <- sample(records, 1)[[1]]
62 | keywords <- extract_keywords(record = record)
63 | # print(keywords)
64 | expect_true(inherits(keywords, 'character'))
65 | })
66 | test_that('gb_extract() works', {
67 | opts <- c('accession', 'version', 'organism','sequence', 'definition',
68 | 'locus', 'features', 'keywords')
69 | what <- sample(opts, 1)
70 | record <- sample(records, 1)[[1]]
71 | res <- gb_extract(record = record, what = what)
72 | if (what == 'features') {
73 | expect_true(inherits(res, 'list'))
74 | } else {
75 | expect_true(inherits(res, 'character'))
76 | }
77 | })
78 |
--------------------------------------------------------------------------------
/tests/testthat/test-filepath-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | cleanup()
6 | context('Testing \'filepath-tools\'')
7 | test_that('restez_path_set() works', {
8 | setup()
9 | on.exit(cleanup())
10 | expect_true(restez_path_get() == file.path('test_db_fldr', 'restez'))
11 | })
12 | test_that('restez_path_unset() works', {
13 | setup()
14 | on.exit(cleanup())
15 | restez_path_unset()
16 | expect_null(restez_path_get())
17 | })
18 | test_that('restez_path_get() works', {
19 | setup()
20 | on.exit(cleanup())
21 | expect_true(grepl('test_db_fldr', restez_path_get()))
22 | })
23 | test_that('sql_path_get() works', {
24 | setup()
25 | on.exit(cleanup())
26 | expect_true(is.character(sql_path_get()))
27 | })
28 | test_that('dwnld_path_get() works', {
29 | setup()
30 | on.exit(cleanup())
31 | expect_true(is.character(dwnld_path_get()))
32 | })
33 | test_that('restez_path_check() works', {
34 | expect_error(restez_path_check())
35 | setup()
36 | on.exit(cleanup())
37 | expect_null(restez_path_check())
38 | unlink('test_db_fldr', recursive = TRUE)
39 | expect_error(restez_path_check())
40 | })
41 | cleanup()
42 |
--------------------------------------------------------------------------------
/tests/testthat/test-gb-setup-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # VARS
5 | nrcrds <- 50 # how many fake records to test on?
6 | data_d <- testdatadir_get()
7 |
8 | # DATA
9 | records <- readRDS(file = file.path(data_d, 'records.RData'))
10 |
11 | # FUNCTIONS
12 | write_fake_records <- function(n=nrcrds) {
13 | records_text <- ''
14 | for (i in 1:n) {
15 | records_text <- paste0(records_text,
16 | mock_rec(i, sequence = 'atcg'), '\n')
17 | }
18 | cat(records_text, file = 'test_records.txt')
19 | NULL
20 | }
21 |
22 | # RUNNING
23 | context('Testing \'setup-tools\'')
24 | cleanup()
25 | test_that('gb_build() works', {
26 | local_mocked_bindings(
27 | flatfile_read = function(...) NULL
28 | )
29 | res <- gb_build(
30 | dpth = NULL, seq_files = 1:10, max_length = NULL, min_length = NULL)
31 | expect_true(res)
32 | res <- gb_build(
33 | dpth = NULL, seq_files = NULL, max_length = NULL, min_length = NULL)
34 | expect_false(res)
35 | })
36 | test_that('flatfile_read() works', {
37 | write_fake_records(n = nrcrds)
38 | records <- flatfile_read(flpth = 'test_records.txt')
39 | expect_true(length(records) == nrcrds)
40 | cleanup()
41 | })
42 | test_that('gb_df_create() works', {
43 | fake_data <- rep('', nrcrds)
44 | df <- gb_df_create(accessions = fake_data, versions = fake_data,
45 | organisms = fake_data, definitions = fake_data,
46 | sequences = fake_data, records = fake_data)
47 | expect_true(nrow(df) == nrcrds)
48 | })
49 | test_that('gb_df_generate() works', {
50 | df <- gb_df_generate(records = sample(records, size = 3))
51 | expect_true(nrow(df) == 3)
52 | expctd_clnms <- c("accession", "version", "organism", "raw_definition",
53 | "raw_sequence", "raw_record")
54 | expect_true(all(colnames(df) %in% expctd_clnms))
55 | })
56 | test_that('gb_df_generate() can filter by accession', {
57 | accs_filter <- c("AC092025", "AC090116", "AC091644")
58 | df <- gb_df_generate(
59 | records = records,
60 | acc_filter = accs_filter)
61 | expect_equal(sort(accs_filter), sort(df$accession))
62 | expect_true(nrow(df) == 3)
63 | expctd_clnms <- c("accession", "version", "organism", "raw_definition",
64 | "raw_sequence", "raw_record")
65 | expect_true(all(colnames(df) %in% expctd_clnms))
66 | })
67 | test_that('gb_sql_add() works', {
68 | setup()
69 | on.exit(cleanup())
70 | df <- gb_df_generate(records = sample(records, size = 3))
71 | gb_sql_add(df = df)
72 | expect_true(file.exists(sql_path_get()))
73 | })
74 | cleanup()
75 |
--------------------------------------------------------------------------------
/tests/testthat/test-mock-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | context('Testing \'mock-tools\'')
6 | test_that('mock_rec() works', {
7 | record <- mock_rec(i = 1)
8 | expect_true(is.character(record))
9 | })
10 | test_that('mock_seq() works', {
11 | sequence <- mock_seq(i = 1, sqlngth = 100)
12 | expect_true(grepl(pattern = '[atcg]', x = sequence))
13 | expect_true(nchar(gsub(pattern = '[^atcg]', replacement = '',
14 | x = sequence)) == 100)
15 | })
16 | test_that('mock_def() works', {
17 | def <- mock_def(i = 1)
18 | expect_true(is.character(def))
19 | })
20 | test_that('mock_org() works', {
21 | org <- mock_org(i = 1)
22 | expect_true(is.character(org))
23 | })
24 | test_that('mock_gb_df_generate() works', {
25 | df <- mock_gb_df_generate(n = 100)
26 | expect_true(nrow(df) == 100)
27 | })
28 |
--------------------------------------------------------------------------------
/tests/testthat/test-print-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | context('Testing \'print-tools\'')
6 | test_that('stat() works', {
7 | coloured_text <- stat('example text', 'example text')
8 | cat(coloured_text)
9 | expect_true(inherits(coloured_text, 'character'))
10 | })
11 | test_that('char() works', {
12 | coloured_text <- char(x = 'example text')
13 | cat(coloured_text)
14 | expect_true(inherits(coloured_text, 'character'))
15 | })
16 | test_that('cat_line() works', {
17 | nores <- cat_line('example text')
18 | expect_null(nores)
19 | })
20 |
--------------------------------------------------------------------------------
/tests/testthat/test-rentrez-wrappers.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # VARS
5 | nrcrds <- 10 # how many fake records to test on?
6 | wd <- getwd()
7 | data_d <- testdatadir_get()
8 |
9 | # DATA
10 | records <- readRDS(file = file.path(data_d, 'records.RData'))
11 |
12 | # SETUP
13 | cleanup()
14 | setup()
15 | df <- gb_df_generate(records = sample(records, size = nrcrds))
16 | ids <- as.character(df[['accession']])
17 | gb_sql_add(df = df)
18 |
19 | # RUNNING
20 | context('Testing \'rentrez-wrappers\'')
21 | test_that('entrez_fetch() works', {
22 | # TODO, what if an ID that is not in the local db is given?
23 | fasta_res <- entrez_fetch(db = 'nucleotide', id = sample(ids, 2),
24 | rettype = 'fasta')
25 | gb_res <- entrez_fetch(db = 'nucleotide', id = sample(ids, 2),
26 | rettype = 'gb')
27 | # xml is not supported, rentrez will be called
28 | local_mocked_bindings(
29 | entrez_fetch = function(...) TRUE, .package = "rentrez"
30 | )
31 | res <- entrez_fetch(db = 'nucleotide', id = sample(ids, 2),
32 | rettype = 'gb', retmode = 'xml')
33 | expect_true(res)
34 | })
35 | cleanup()
36 |
--------------------------------------------------------------------------------
/tests/testthat/test-status-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | cleanup()
6 | context('Testing \'status-tools\'')
7 | test_that('restez_status() works', {
8 | on.exit(cleanup())
9 | expect_error(restez_status(gb_check = FALSE))
10 | setup()
11 | status_obj <- restez_status(gb_check = FALSE)
12 | expect_true(status_obj$`Restez path`$`Does path exist?`)
13 | demo_db_create(n = 10)
14 | status_obj <- restez_status(gb_check = FALSE)
15 | expect_true(status_obj$Database$`Does path exist?`)
16 | expect_equal(as.character(status_obj$Database$`Total size`), "780K")
17 | expect_true(status_obj$Database$`Does the database have data?`)
18 | expect_equal(status_obj$Database$`Number of sequences`, 10)
19 | expect_equal(status_obj$Database$`Min. sequence length`, "0")
20 | expect_equal(status_obj$Database$`Max. sequence length`, "Inf")
21 | })
22 | test_that('status_class() works', {
23 | cleanup()
24 | setup()
25 | expect_true(inherits(status_class(), 'status'))
26 | })
27 | test_that('print.status() works', {
28 | cleanup()
29 | setup()
30 | expect_null(print.status(status_class()))
31 | })
32 | cleanup()
33 |
--------------------------------------------------------------------------------
/tests/testthat/test-test-tools.R:
--------------------------------------------------------------------------------
1 | # LIBS
2 | library(testthat)
3 |
4 | # RUNNING
5 | context('Testing \'test-tools\'')
6 | test_that('cleanup() works', {
7 | dir.create('test_db_fldr')
8 | cleanup()
9 | expect_false(dir.exists('test_db_fldr'))
10 | })
11 | test_that('testdatadir_get() works', {
12 | expect_true(dir.exists(testdatadir_get()))
13 | })
14 |
--------------------------------------------------------------------------------
/vignettes/precompile.R:
--------------------------------------------------------------------------------
1 | # Load package in working state
2 | # not with library()
3 | library(devtools)
4 | library(knitr)
5 | load_all()
6 |
7 | # First five vignettes require downloaded rodent db, must be precompiled:
8 |
9 | # gen rodent db
10 | if (!dir.exists(file.path('rodents'))) {
11 | source(file.path('other', 'rodent_db.R'))
12 | }
13 |
14 | # precompile
15 | vgnts <- c('1_rodents.Rmd', '2_search_and_fetch.Rmd', '3_parsing.Rmd',
16 | '4_phylotaR.Rmd', '5_tips_and_tricks.Rmd')
17 | for (vgnt in vgnts) {
18 | knit(paste0("vignettes/", vgnt, ".orig"), paste0("vignettes/", vgnt))
19 | }
20 |
21 | build_vignettes()
22 |
--------------------------------------------------------------------------------