nemoR helps R users discover and fetch open-access files
from the Neuroscience Multi-Omic Archive (NeMO). The package is intended
as a data-access layer for neuroscience and single-cell genomics
workflows: search NeMO by biological metadata, build a reproducible
manifest, inspect the planned download, and then download files when
ready.
This task-oriented vignette focuses on the parts of the workflow that are safe to run during package checks. Examples that would download real NeMO data are shown in unevaluated chunks.
After CRAN release, install with:
For a local development install with browsable vignettes, use:
Load the package after installation:
Facet helpers list values that can be used as search filters. These calls query the NeMO portal, so the chunk handles temporary network failures without stopping the vignette build.
safe_portal_call <- function(expr) {
tryCatch(
expr,
error = function(error) {
message("NeMO portal query skipped: ", conditionMessage(error))
NULL
}
)
}
species <- safe_portal_call(nemo_species())
if (!is.null(species)) {
head(species)
}
#> # A tibble: 6 × 2
#> value count
#> <chr> <int>
#> 1 human 4186924
#> 2 house mouse 1953092
#> 3 white-tufted-ear marmoset 72339
#> 4 rhesus macaque 26783
#> 5 chimpanzee 13150
#> 6 western gorilla 10409nemo_search() returns portal records and stores
pagination metadata in an attribute. The example asks for only one row
to keep the query light.
results <- safe_portal_call(
nemo_search(
taxon = "house mouse",
file_format = "h5ad",
access = "open",
target = "files",
size = 1
)
)
if (!is.null(results)) {
results
attr(results, "pagination")
}
#> $count
#> [1] 1
#>
#> $total
#> [1] 27
#>
#> $page
#> [1] 1
#>
#> $pages
#> [1] 27
#>
#> $from
#> [1] 0
#>
#> $sort
#> [1] "file.file_id:asc"
#>
#> $size
#> [1] 1A manifest records file identifiers, file names, formats, URLs, local paths, query provenance, and download status. Here we use direct example URLs so the chunk is fully local and reproducible.
manifest <- nemo_manifest_from_urls(
urls = c(
"https://example.com?file=sample-a.h5ad",
"https://example.com?file=sample-b.h5ad"
),
collection_id = "example-neuro-study"
)
manifest$size <- c(1024^2, 2 * 1024^2)
manifest
#> # A tibble: 2 × 14
#> collection_id file_id file_name file_format size checksum download_url
#> <chr> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 example-neuro-study url:1 example.… h5ad 1.05e6 <NA> https://exa…
#> 2 example-neuro-study url:2 example.… h5ad 2.10e6 <NA> https://exa…
#> # ℹ 7 more variables: local_path <chr>, download_status <chr>,
#> # checksum_verified <lgl>, nemo_api_source <chr>,
#> # manifest_schema_version <chr>, query_parameters <json>, retrieved_at <chr>Before downloading, summarize the manifest size and file types.
nemo_download_plan(manifest, max_size_gb = 1)
#> # A tibble: 1 × 11
#> n_files total_size_gb largest_file_gb unknown_size_files max_size_gb
#> <int> <dbl> <dbl> <int> <dbl>
#> 1 2 0.003 0.002 0 1
#> # ℹ 6 more variables: within_size_limit <lgl>, file_formats <chr>,
#> # data_types <chr>, access <chr>, download_statuses <chr>,
#> # files_with_checksum <int>Manifests are intended to be kept with an analysis so that the file list and search provenance can be reproduced.
path <- tempfile(fileext = ".tsv")
nemo_write_manifest(manifest, path)
restored <- nemo_read_manifest(path)
restored[, c("collection_id", "file_name", "download_status")]
#> # A tibble: 2 × 3
#> collection_id file_name download_status
#> <chr> <chr> <chr>
#> 1 example-neuro-study example.com?file=sample-a.h5ad not_downloaded
#> 2 example-neuro-study example.com?file=sample-b.h5ad not_downloadedDownloading is intentionally not run in this vignette. In an
interactive analysis, use a project-specific folder and keep the saved
manifest. NeMO files can be large, especially raw sequencing data, so
inspect the download plan and set max_size_gb deliberately
before starting a transfer.
downloaded <- nemo_download(
manifest,
destdir = "nemo_downloads",
max_size_gb = 5,
verify_checksum = TRUE
)The high-level helper can also search and preview a workflow without downloading:
sessionInfo()
#> R version 4.6.0 (2026-04-24)
#> Platform: aarch64-apple-darwin23
#> Running under: macOS Tahoe 26.5.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/New_York
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] nemoR_0.99.3
#>
#> loaded via a namespace (and not attached):
#> [1] vctrs_0.7.3 cli_3.6.6 knitr_1.51 rlang_1.2.0
#> [5] xfun_0.58 otel_0.2.0 jsonlite_2.0.0 glue_1.8.1
#> [9] htmltools_0.5.9 sass_0.4.10 rmarkdown_2.31 rappdirs_0.3.4
#> [13] evaluate_1.0.5 jquerylib_0.1.4 tibble_3.3.1 fastmap_1.2.0
#> [17] yaml_2.3.12 lifecycle_1.0.5 httr2_1.2.2 compiler_4.6.0
#> [21] pkgconfig_2.0.3 digest_0.6.39 R6_2.6.1 utf8_1.2.6
#> [25] curl_7.1.0 pillar_1.11.1 magrittr_2.0.5 bslib_0.11.0
#> [29] tools_4.6.0 cachem_1.1.0