From 522a382af147fac45659afee7a48e10947bddcab Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Fri, 6 Feb 2026 06:31:02 +0300 Subject: Add dna markers and snps. Signed-off-by: Munyoki Kilyungi --- examples/genotype.scm | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ examples/ontology.scm | 23 ++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100755 examples/genotype.scm (limited to 'examples') diff --git a/examples/genotype.scm b/examples/genotype.scm new file mode 100755 index 0000000..4a91b63 --- /dev/null +++ b/examples/genotype.scm @@ -0,0 +1,70 @@ +#! /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)))) + diff --git a/examples/ontology.scm b/examples/ontology.scm index 3d58ecb..4be8bd1 100755 --- a/examples/ontology.scm +++ b/examples/ontology.scm @@ -237,6 +237,9 @@ (triple 'gnt:has_phenotype_data 'skos:definition "This resource has phenotype data.") ;; Genotypes + (triple 'gnc:dna_marker 'a 'owl:Class) + (triple 'gnc:dna_marker 'a 'skos:Concept) + (triple 'gnc:dna_marker 'rdfs:label "A DNA Marker or SNP") (triple 'gnt:has_genotype_data 'rdf:type 'owl:ObjectProperty) (triple 'gnt:has_genotype_data 'rdfs:label "this resources has genotype data.") (triple 'gnt:has_genotype_data 'rdfs:comment "Associates a resource with its genotype data.") @@ -246,4 +249,22 @@ (triple 'gnt:has_marker_count 'rdf:type 'owl:ObjectProperty) (triple 'gnt:has_marker_count 'rdfs:label "this resources has N number of dna markers/SNPs.") (triple 'gnt:has_marker_count 'rdfs:domain 'xsd:integer) - (triple 'gnt:has_marker_count 'rdfs:range 'dcat:Dataset)))) + (triple 'gnt:has_marker_count 'rdfs:range 'dcat:Dataset) + (triple 'gnt:chr 'a 'qb:MeasureProperty) + (triple 'gnt:chr 'a 'rdf:Property) + (triple 'gnt:chr 'rdfs:label "Chromosome") + (triple 'gnt:chr 'rdfs:domain 'gnc:marker) + (triple 'gnt:chr 'rdfs:range 'rdfs:Literal) + (triple 'gnt:chr 'rdfs:subPropertyOf 'sdmx-measure:obsValue) + (triple 'gnt:mb 'rdfs:label "Megabase") + (triple 'gnt:mb 'rdfs:domain 'gnc:marker) + (triple 'gnt:mb 'rdfs:range 'rdfs:Literal) + (triple 'gnt:mb 'rdfs:subPropertyOf 'sdmx-measure:obsValue) + (triple 'gnt:sequence 'rdfs:label "Sequence") + (triple 'gnt:sequence 'rdfs:domain 'gnc:marker) + (triple 'gnt:sequence 'rdfs:range 'rdfs:Literal) + (triple 'gnt:sequence 'rdfs:subPropertyOf 'sdmx-measure:obsValue) + (triple 'gnt:source 'rdfs:label "Source") + (triple 'gnt:source 'rdfs:domain 'gnc:marker) + (triple 'gnt:source 'rdfs:range 'rdfs:Literal) + (triple 'gnt:source 'rdfs:subPropertyOf 'sdmx-measure:obsValue)))) -- cgit 1.4.1