about summary refs log tree commit diff
path: root/examples/dump-probeset-data.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/dump-probeset-data.scm')
-rwxr-xr-xexamples/dump-probeset-data.scm53
1 files changed, 32 insertions, 21 deletions
diff --git a/examples/dump-probeset-data.scm b/examples/dump-probeset-data.scm
index c4e55ab..7ab723d 100755
--- a/examples/dump-probeset-data.scm
+++ b/examples/dump-probeset-data.scm
@@ -20,10 +20,14 @@
 
 (define-dump dump-probeset-data
   (tables (ProbeSetXRef
-           (left-join ProbeSet "ON ProbeSet.Id = ProbeSetXRef.ProbeSetId")
-           (left-join ProbeSetFreeze "ON ProbeSet.ProbeSetFreezeId = ProbeSetFreeze.Id")))
-  "WHERE ProbeSetFreeze.public > 0 AND ProbeSetFreeze.confidentiality < 1"
+           (left-join ProbeSet "ON ProbeSetXRef.ProbeSetId = ProbeSet.Id")
+           (left-join ProbeSetFreeze "ON ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id"))
+          "WHERE ProbeSetFreeze.public > 0 AND ProbeSetFreeze.confidentiality < 1")
   (schema-triples
+   (gnc:probesetStatistics a skos:Concept)
+   (gnc:probesetStatistics
+    skos:description
+    "This is a set of controlled terms that are used to describe a given probeset's statistics")
    (gnt:mean rdfs:domain gnc:probeset)
    (gnt:locus rdfs:domain gnc:probeset)
    (gnt:LRS rdfs:domain gnc:probeset)
@@ -33,25 +37,32 @@
    (gnt:pValue rdfs:range xsd:double)
    (gnt:h2 rdfs:domain gnc:probeset)
    (gnt:h2 rdfs:range xsd:double))
-  (triples (let ((id (field ("IF(NULLIF(TRIM(ProbeSet.Name), '') IS NULL, '', TRIM(ProbeSet.Name))"
-                             ProbeSetIdName)))
-                 (probeset-id (field ProbeSet Id)))
-             (if (string-null? id)
-                 (string->identifier
-                  "probeset"
-                  (number->string
-                   probeset-id))
-                 (string->identifier
-                  ""
-                  (regexp-substitute/global
-                   #f "[^A-Za-z0-9:]"
-                   id
-                   'pre "_" 'post)
-                  #:separator ""
-                  #:proc string-capitalize-first)))
+  (triples
+      (string->identifier
+       ""
+       (regexp-substitute/global
+        #f "[^A-Za-z0-9:]"
+        (field
+         ("CONCAT(ProbeSetFreeze.Name, '_', IF(NULLIF(TRIM(ProbeSet.Name), ProbeSet.Id) IS NULL, '', TRIM(ProbeSet.Name)))"
+          probesetData))
+        'pre "_" 'post)
+       #:separator ""
+       #:proc string-capitalize-first)
+    (set rdf:type 'gnc:probesetStatistics)
+    (set gnt:hasProbeSet (let ((id (field ("IF(NULLIF(TRIM(ProbeSet.Name), '') IS NULL, '', TRIM(ProbeSet.Name))"
+                                           ProbeSetIdName)))
+                               (probeset-id (field ProbeSet Id)))
+                           (string->identifier
+                            "probeset"
+                            (if (string-null? id)
+                                (number->string probeset-id)
+                                (regexp-substitute/global
+                                 #f "[^A-Za-z0-9:]"
+                                 id
+                                 'pre "_" 'post)))))
     (set gnt:mean (annotate-field (field ("IFNULL(ProbeSetXRef.mean, '')" mean))
                                   '^^xsd:double))
-    (set gnt:locus (field PublishXRef Locus))
+    (set gnt:locus (field ProbeSetXRef Locus))
     (set gnt:LRS (annotate-field
                   (field ("IFNULL(ProbeSetXRef.LRS, '')" lrs))
                   '^^xsd:double))
@@ -87,7 +98,7 @@
     ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
     ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")))
  (inputs
-  (list dump-probeset-metadata))
+  (list dump-probeset-data))
  (outputs
   '(#:documentation "./docs/dump-probeset-summary-stats.md"
     #:rdf "./verified-data/dump-probeset-summary-stats.ttl")))