about summary refs log tree commit diff
path: root/examples/strains.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/strains.scm')
-rwxr-xr-xexamples/strains.scm75
1 files changed, 38 insertions, 37 deletions
diff --git a/examples/strains.scm b/examples/strains.scm
index 2e1e24f..cc98d71 100755
--- a/examples/strains.scm
+++ b/examples/strains.scm
@@ -11,15 +11,6 @@
              (transform triples)
              (transform special-forms))
 
-(define (remap-species-identifiers str)
-  "This procedure remaps identifiers to standard binominal. Obviously this should
-   be sorted by correcting the database!"
-  (match str
-    ["Fly (Drosophila melanogaster dm6)" "Drosophila melanogaster"]
-    ["Oryzias latipes (Japanese medaka)" "Oryzias latipes"]
-    ["Macaca mulatta" "Macaca nemestrina"]
-    ["Bat (Glossophaga soricina)" "Glossophaga soricina"]
-    [str str]))
 
 #!
 
@@ -69,45 +60,56 @@ At this point it is not very clear how Name, Name2, Symbol and Alias are used.
   (schema-triples
    (gnt:alias rdfs:domain gnc:strain)
    (gnt:alias a owl:ObjectProperty)
-   (gnt:geneSymbol rdfs:domain gnc:strain)
-   (gnt:geneSymbol a owl:ObjectProperty))
+   (gnt:gene_symbol rdfs:domain gnc:strain)
+   (gnt:gene_symbol a owl:ObjectProperty))
   (triples (string->identifier
-            ""
-            (regexp-substitute/global
-             #f "[^A-Za-z0-9:]"
-             (field Strain Name)
-             'pre "_" 'post))
+            "strain"
+            (field Strain Name)
+            #:separator "_")
     (set rdf:type 'gnc:strain)
-    (set gnt:belongsToSpecies
-         (string->identifier "" (remap-species-identifiers (field Species Fullname))
-                             #:separator ""
-                             #:proc string-capitalize-first))
+    (set gnt:has_species (string->identifier "" (remap-species-identifiers (field Species Fullname))))
     ;; Name, and maybe a second name
     (set rdfs:label (sanitize-rdf-string (field Strain Name)))
     (set skos:altLabel (sanitize-rdf-string (field ("IF ((Strain.Name2 != Strain.Name), Strain.Name2, '')" Name2))))
     (set gnt:alias (sanitize-rdf-string (field ("IF ((Strain.Alias != Strain.Name), Strain.Alias, '')" Alias))))
-    (set gnt:geneSymbol (field Strain Symbol))))
+    (set gnt:gene_symbol (field Strain Symbol))))
 
 (define-transformer mapping-method
   (tables (MappingMethod))
   (schema-triples
-   (gnc:mappingMethod a skos:Concept)
-   (gnc:mappingMethod skos:definition "Terms that decribe mapping methods used on this resource"))
+   (gnc:mapping_method a skos:ConceptScheme)
+   (gnc:mapping_method skos:prefLabel "Mapping Method Vocabulary")
+   (gnc:mapping_method skos:definition "Controlled vocabulary describing statistical/computational methods used for mapping in GeneNetwork."))
   (triples
-      (string->identifier "mappingMethod" (field MappingMethod Name))
-    (set rdf:type 'gnc:mappingMethod)
-    (set rdfs:label (field MappingMethod Name))))
+      (string->identifier "mapping_method" (field MappingMethod Name) #:separator "_")
+    (set rdf:type 'skos:Concept)
+    (set skos:inScheme 'gnc:mapping_method)
+    (set skos:prefLabel (field MappingMethod Name))))
+
+(define-transformer mapping-method-fan-out
+  (tables (MappingMethod))
+  (triples
+      'gnc:mapping_method
+    (set skos:member (string->identifier "mapping_method" (field MappingMethod Name) #:separator "_"))))
+
+(define-transformer avg-method-fan-out
+  (tables (AvgMethod))
+  (triples
+      'gnc:avg_method
+    (set skos:member (string->identifier "avg_method" (field AvgMethod Name AvgMethodName) #:separator "_"))))
 
 (define-transformer avg-method
   ;; The Name and Normalization fields seem to be the same. Dump only
   ;; the Name field.
   (tables (AvgMethod))
   (schema-triples
-   (gnc:avgMethod a skos:Concept)
-   (gnc:avgMethod skos:definition "Terms that decribe normalization methods used on this resource"))
-  (triples (string->identifier "avgMethod" (field AvgMethod Name AvgMethodName))
-    (set rdf:type 'gnc:avgMethod)
-    (set rdfs:label (field AvgMethod Normalization))))
+   (gnc:avg_method a skos:ConceptScheme)
+   (gnc:avg_method skos:prefLabel "Normalization and Averaging Method Vocabulary")
+   (gnc:avg_method skos:definition "Controlled vocabulary describing normalization, transformation, and summarization methods applied in GeneNetwork."))
+  (triples (string->identifier "avg_method" (field AvgMethod Name AvgMethodName) #:separator "_")
+    (set rdf:type 'skos:Concept)
+    (set skos:inScheme 'gnc:avg_method)
+    (set skos:prefLabel (field AvgMethod Normalization))))
 
 
 
@@ -124,22 +126,21 @@ At this point it is not very clear how Name, Name2, Symbol and Alias are used.
           read)))
 
   (with-documentation
-   (name "Species Metadata")
+   (name "Strain Metadata")
    (connection %connection-settings)
    (table-metadata? #f)
    (prefixes
-    '(("gn:" "<http://genenetwork.org/id/>")
-      ("gnc:" "<http://genenetwork.org/category/>")
+    '(("gn:" "<http://rdf.genenetwork.org/v1/id/>")
+      ("gnc:" "<http://rdf.genenetwork.org/v1/category/>")
       ("owl:" "<http://www.w3.org/2002/07/owl#>")
-      ("gnt:" "<http://genenetwork.org/term/>")
+      ("gnt:" "<http://rdf.genenetwork.org/v1/term/>")
       ("skos:" "<http://www.w3.org/2004/02/skos/core#>")
       ("xkos:" "<http://rdf-vocabulary.ddialliance.org/xkos#>")
       ("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 strain mapping-method avg-method))
+    (list strain mapping-method avg-method mapping-method-fan-out avg-method-fan-out))
    (outputs
     `(#:documentation ,documentation
       #:rdf ,output))))
-