about summary refs log tree commit diff
path: root/examples/genotype.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/genotype.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/genotype.scm')
-rwxr-xr-xexamples/genotype.scm56
1 files changed, 31 insertions, 25 deletions
diff --git a/examples/genotype.scm b/examples/genotype.scm
index 6fe60c9..830da0a 100755
--- a/examples/genotype.scm
+++ b/examples/genotype.scm
@@ -5,6 +5,7 @@
              (rnrs io ports)
              (srfi srfi-1)
              (srfi srfi-26)
+             (ice-9 getopt-long)
              (ice-9 match)
              (ice-9 regex)
              (transform strings)
@@ -14,12 +15,6 @@
 
 
 
-(define %connection-settings
-  (call-with-input-file (list-ref (command-line) 1)
-    read))
-
-
-
 (define (remap-species-identifiers str)
   "This procedure remaps identifiers to standard binominal. Obviously this should
    be sorted by correcting the database!"
@@ -103,22 +98,33 @@
 
 
 
-(with-documentation
- (name "Genotype Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
-  '(("dct:" "<http://purl.org/dc/terms/>")
-    ("gn:" "<http://genenetwork.org/id/>")
-    ("gnc:" "<http://genenetwork.org/category/>")
-    ("gnt:" "<http://genenetwork.org/term/>")
-    ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
-    ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
-    ("owl:" "<http://www.w3.org/2002/07/owl#>")
-    ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
-    ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")))
- (inputs
-  (list genotypes))
- (outputs
-  '(#:documentation "./docs/genotype.md"
-    #:rdf "/export/data/genenetwork-virtuoso/genotype.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 "Genotype Metadata")
+   (connection %connection-settings)
+   (table-metadata? #f)
+   (prefixes
+    '(("dct:" "<http://purl.org/dc/terms/>")
+      ("gn:" "<http://genenetwork.org/id/>")
+      ("gnc:" "<http://genenetwork.org/category/>")
+      ("gnt:" "<http://genenetwork.org/term/>")
+      ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+      ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+      ("owl:" "<http://www.w3.org/2002/07/owl#>")
+      ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
+      ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")))
+   (inputs
+    (list genotypes))
+   (outputs
+    `(#:documentation ,documentation
+      #:rdf ,output))))