aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-08-15 20:21:30 +0300
committerMunyoki Kilyungi2023-08-15 20:21:30 +0300
commita1c634f5208b93edbde3d27a83ff60bc5dab8ca8 (patch)
tree86064c75dab96863dc1e8699e1bff9c28fba9d07 /examples
parentf4b2a5bb7a8a010c6980b4e0e8f83116e8f7165c (diff)
downloadgn-transform-databases-a1c634f5208b93edbde3d27a83ff60bc5dab8ca8.tar.gz
Rename dump-probeset-metadata -> dump-probeset-data
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/dump-probeset-data.scm53
-rwxr-xr-xexamples/dump-probeset-metadata.scm93
2 files changed, 32 insertions, 114 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")))
diff --git a/examples/dump-probeset-metadata.scm b/examples/dump-probeset-metadata.scm
deleted file mode 100755
index 045a747..0000000
--- a/examples/dump-probeset-metadata.scm
+++ /dev/null
@@ -1,93 +0,0 @@
-#! /usr/bin/env guile
-!#
-
-(use-modules (srfi srfi-1)
- (srfi srfi-26)
- (ice-9 match)
- (ice-9 regex)
- (dump strings)
- (dump sql)
- (dump triples)
- (dump special-forms))
-
-
-
-(define %connection-settings
- (call-with-input-file (list-ref (command-line) 1)
- read))
-
-
-(define-dump dump-probeset-metadata
- (tables (ProbeSetXRef
- (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
- (gnt:hasProbeset rdfs:range rdfs:Literal))
- (triples
- (string->identifier
- ""
- (regexp-substitute/global #f "[^A-Za-z0-9:]"
- (field ProbeSetFreeze Name)
- 'pre "_" 'post)
- #:separator ""
- #:proc string-capitalize-first)
- (set rdf:type 'gnc:probesetData)
- (set gnt:hasProbeset
- (ontology
- 'probeset:
- (regexp-substitute/global
- #f "[^A-Za-z0-9:]"
- (field ("IFNULL(ProbeSet.Name, ProbeSet.Id)"
- name))
- 'pre "_" 'post)))
- (set gnt:probesetOfDataset
- (ontology
- 'probeset:
- (regexp-substitute/global #f "[^A-Za-z0-9:]"
- (field ProbeSetFreeze Name)
- 'pre "_" 'post)))
- (set gnt:mean
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.mean, '')" mean))
- '^^xsd:double))
- (set gnt:se
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.se, '')" se))
- '^^xsd:double))
- (set gnt:locus (field ProbeSetXRef Locus))
- (set gn:LRS
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.LRS, '')" LRS))
- '^^xsd:double))
- (set gnt:pValue
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.pValue, '')" pValue))
- '^^xsd:double))
- (set gnt:additive
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.additive, '')" additive))
- '^^xsd:double))
- (set gnt:h2
- (annotate-field
- (field ("IFNULL(ProbeSetXRef.h2, '')" h2))
- '^^xsd:float))))
-
-
-
-(dump-with-documentation
- (name "Probeset Metadata")
- (connection %connection-settings)
- (table-metadata? #f)
- (prefixes
- '(("gn:" "<http://genenetwork.org/id/>")
- ("gnc:" "<http://genenetwork.org/category/>")
- ("gnt:" "<http://genenetwork.org/id/>")
- ("rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
- ("rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
- ("xsd:" "<http://www.w3.org/2001/XMLSchema#>")))
- (inputs
- (list dump-probeset-metadata))
- (outputs
- '(#:documentation "./docs/dump-probeset-metadata.md"
- #:rdf "./verified-data/dump-probeset-metadata.ttl")))