about summary refs log tree commit diff
path: root/examples/genotype-datasets.scm
diff options
context:
space:
mode:
Diffstat (limited to 'examples/genotype-datasets.scm')
-rwxr-xr-xexamples/genotype-datasets.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/examples/genotype-datasets.scm b/examples/genotype-datasets.scm
index ba31088..ebe2349 100755
--- a/examples/genotype-datasets.scm
+++ b/examples/genotype-datasets.scm
@@ -36,6 +36,19 @@
     (set gnt:has_strain (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_"))
     (set dct:created (annotate-field (field GenoFreeze CreateTime) '^^xsd:datetime))))
 
+(define-transformer gn:dataset->marker/snp-count
+  (tables (GenoFreeze
+           (inner-join InbredSet "ON InbredSet.Id = GenoFreeze.InbredSetId")
+           (inner-join Species "ON InbredSet.SpeciesId = Species.Id")
+           (inner-join Geno "ON Geno.SpeciesId = Species.Id"))
+          "WHERE GenoFreeze.public > 0 AND Species.Name != 'monkey' GROUP BY GenoFreeze.Name")
+  (triples (string->identifier "dataset" (field GenoFreeze Name) #:separator "_")
+    (set gnt:has_marker_count
+         (string->symbol
+          (format #f "'~s'^^xsd:integer"
+                  (field
+                   ("COUNT(DISTINCT Geno.Marker_Name)" MarkerCount)))))))
+
 
 (let* ((option-spec
         '((settings (single-char #\s) (value #t))
@@ -67,7 +80,8 @@
    (inputs
     (list
      gn:set->gn:dataset
-     gn:dataset->metadata))
+     gn:dataset->metadata
+     gn:dataset->marker/snp-count))
    (outputs
     `(#:documentation ,documentation
       #:rdf ,output))))