
Options and environment variables used by isoformic
Source:R/isoformic-options.R
isoformic-options.Rdisoformic has five package options, isoformic.duckdb_memory_limit,
isoformic.duckdb_threads, isoformic.frozen_mirrors,
isoformic.orf_cache and isoformic.workers, and is otherwise
configured through base R options, the environment variables that locate
the user cache and the settings of the packages it builds on.
This page lists every setting the package reads or is affected by, what
it changes and where it is used. Settings are read at call time, so they
can be changed with options() / Sys.setenv() in a session, scoped
with withr::with_options() / withr::with_envvar(), or placed in
.Rprofile / .Renviron.
Package options
isoformic.duckdb_threadsNumber of threads of the DuckDB connections that read and write Parquet and run the annotation and uncertainty queries: a single positive whole number, such as
4. Default: unset. WhenSLURM_CPUS_PER_TASKis set or the affinity mask of the R process excludes some CPUs (taskset, schedulers that pin cores), isoformic uses the smallest ofSLURM_CPUS_PER_TASK, the CPUs of the mask and the cgroup CPU quota. Otherwise DuckDB uses all the CPUs of the machine, or the cgroup CPU quota when there is one.isoformic.duckdb_memory_limitMemory limit of each DuckDB connection: a single string with a size and a unit, such as
"8GB"or"512MiB"(units KB, MB, GB, TB, KiB, MiB, GiB, TiB), of at least 1 MiB. A query above it spills to disk when it can and fails otherwise. Default: unset. isoformic then sets 80% ofSLURM_MEM_PER_NODE, or ofSLURM_MEM_PER_CPUtimesSLURM_CPUS_PER_TASK(or 1), when one is set, or 80% of the cgroup memory limit when that is smaller, and at least 64 MiB; otherwise DuckDB uses 80% of the RAM, or of the cgroup memory limit when there is one. Set it explicitly underulimit -v, which DuckDB does not see. Both DuckDB options are read when a connection opens a database. A database file that is already open in the session (by a connection that is still open) is shared and keeps the settings it was opened with.isoformic.frozen_mirrorsCharacter vector of base URLs tried first by
fetch_frozen_data()(and every function that loads a frozen dataset, such asadd_appris()orpolya_sites(polya_atlas = "polyasite")) before thefrozen-dataGitHub release and the Zenodo record returned byfrozen_mirrors(). Each URL is joined with the file name of the dataset, for exampleoptions(isoformic.frozen_mirrors = "https://zenodo.org/records/<id>/files/")pins an analysis to one Zenodo deposit, and"file:///data/isoformic-frozen/"serves the files from a local or institutional mirror. The MD5 recorded infrozen_datasets()is verified whatever the mirror. Default: unset (no extra mirror).isoformic.orf_cacheFALSEstopstranscript_orfs()from reading and writingannot_data_orfs.parquet, the table of the ORFs computed so far that it keeps in the annotation directory. The ORFs are then computed in every session. Default: unset (TRUE).isoformic.workersDefault of the
workersargument ofrun_enrichment(),run_productivity_enrichment()andrun_apa_enrichment(): the number ofmiraidaemons that run theirfgseacalls in parallel, a whole number of at least 1, or"auto"forparallelly::availableCores(). The count is capped at the number offgseacalls. Default: unset (1, serial, the results of earlier versions). Above 1 everyfgseacall gets its own seed, so the sampled p-values differ slightly from a serial run but not between worker counts; see Workers inrun_enrichment().
Base R options
timeoutTimeout in seconds of
utils::download.file()andurl()connections.download_reference(),download_reference_url(),download_hprc_annotation(),download_fantom_cat_tables(),fetch_frozen_data()and the builders in build_frozen_data raise it, for the duration of the download only, to at least thetimeout_limitof the call (3600 seconds by default, large reference files are several gigabytes) and never lower it. Set a larger value for slow connections.download.file.method,download.file.extraDefine what the
method = "auto"default of the download functions resolves to and the extra command line flags of the"wget"and"curl"methods. Passmethodexplicitly to override them for one call.rlang_interactiveOverrides
interactive()forrlang::is_interactive(). In a non-interactive session the download progress is silenced (quiet = TRUEinutils::download.file()) and missing optional packages (for examplefgsea,condathis,readxl,Matrix,SummarizedExperiment, oredgeR,limma,satuRn,DEXSeqandBiocParallelfortest_usage(),miraiforworkersabove 1 in the enrichment functions) raise an error instead of an installation prompt.cli.num_colors,cli.unicode,cli.default_handler,cli.width,cli.progress_show_after,crayon.enabled,crayon.colorsRendering of every message, warning and error, which the package emits through the
clipackage (clialso honours the oldercrayon.*options).cli.unicode = FALSEandcli.num_colors = 1produce plain ASCII output for logs;crayon.enabled = FALSEturns off ANSI colours, andjust testandjust test-fullset it together withcli.unicode = FALSE; see?cli::cli-config.
Environment variables
R_USER_CACHE_DIR,XDG_CACHE_HOMERoot of the user cache.
get_isoformic_cache()resolvestools::R_user_dir("isoformic", "cache"), which honoursR_USER_CACHE_DIRfirst, thenXDG_CACHE_HOME(~/.cacheby default on Linux). On macOS the package setsXDG_CACHE_HOMEto~/.cachefor the lookup when it is unset, so the cache lives in~/.cache/R/isoformic/instead of~/Library/Caches/org.R-project.R/R/isoformic/and never contains a space. The cache holds downloaded references (download_reference()), the frozen datasets (frozen/), their sources (sources/<name>/) and the Zenodo bundle (zenodo_deposit/). Point it to a shared or scratch disk on HPC systems.LOCALAPPDATAOn Windows, the root that
tools::R_user_dir()uses whenR_USER_CACHE_DIRis unset.HOME,USERPROFILEDefine the
~that the defaults above andfs::path_home()expand to.http_proxy,https_proxy,ftp_proxy,no_proxyProxy settings honoured by
utils::download.file()andurl()(libcurlandinternalmethods) and therefore by every download in the package, including the connectivity checkcurl::has_internet()that the download functions run first whencurlis installed.CURL_CA_BUNDLE,SSL_CERT_FILECertificate bundle used by the
libcurldownload method, needed behind TLS-intercepting proxies.SLURM_CPUS_PER_TASK,SLURM_MEM_PER_NODE,SLURM_MEM_PER_CPUSet by Slurm inside a job. When the
isoformic.duckdb_threadsandisoformic.duckdb_memory_limitoptions are unset, they bound the threads and set the memory limit of the DuckDB connections (memory in megabytes, as Slurm writes it;0is ignored), so that DuckDB sizes itself to the job and not to the node.OMP_NUM_THREADS,OPENBLAS_NUM_THREADS,MKL_NUM_THREADS,VECLIB_MAXIMUM_THREADS,R_DATATABLE_NUM_THREADS,R_LIBSSet, for the daemons only, when the enrichment functions start
miraidaemons (workersabove 1, orisoformic_workers()): the thread variables to 1, so that each daemon uses one core, andR_LIBSto the session's.libPaths(), so that the daemons find the packages of the session. The session's own values are not changed.
Settings of other packages
- DuckDB
Every Parquet read and write (
read_parquet(),write_parquet(),read_tabular()) and the heavy joins run in a short-lived in-memory DuckDB connection, which is not shared with user code. Itsthreadsandmemory_limitcome from theisoformic.duckdb_threadsandisoformic.duckdb_memory_limitoptions or the Slurm and affinity defaults described above, and otherwise from DuckDB. Besides these and the storage locations below, the package only turns off the DuckDB progress bar (enable_progress_bar). Extensions, secrets and the files of a query that spills to disk go toisoformic-duckdb/undertempdir(), unless theduckdb.homeoption or theDUCKDB_R_HOMEenvironment variable is set: DuckDB then uses its own locations under that directory.- BiocParallel
Each
fgseacall of the enrichment functions runs withBiocParallel::SerialParam()unlessBPPARAMornprocis passed through..., so a backend set withBiocParallel::register()is not used; the calls run in parallel throughworkersinstead. Theworkersargument oftest_usage()is different: it builds aBiocParallel::MulticoreParam()on Unix-like systems.- mirai
With
workersabove 1 the enrichment functions run on the daemons of themiraicompute profile"isoformic". When that profile has no daemons, they start them (with one thread each) and keep them for the session, resizing them to theworkersof later calls and replacing those that died;isoformic_workers()starts a fixed number ahead or stops them, and they are stopped when the session ends or isoformic is unloaded. Daemons that the user started on the profile (mirai::daemons(n, .compute = "isoformic")) are used as they are and left running; each call puts the session's library paths first on the daemon while it runs, but they keep their own thread settings. Starting daemons withmirai::daemons()draws from the session's random number stream (isoformic's own start does not). Needsmirai2.3.0 or later. Daemons of other profiles, including the default one, are not used or changed.- parallelly
workers = "auto"(or theisoformic.workersoption) callsparallelly::availableCores(), which reads themc.coresoption, theMC_CORES,SLURM_CPUS_PER_TASKand other scheduler environment variables, the CPU affinity mask and the cgroup CPU quota, and its ownparallelly.availableCores.*options andR_PARALLELLY_*variables (see?parallelly::availableCores). Without parallelly,"auto"is one worker.condathis.micromamba_path,CONDATHIS_MICROMAMBA_PATH,CONDA_PREFIX,R_USER_DATA_DIR,XDG_DATA_HOMERead by the
condathispackage, whichsalmon_index(),salmon_quant()andrun_terminus()use to runsalmonand Terminus in micromamba environments: where themicromambabinary is found and where environments are created. See?condathis::condathis.BIOCONDUCTOR_*,R_LIBS*Only relevant for installing the optional packages (
fgsea,SummarizedExperiment,edgeR, ...); the package itself does not read them.
Development and test settings
These are not read by the package code but control its test suite and
checks (see justfile):
ISOFORMIC_FULL"true"runs the tests and articles that download references or run external tools (just test-full,just render-articles-full,just benchmark-memory). Unset by default: the tests, examples and site then use only the data bundled with the package.TESTTHAT_CPUSNumber of parallel testthat workers used by
just test; it only matters when parallel mode is on.TESTTHAT_PARALLEL"true"or"false"; overridesConfig/testthat/parallel: trueinDESCRIPTION.TESTTHAT_PARALLEL=falseruns the test files serially in one process.NOT_CRANSet to
"true"bydevtools::test(); tests that need optional packages usetestthat::skip_if_not_installed(), and only the tests gated byISOFORMIC_FULLdownload data._R_CHECK_SYSTEM_CLOCK_Set to
"0"byjust checkto skip the clock check ofR CMD check --as-cran.HOME,USERPROFILE,R_USER_CACHE_DIR,XDG_CACHE_HOME,R_USER_DATA_DIR,XDG_DATA_HOME,LOCALAPPDATA,APPDATAThe test setup redirects all of them to temporary directories so that tests never touch the user cache.
warnPartialMatchArgs,warnPartialMatchAttr,warnPartialMatchDollarSet to
TRUEby the test setup, so that a partial match of an argument, attribute or$name is a warning.
Examples
# Pin the frozen datasets to one Zenodo deposit for a reproducible run
withr::with_options(
list(isoformic.frozen_mirrors = "https://zenodo.org/records/1234567/files/"),
frozen_mirrors()
)
#> [1] "https://zenodo.org/records/1234567/files/"
#> [2] "https://github.com/luciorq/isoformic/releases/download/frozen-data/"
# Where the cache is, and how to move it
get_isoformic_cache()
#> /home/runner/.cache/R/isoformic
withr::with_envvar(
list(R_USER_CACHE_DIR = tempdir()),
get_isoformic_cache("frozen")
)
#> /tmp/RtmpM3Y6Dd/R/isoformic/frozen