From 99cef5dab86b93fb6f7d600297bd4fbb54622a64 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 21 Aug 2023 15:37:37 +0300 Subject: Remove hard-coded paths Signed-off-by: Munyoki Kilyungi --- examples/dataset-metadata.scm | 75 +++++++++++++++++++++++-------------------- examples/generif.scm | 67 +++++++++++++++++++++----------------- examples/genotype.scm | 56 +++++++++++++++++--------------- examples/phenotype.scm | 61 +++++++++++++++++++---------------- examples/probeset.scm | 71 +++++++++++++++++++++------------------- examples/publication.scm | 58 ++++++++++++++++++--------------- examples/species-metadata.scm | 63 ++++++++++++++++++------------------ examples/tissue.scm | 61 +++++++++++++++++++---------------- 8 files changed, 278 insertions(+), 234 deletions(-) (limited to 'examples') 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:" "") - ("foaf:" "") - ("gdmt:" "") - ("skos:" "") - ("geoSeries:" "") - ("gnt:" "") - ("gn:" "") - ("gnc:" "") - ("rdf:" "") - ("owl:" "") - ("rdfs:" "") - ("taxon:" "") - ("dct:" ""))) - (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:" "") + ("foaf:" "") + ("gdmt:" "") + ("skos:" "") + ("geoSeries:" "") + ("gnt:" "") + ("gn:" "") + ("gnc:" "") + ("rdf:" "") + ("owl:" "") + ("rdfs:" "") + ("taxon:" "") + ("dct:" ""))) + (inputs + (list info-files + publishfreeze + genofreeze + probesetfreeze + investigators + gene-chip)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) + 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:" "") - ("rdfs:" "") - ("gn:" "") - ("gnc:" "") - ("gnt:" "") - ("dct:" "") - ("pubmed:" "") - ("ncbiTaxon:" "") - ("generif:" "") - ("xsd:" "") - ("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:" "") + ("rdfs:" "") + ("gn:" "") + ("gnc:" "") + ("gnt:" "") + ("dct:" "") + ("pubmed:" "") + ("ncbiTaxon:" "") + ("generif:" "") + ("xsd:" "") + ("owl:" ""))) + (inputs + (list ;; genewiki-symbols + gn-genewiki-entries + ;; ncbi-genewiki-entries + )) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) 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:" "") - ("gn:" "") - ("gnc:" "") - ("gnt:" "") - ("rdf:" "") - ("rdfs:" "") - ("owl:" "") - ("skos:" "") - ("xsd:" ""))) - (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:" "") + ("gn:" "") + ("gnc:" "") + ("gnt:" "") + ("rdf:" "") + ("rdfs:" "") + ("owl:" "") + ("skos:" "") + ("xsd:" ""))) + (inputs + (list genotypes)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) diff --git a/examples/phenotype.scm b/examples/phenotype.scm index 31d7972..772c2bc 100755 --- a/examples/phenotype.scm +++ b/examples/phenotype.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) @@ -12,12 +13,6 @@ (transform triples) (transform special-forms)) - - -(define %connection-settings - (call-with-input-file (list-ref (command-line) 1) - read)) - (define-transformer phenotypes (tables (PublishXRef @@ -102,24 +97,36 @@ -(with-documentation - (name "Phenotypes Metadata") - (connection %connection-settings) - (table-metadata? #f) - (prefixes - '(("dct:" "") - ("gn:" "") - ("owl:" "") - ("gnc:" "") - ("gnt:" "") - ("skos:" "") - ("rdf:" "") - ("rdfs:" "") - ("xsd:" "") - ("pubmed:" ""))) - (inputs - (list - phenotypes)) - (outputs - '(#:documentation "./docs/phenotype.md" - #:rdf "/export/data/genenetwork-virtuoso/phenotype.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 "Phenotypes Metadata") + (connection %connection-settings) + (table-metadata? #f) + (prefixes + '(("dct:" "") + ("gn:" "") + ("owl:" "") + ("gnc:" "") + ("gnt:" "") + ("skos:" "") + ("rdf:" "") + ("rdfs:" "") + ("xsd:" "") + ("pubmed:" ""))) + (inputs + (list + phenotypes)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) + 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:" "") - ("probeset:" "") - ("gnc:" "") - ("gnt:" "") - ("rdf:" "") - ("kegg:" "") - ("pubchem:" "") - ("omim:" "") - ("rdfs:" "") - ("uniprot:" "") - ("chebi:" "") - ("dct:" "") - ("owl:" "") - ("homologene:" "") - ("xsd:" "") - ("skos:" ""))) - (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:" "") + ("probeset:" "") + ("gnc:" "") + ("gnt:" "") + ("rdf:" "") + ("kegg:" "") + ("pubchem:" "") + ("omim:" "") + ("rdfs:" "") + ("uniprot:" "") + ("chebi:" "") + ("dct:" "") + ("owl:" "") + ("homologene:" "") + ("xsd:" "") + ("skos:" ""))) + (inputs + (list probeset)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) diff --git a/examples/publication.scm b/examples/publication.scm index d9e2aa5..81606b2 100755 --- a/examples/publication.scm +++ b/examples/publication.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 publication (tables (Publication)) (triples @@ -59,23 +54,34 @@ -(with-documentation - (name "Publications Metadata") - (connection %connection-settings) - (table-metadata? #f) - (prefixes - '(("gnt:" "") - ("fabio:" "") - ("dct:" "") - ("prism:" "") - ("gn:" "") - ("gnc:" "") - ("pubmed:" "") - ("rdfs:" "") - ("xsd:" "") - ("rdf:" ""))) - (inputs - (list publication)) - (outputs - '(#:documentation "./docs/publication.md" - #:rdf "./verified-data/publication.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 "Publications Metadata") + (connection %connection-settings) + (table-metadata? #f) + (prefixes + '(("gnt:" "") + ("fabio:" "") + ("dct:" "") + ("prism:" "") + ("gn:" "") + ("gnc:" "") + ("pubmed:" "") + ("rdfs:" "") + ("xsd:" "") + ("rdf:" ""))) + (inputs + (list publication)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) 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:" "") - ("gnc:" "") - ("owl:" "") - ("gnt:" "") - ("skos:" "") - ("rdf:" "") - ("rdfs:" "") - ("taxon:" ""))) - (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:" "") + ("gnc:" "") + ("owl:" "") + ("gnt:" "") + ("skos:" "") + ("rdf:" "") + ("rdfs:" "") + ("taxon:" ""))) + (inputs + (list inbred-set species strain mapping-method avg-method)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) + diff --git a/examples/tissue.scm b/examples/tissue.scm index 22b715e..ce9f345 100755 --- a/examples/tissue.scm +++ b/examples/tissue.scm @@ -3,48 +3,53 @@ (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 tissue - ;; The Name and TissueName fields seem to be identical. BIRN_lex_ID - ;; and BIRN_lex_Name are mostly NULL. - (tables (Tissue)) + ;; The Name and TissueName fields seem to be identical. BIRN_lex_ID + ;; and BIRN_lex_Name are mostly NULL. + (tables (Tissue)) (schema-triples (gnc:tissue a skos:Concept)) ;; Hopefully the Short_Name field is distinct and can be used as an ;; identifier. (triples (string->identifier "tissue" (field Tissue Short_Name)) - (set rdf:type 'gnc:tissue) - (set rdfs:label (field Tissue Name)))) + (set rdf:type 'gnc:tissue) + (set rdfs:label (field Tissue Name)))) -(with-documentation - (name "Tissue Metadata") - (connection %connection-settings) - (table-metadata? #f) - (prefixes - '(("gn:" "") - ("gnt:" "") - ("skos:" "") - ("gnc:" "") - ("rdf:" "") - ("rdfs:" ""))) - (inputs - (list tissue)) - (outputs - '(#:documentation "./docs/tissue.md" - #:rdf "./verified-data/tissue.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 "Tissue Metadata") + (connection %connection-settings) + (table-metadata? #f) + (prefixes + '(("gn:" "") + ("gnt:" "") + ("skos:" "") + ("gnc:" "") + ("rdf:" "") + ("rdfs:" ""))) + (inputs + (list tissue)) + (outputs + `(#:documentation ,documentation + #:rdf ,output)))) -- cgit v1.2.3