Skip to content

Commit 3b9424a

Browse files
committed
Add choose_flyem_dataset, choose_malevnc_dataset
* and some doc tweaks
1 parent ab231ad commit 3b9424a

File tree

6 files changed

+108
-1
lines changed

6 files changed

+108
-1
lines changed

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
S3method(print,dvid_tools)
44
export(MANCsym)
5+
export(choose_flyem_dataset)
6+
export(choose_malevnc_dataset)
57
export(clio_auth)
68
export(clio_set_token)
79
export(clio_token)

R/datasets.R

+35
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ flyem_dataset <- function(dataset) {
44
cds[[dataset]]
55
}
66

7+
#' Choose active male VNC / FlyEM dataset
8+
#'
9+
#' @description \code{choose_malevnc_dataset} chooses the dataset that will be
10+
#' used by the male VNC package.
11+
#' @details For \code{choose_malevnc_dataset} the \code{dataset} will be one of
12+
#' \code{MANC} (release) or \code{VNC} (pre-release) dataset. Note the latter
13+
#' will only be available for authenticated collaborators of the FlyEM team.
14+
#' When \code{dataset=NULL} the options("malevnc.dataset") will be checked,
15+
#' then the environment variable \code{MALEVNC_DATASET} and finally the
16+
#' default value (MANC i.e. released dataset) will be selected.
17+
#'
18+
#' @param dataset Character vector specifying dataset name. Default value of
19+
#' \code{NULL} will respect package options or choose default dataset if none
20+
#' set.
21+
#' @param set Whether to set the relevant package options or just to return the,
22+
#' @param use_clio Whether to use clio to list datasets (expert use only;
23+
#' default of \code{use_clio=NA} should do the right thing).
24+
#'
25+
#' @return A list of options (when \code{set=FALSE}) or the \emph{previous}
26+
#' value of those options, mimicking the behaviour of \code{\link{options}}.
27+
#' @export
28+
#'
29+
#' @examples
30+
#' \dontrun{
31+
#' # switch dataset
32+
#' op <- choose_malevnc_dataset("MANC")
33+
#' on.exit(options(op))
34+
#' # reset the previous state
35+
#' options(op)
36+
#' }
737
choose_malevnc_dataset <- function(dataset=NULL,
838
set=TRUE,
939
use_clio=NA) {
@@ -31,6 +61,11 @@ choose_malevnc_dataset <- function(dataset=NULL,
3161
choose_flyem_dataset(dataset = dataset, set=set)
3262
}
3363

64+
#' @rdname choose_malevnc_dataset
65+
#' @export
66+
#' @description \code{choose_flyem_dataset} is a generic function underneath
67+
#' \code{choose_malevnc_dataset}. It is intended primarily for developers of
68+
#' other packages.
3469
choose_flyem_dataset <- function(dataset=getOption("malevnc.dataset"), set=TRUE) {
3570
ds=flyem_dataset(dataset)
3671
s=flyem_servers4dataset(ds)

R/malevnc-package.R

+8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@
99
#'
1010
#' @section Package Options: \itemize{
1111
#'
12+
#' \item \code{malevnc.dataset} A shortname defining the active dataset
13+
#' (usually\code{MANC}). See \code{\link{choose_malevnc_dataset}} for details.
14+
#'
1215
#' \item \code{malevnc.server} The https URL to the main Janelia server
1316
#' hosting male VNC data.
1417
#'
1518
#' }
19+
#'
20+
#' @examples
21+
#' # List all package options
22+
#' options()[grepl("^malevnc", names(options()))]
23+
#'
1624
"_PACKAGE"
1725

1826
# The following block is used by usethis to automatically manage

_pkgdown.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ navbar:
2929
href: SUPPORT.html
3030

3131
reference:
32+
- title: General package functions
33+
contents:
34+
- '`malevnc-package`'
35+
- '`dr_manc`'
3236
- title: Server connections and Neuroglancer URLs
3337
contents:
38+
- '`choose_malevnc_dataset`'
3439
- '`manc_neuprint`'
3540
- '`manc_dvid_node`'
3641
- '`manc_scene`'
3742
- '`dvid_tools`'
3843
- '`flyem_shorten_url`'
39-
- '`dr_manc`'
4044
- title: Body information and ids
4145
contents:
4246
- '`manc_ids`'

man/choose_malevnc_dataset.Rd

+50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/malevnc-package.Rd

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)