diff options
| -rwxr-xr-x | examples/ontology.scm | 6 | ||||
| -rwxr-xr-x | examples/phenotype.scm | 65 |
2 files changed, 39 insertions, 32 deletions
diff --git a/examples/ontology.scm b/examples/ontology.scm index a834045..2e03c53 100755 --- a/examples/ontology.scm +++ b/examples/ontology.scm @@ -232,6 +232,6 @@ (triple 'gnt:submitter 'rdfs:domain 'gnc:phenotype) (triple 'gnt:submitter 'skos:definition "A person who submitted this resource to GN") (triple 'gnt:submitter 'skos:definition "A person who submitted this resource to GN") - (triple 'gnt:has_phenotype_trait 'a 'owl:ObjectProperty) - (triple 'gnt:has_phenotype_trait 'rdfs:domain 'gnc:set) - (triple 'gnt:has_phenotype_trait 'skos:definition "This is the unique trait id assigned from GeneNetwork for a a phenotype. It's a combination of the set name and the phenotype's post pub abbreviation.")))) + (triple 'gnt:has_phenotype_data 'a 'owl:ObjectProperty) + (triple 'gnt:has_phenotype_data 'rdfs:domain 'gnc:set) + (triple 'gnt:has_phenotype_data 'skos:definition "This resource has phenotype data.")))) diff --git a/examples/phenotype.scm b/examples/phenotype.scm index 3e69607..b243ccd 100755 --- a/examples/phenotype.scm +++ b/examples/phenotype.scm @@ -17,6 +17,38 @@ (if (string-blank? str) #f str)) +(define-transformer gn:set->gn:dataset + (tables (Species + (inner-join InbredSet "ON InbredSet.SpeciesId = Species.Id") + (inner-join PublishFreeze "ON PublishFreeze.InbredSetId = InbredSet.Id")) + "WHERE PublishFreeze.public > 0 AND Species.Name != 'monkey' GROUP BY Species.Name, PublishFreeze.ShortName") + (triples (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_") + (multiset gnt:has_phenotype_data + (map (cut string->identifier "dataset" <> #:separator "_") + (string-split + (field ("GROUP_CONCAT(PublishFreeze.Name SEPARATOR ',')" + dataset_name)) + #\,))))) + +(define-transformer gn:dataset->gn:trait + (tables (PublishXRef + (left-join InbredSet "ON InbredSet.InbredSetId = PublishXRef.InbredSetId") + (inner-join PublishFreeze "ON PublishFreeze.InbredSetId = InbredSet.Id") + (left-join Publication "ON Publication.Id = PublishXRef.PublicationId") + (left-join Phenotype "ON Phenotype.Id = PublishXRef.PhenotypeId")) + "WHERE InbredSet.public > 0") + (triples (string->identifier "dataset" (field PublishFreeze Name) #:separator "_") + (set gnt:has_phenotype_trait + (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 + "trait" + (format #f "~a_~a" (field PublishFreeze Name) + (or post-abbrev pre-abbrev post-desc pre-desc)) + #:separator "_"))))) + (define-transformer gnc:phenotype->gn:phenotype (tables (Phenotype)) (triples "gnc:phenotype" @@ -61,24 +93,6 @@ (or post-abbrev pre-abbrev post-desc pre-desc) #:separator "_"))))) -(define-transformer gnc:set->gn:trait - (tables (PublishXRef - (left-join InbredSet "ON InbredSet.InbredSetId = PublishXRef.InbredSetId") - (left-join Publication "ON Publication.Id = PublishXRef.PublicationId") - (left-join Phenotype "ON Phenotype.Id = PublishXRef.PhenotypeId")) - "WHERE InbredSet.public > 0") - (triples (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_") - (set gnt:has_phenotype_trait - (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 - "trait" - (format #f "~a_~a" (field InbredSet Name InbredSetName) - (or post-abbrev pre-abbrev post-desc pre-desc)) - #:separator "_"))))) - (define-transformer gn:trait->gn:phenotype (tables (PublishXRef (left-join InbredSet "ON InbredSet.InbredSetId = PublishXRef.InbredSetId") @@ -91,17 +105,14 @@ (pre-desc (blank-p (field Phenotype Post_publication_description)))) (string->identifier "trait" - (format #f "~a_~a" (field InbredSet Name InbredSetName) + (format #f "~a_~a" (field PublishFreeze Name) (or post-abbrev pre-abbrev post-desc pre-desc)) #:separator "_")) (set rdf:type 'gnc:phenotype_trait) (set gnt:has_strain (string->identifier "set" (field InbredSet Name InbredSetName) #:separator "_")) (set owl:equivalentClass - (string->identifier - "trait" - (field ("CONCAT(IFNULL(InbredSet.InbredSetCode, PublishXRef.InbredSetId), '_', PublishXRef.Id)" - Phenotype)) - #:separator "_")) + (field ("CONCAT(IFNULL(InbredSet.InbredSetCode, PublishXRef.InbredSetId), '_', PublishXRef.Id)" + Phenotype))) (set dct:references (let ((pmid (field ("IF(Publication.PubMed_ID IS NULL, '', CONVERT(Publication.PubMed_Id, INT))" @@ -172,11 +183,7 @@ ("xkos:" "<http://rdf-vocabulary.ddialliance.org/xkos#>") ("pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>"))) (inputs - (list - gnc:phenotype->gn:phenotype - gn:phenotype->metadata - gnc:set->gn:trait - gn:trait->gn:phenotype)) + (list gn:set->gn:dataset gn:dataset->gn:trait gnc:phenotype->gn:phenotype gn:phenotype->metadata gn:trait->gn:phenotype)) (outputs `(#:documentation ,documentation #:rdf ,output)))) |
