aboutsummaryrefslogtreecommitdiff
path: root/examples/generif.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/generif.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/generif.scm')
-rwxr-xr-xexamples/generif.scm67
1 files changed, 37 insertions, 30 deletions
diff --git a/examples/generif.scm b/examples/generif.scm
index 76f55ee..170cf0c 100755
--- a/examples/generif.scm
+++ b/examples/generif.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))
-
-
-
(define-transformer genewiki-symbols
(tables (GeneRIF_BASIC
(left-join Species "USING (SpeciesId)"))
@@ -124,27 +119,39 @@
-(with-documentation
- (name "GeneRIF Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
- '(("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
- ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
- ("gn:" "<http://genenetwork.org/id/>")
- ("gnc:" "<http://genenetwork.org/category/>")
- ("gnt:" "<http://genenetwork.org/term/>")
- ("dct:" "<http://purl.org/dc/terms/>")
- ("pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
- ("ncbiTaxon:" "<https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=>")
- ("generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
- ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
- ("owl:" "<http://www.w3.org/2002/07/owl#>")))
- (inputs
- (list ;; genewiki-symbols
- gn-genewiki-entries
- ;; ncbi-genewiki-entries
- ))
- (outputs
- '(#:documentation "./docs/generif.md"
- #:rdf "./verified-data/generif.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 "GeneRIF Metadata")
+ (connection %connection-settings)
+ (table-metadata? #f)
+ (prefixes
+ '(("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+ ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+ ("gn:" "<http://genenetwork.org/id/>")
+ ("gnc:" "<http://genenetwork.org/category/>")
+ ("gnt:" "<http://genenetwork.org/term/>")
+ ("dct:" "<http://purl.org/dc/terms/>")
+ ("pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
+ ("ncbiTaxon:" "<https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=>")
+ ("generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
+ ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")
+ ("owl:" "<http://www.w3.org/2002/07/owl#>")))
+ (inputs
+ (list ;; genewiki-symbols
+ gn-genewiki-entries
+ ;; ncbi-genewiki-entries
+ ))
+ (outputs
+ `(#:documentation ,documentation
+ #:rdf ,output))))