From b74daa61e858b4b09ec377322d1f4c3105a5b24d Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 2 Feb 2026 19:24:00 +0300 Subject: Update phenotypes. Signed-off-by: Munyoki Kilyungi --- examples/phenotype.scm | 54 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'examples') 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:" ""))) (inputs (list - phenotypes)) + gnc:phenotype->gn:phenotype + gn:phenotype->metadata)) (outputs `(#:documentation ,documentation #:rdf ,output)))) -- cgit 1.4.1