From 724ff14a415d32ffa2cdd405a925c9f91a645903 Mon Sep 17 00:00:00 2001
From: Gregory Jefferis <jefferis@gmail.com>
Date: Sat, 31 Aug 2024 14:09:53 +0100
Subject: [PATCH] add experimental support for our fanc metadata

* sourced from neck connective repo
---
 R/meta.R |  2 +-
 R/zzz.R  | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 R/zzz.R

diff --git a/R/meta.R b/R/meta.R
index 40c72a1..51d6e15 100644
--- a/R/meta.R
+++ b/R/meta.R
@@ -169,7 +169,7 @@ manc_meta <- function(ids, ...) {
 fanc_meta <- function(ids=NULL, ...) {
   ids=fanc_ids(ids)
   df=fancr::with_fanc(fancorbanc_meta(table='neuron_information', ids=ids, ...))
-  metaf=getOption('coconatfly.fancmeta')
+  metaf=getOption('coconatfly.fanc_meta')
   if(!is.null(metaf)) {
     # we can use an unevaluated call as an option
     # by evaluating we can trigger function
diff --git a/R/zzz.R b/R/zzz.R
new file mode 100644
index 0000000..9a2143c
--- /dev/null
+++ b/R/zzz.R
@@ -0,0 +1,10 @@
+.onLoad <- function(libname, pkgname) {
+  # set up experimental extra
+  coconatfly.fanc_meta=getOption('coconatfly.fanc_meta')
+  if(is.null(coconatfly.fanc_meta)) {
+    options(coconatfly.fanc_meta=function() {
+      fafbseg::flywire_sirepo_file_memo('https://github.com/flyconnectome/2023neckconnective/blob/dev/data/fanc-neckconnective-anns.tsv', read=TRUE)
+    })
+  }
+  invisible()
+}