about summary refs log tree commit diff
path: root/examples/species-metadata.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/species-metadata.scm')
-rwxr-xr-xexamples/species-metadata.scm63
1 files changed, 32 insertions, 31 deletions
diff --git a/examples/species-metadata.scm b/examples/species-metadata.scm
index b67c0bc..b330b12 100755
--- a/examples/species-metadata.scm
+++ b/examples/species-metadata.scm
@@ -3,21 +3,14 @@
 
 (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 (remap-species-identifiers str)
   "This procedure remaps identifiers to standard binominal. Obviously this should
    be sorted by correcting the database!"
@@ -201,26 +194,34 @@ At this point it is not very clear how Name, Name2, Symbol and Alias are used.
 
 
 
-(with-documentation
- (name "Species Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
-  '(("gn:" "<http://genenetwork.org/id/>")
-    ("gnc:" "<http://genenetwork.org/category/>")
-    ("owl:" "<http://www.w3.org/2002/07/owl#>")
-    ("gnt:" "<http://genenetwork.org/term/>")
-    ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
-    ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
-    ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
-    ("taxon:" "<http://purl.uniprot.org/taxonomy/>")))
- (inputs
-  (list
-   inbred-set
-   species
-   strain
-   mapping-method
-   avg-method))
- (outputs
-  '(#:documentation "./docs/species-metadata.md"
-    #:rdf "/export/data/genenetwork-virtuoso/species-metadata.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 "Species Metadata")
+   (connection %connection-settings)
+   (table-metadata? #f)
+   (prefixes
+    '(("gn:" "<http://genenetwork.org/id/>")
+      ("gnc:" "<http://genenetwork.org/category/>")
+      ("owl:" "<http://www.w3.org/2002/07/owl#>")
+      ("gnt:" "<http://genenetwork.org/term/>")
+      ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
+      ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+      ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+      ("taxon:" "<http://purl.uniprot.org/taxonomy/>")))
+   (inputs
+    (list inbred-set species strain mapping-method avg-method))
+   (outputs
+    `(#:documentation ,documentation
+      #:rdf ,output))))
+