#! /usr/bin/env guile !# (use-modules (rnrs programs) (rnrs io ports) (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-transformer gn:markers/snps->metadata (tables (Geno (inner-join Species "ON Geno.SpeciesId = Species.Id")) "WHERE Species.Name != 'monkey'") (triples (string->identifier "marker" (field Geno Name) #:separator "_") (set gnt:has_species (string->identifier "" (remap-species-identifiers (field Species Fullname)))) (set rdf:type 'gnc:dna_marker) (set skos:prefLabel (field Geno Name)) (set skos:altLabel (field Geno Marker_Name)) (set gnt:chr (field Geno Chr)) (set gnt:mb (annotate-field (field Geno Mb) '^^xsd:doubleg)) (set gnt:sequence (field Geno Sequence)) (set gnt:source (field Geno Source)) (set rdfs:comment (field Geno Comments)))) (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 '(("dcat:" "") ("dct:" "") ("gn:" "") ("owl:" "") ("gnc:" "") ("gnd:" "") ("gnt:" "") ("sdmx-measure:" "") ("skos:" "") ("rdf:" "") ("rdfs:" "") ("xsd:" "") ("qb:" "") ("xkos:" "") ("pubmed:" ""))) (inputs (list gn:markers/snps->metadata)) (outputs `(#:documentation ,documentation #:rdf ,output))))