diff options
| author | Munyoki Kilyungi | 2026-02-02 19:24:00 +0300 |
|---|---|---|
| committer | Munyoki Kilyungi | 2026-02-02 19:24:00 +0300 |
| commit | b74daa61e858b4b09ec377322d1f4c3105a5b24d (patch) | |
| tree | 369d32ccfc6deaa09e37a0ef6e2aeddbf5c00578 /examples | |
| parent | efde1c08d7578496b3daf2fcf660d66b14dfbd95 (diff) | |
| download | gn-transform-databases-b74daa61e858b4b09ec377322d1f4c3105a5b24d.tar.gz | |
Update phenotypes.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/phenotype.scm | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/examples/phenotype.scm b/examples/phenotype.scm index d3ef4ba..af47b51 100755 --- a/examples/phenotype.scm +++ b/examples/phenotype.scm @@ -12,8 +12,55 @@ (transform sql) (transform triples) (transform special-forms)) + +(define (blank-p str) + (if (string-blank? str) #f str)) +(define-transformer gnc:phenotype->gn:phenotype + (tables (Phenotype)) + (triples "gnc:phenotype" + (set skos:member + (let ((post-abbrev (blank-p (field Phenotype Post_publication_abbreviation))) + (pre-abbrev (blank-p (field Phenotype Pre_publication_abbreviation))) + (post-desc (blank-p (field Phenotype Post_publication_description))) + (pre-desc (blank-p (field Phenotype Post_publication_description)))) + (string->identifier + "phenotype" + (or post-abbrev pre-abbrev post-desc pre-desc) + #:separator "_"))))) + +(define-transformer gn:phenotype->metadata + (tables (Phenotype)) + (triples (let ((post-abbrev (blank-p (field Phenotype Post_publication_abbreviation))) + (pre-abbrev (blank-p (field Phenotype Pre_publication_abbreviation))) + (post-desc (blank-p (field Phenotype Post_publication_description))) + (pre-desc (blank-p (field Phenotype Post_publication_description)))) + (string->identifier + "phenotype" + (or post-abbrev pre-abbrev post-desc pre-desc) + #:separator "_")) + (set rdf:type 'gnc:phenotype) + ;; All phenotypes have a post-publication description + (set dct:description + (sanitize-rdf-string + (field Phenotype Post_publication_description))) + ;; All phenotypes have a post-publication abbreviation + (set gnt:abbreviation (sanitize-rdf-string (field Phenotype Post_publication_abbreviation))) + (set gnt:has_lab_code (field Phenotype Lab_code)) + (set gnt:submitter + (sanitize-rdf-string (field Phenotype Submitter))) + (set dct:contributor (sanitize-rdf-string (field Phenotype Owner))) + (set skos:member + (let ((post-abbrev (blank-p (field Phenotype Post_publication_abbreviation))) + (pre-abbrev (blank-p (field Phenotype Pre_publication_abbreviation))) + (post-desc (blank-p (field Phenotype Post_publication_description))) + (pre-desc (blank-p (field Phenotype Post_publication_description)))) + (string->identifier + "phenotype" + (or post-abbrev pre-abbrev post-desc pre-desc) + #:separator "_"))))) + (define-transformer phenotypes (tables (PublishXRef (left-join InbredSet "ON InbredSet.InbredSetId = PublishXRef.InbredSetId") @@ -52,8 +99,8 @@ '^^xsd:double)) (set gnt:locus (sanitize-rdf-string (field PublishXRef Locus))) (set gnt:lod_score (annotate-field - (field ("IFNULL((PublishXRef.LRS/4.604), '')" lrs)) - '^^xsd:double)) + (field ("IFNULL((PublishXRef.LRS/4.604), '')" lrs)) + '^^xsd:double)) (set gnt:additive (annotate-field (field ("IFNULL(PublishXRef.additive, '')" additive)) '^^xsd:double)) @@ -101,7 +148,8 @@ ("pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>"))) (inputs (list - phenotypes)) + gnc:phenotype->gn:phenotype + gn:phenotype->metadata)) (outputs `(#:documentation ,documentation #:rdf ,output)))) |
