about summary refs log tree commit diff
path: root/examples/probeset.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/probeset.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/probeset.scm')
-rwxr-xr-xexamples/probeset.scm71
1 files changed, 38 insertions, 33 deletions
diff --git a/examples/probeset.scm b/examples/probeset.scm
index 2dfdbc2..fa2fff6 100755
--- a/examples/probeset.scm
+++ b/examples/probeset.scm
@@ -3,19 +3,13 @@
 
 (use-modules (srfi srfi-1)
              (srfi srfi-26)
+             (ice-9 getopt-long)
              (ice-9 match)
              (ice-9 regex)
              (transform strings)
              (transform sql)
              (transform triples)
              (transform special-forms))
-
-
-
-(define %connection-settings
-  (call-with-input-file (list-ref (command-line) 1)
-    read))
-
 
 (define-transformer probeset
   (tables (ProbeSet
@@ -156,29 +150,40 @@
 
 
 
-(with-documentation
- (name "ProbeSet Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
-  '(("gn:" "<http://genenetwork.org/id/>")
-    ("probeset:" "<http://genenetwork.org/probeset/>")
-    ("gnc:" "<http://genenetwork.org/category/>")
-    ("gnt:" "<http://genenetwork.org/term/>")
-    ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
-    ("kegg:" "<http://bio2rdf.org/ns/kegg#>")
-    ("pubchem:" "<https://pubchem.ncbi.nlm.nih.gov/>")
-    ("omim:" "<https://www.omim.org/entry/>")
-    ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
-    ("uniprot:" "<http://purl.uniprot.org/uniprot/>")
-    ("chebi:" "<http://purl.obolibrary.org/obo/CHEBI_>")
-    ("dct:" "<http://purl.org/dc/terms/>")
-    ("owl:" "<http://www.w3.org/2002/07/owl#>")
-    ("homologene:" "<https://bio2rdf.org/homologene:>")
-    ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
-    ("skos:" "<http://www.w3.org/2004/02/skos/core#>")))
- (inputs
-  (list probeset))
- (outputs
-  '(#:documentation "./docs/probeset.md"
-    #:rdf "./verified-data/probeset.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 "ProbeSet Metadata")
+   (connection %connection-settings)
+   (table-metadata? #f)
+   (prefixes
+    '(("gn:" "<http://genenetwork.org/id/>")
+      ("probeset:" "<http://genenetwork.org/probeset/>")
+      ("gnc:" "<http://genenetwork.org/category/>")
+      ("gnt:" "<http://genenetwork.org/term/>")
+      ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+      ("kegg:" "<http://bio2rdf.org/ns/kegg#>")
+      ("pubchem:" "<https://pubchem.ncbi.nlm.nih.gov/>")
+      ("omim:" "<https://www.omim.org/entry/>")
+      ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+      ("uniprot:" "<http://purl.uniprot.org/uniprot/>")
+      ("chebi:" "<http://purl.obolibrary.org/obo/CHEBI_>")
+      ("dct:" "<http://purl.org/dc/terms/>")
+      ("owl:" "<http://www.w3.org/2002/07/owl#>")
+      ("homologene:" "<https://bio2rdf.org/homologene:>")
+      ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
+      ("skos:" "<http://www.w3.org/2004/02/skos/core#>")))
+   (inputs
+    (list probeset))
+   (outputs
+    `(#:documentation ,documentation
+      #:rdf ,output))))