about summary refs log tree commit diff
path: root/examples/dataset-metadata.scm
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-08-21 15:37:37 +0300
committerMunyoki Kilyungi2023-08-21 17:52:07 +0300
commit99cef5dab86b93fb6f7d600297bd4fbb54622a64 (patch)
treee3d607fbb53e4ffdc0f94163a26010ab3aa3203f /examples/dataset-metadata.scm
parent8e1e4cceab516afab46ccced63ca9edab663ca11 (diff)
downloadgn-transform-databases-99cef5dab86b93fb6f7d600297bd4fbb54622a64.tar.gz
Remove hard-coded paths
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'examples/dataset-metadata.scm')
-rwxr-xr-xexamples/dataset-metadata.scm75
1 files changed, 41 insertions, 34 deletions
diff --git a/examples/dataset-metadata.scm b/examples/dataset-metadata.scm
index 783b2b7..8bb9607 100755
--- a/examples/dataset-metadata.scm
+++ b/examples/dataset-metadata.scm
@@ -3,6 +3,7 @@
 
 (use-modules (srfi srfi-1)
              (srfi srfi-26)
+             (ice-9 getopt-long)
              (ice-9 match)
              (ice-9 regex)
              (transform strings)
@@ -12,12 +13,6 @@
 
 
 
-(define %connection-settings
-  (call-with-input-file (list-ref (command-line) 1)
-    read))
-
-
-
 ;; One email ID in the Investigators table has spaces in it. This
 ;; function fixes that.
 (define (fix-email-id email)
@@ -356,32 +351,44 @@
 
 
 
-(with-documentation
- (name "Info files / Investigators Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
-  '(("v:" "<http://www.w3.org/2006/vcard/ns#>")
-    ("foaf:" "<http://xmlns.com/foaf/0.1/>")
-    ("gdmt:" "<http://vocab.fairdatacollective.org/gdmt/>")
-    ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
-    ("geoSeries:" "<http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=>")
-    ("gnt:" "<http://genenetwork.org/term/>")
-    ("gn:" "<http://genenetwork.org/id/>")
-    ("gnc:" "<http://genenetwork.org/category/>")
-    ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
-    ("owl:" "<http://www.w3.org/2002/07/owl#>")
-    ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
-    ("taxon:" "<http://purl.uniprot.org/taxonomy/>")
-    ("dct:" "<http://purl.org/dc/terms/>")))
- (inputs
-  (list info-files
-        publishfreeze
-        genofreeze
-        probesetfreeze
-        investigators
-        gene-chip))
- (outputs
-  '(#:documentation "./docs/info-pages.md"
-    #:rdf "/export/data/genenetwork-virtuoso/info-pages.ttl")))
+(let* ((option-spec
+        '((settings (single-char #\s) (value #t))
+          (output (single-char #\o) (value #t))
+          (documentation (single-char #\d) (value #t))))
+       (options (getopt-long (command-line) option-spec))
+       (settings (option-ref options 'settings #f))
+       (output (option-ref options 'output #f))
+       (documentation (option-ref options 'documentation #f))
+       (%connection-settings
+        (call-with-input-file settings
+          read)))
+  (with-documentation
+   (name "Info files / Investigators Metadata")
+   (connection %connection-settings)
+   (table-metadata? #f)
+   (prefixes
+    '(("v:" "<http://www.w3.org/2006/vcard/ns#>")
+      ("foaf:" "<http://xmlns.com/foaf/0.1/>")
+      ("gdmt:" "<http://vocab.fairdatacollective.org/gdmt/>")
+      ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
+      ("geoSeries:" "<http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=>")
+      ("gnt:" "<http://genenetwork.org/term/>")
+      ("gn:" "<http://genenetwork.org/id/>")
+      ("gnc:" "<http://genenetwork.org/category/>")
+      ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+      ("owl:" "<http://www.w3.org/2002/07/owl#>")
+      ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+      ("taxon:" "<http://purl.uniprot.org/taxonomy/>")
+      ("dct:" "<http://purl.org/dc/terms/>")))
+   (inputs
+    (list info-files
+          publishfreeze
+          genofreeze
+          probesetfreeze
+          investigators
+          gene-chip))
+   (outputs
+    `(#:documentation ,documentation
+      #:rdf ,output))))
+