From: Diane Trout Date: Tue, 20 Nov 2012 20:46:41 +0000 (-0800) Subject: Fix RDF schema problems with lane_number and species. X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=8bbe0264745aeab86f0749127c9a9d69bb72f4f2 Fix RDF schema problems with lane_number and species. My RDF schema was using the term "species" both for the species name and a species class -- which doesn't make sense. This version of the schema introduces a species_name which can attach either to the Library object or the Species object. Its still a little inconsistent as I'm using it for both "common name" and "scientific name". But hey its an improvement. Also there's a tweak to the library_number type on the library detail page setting the type to string instead of number, as I decided it should be treated internally as an opaque identifier. In theory someone might start naming lanes A,B,C,D or 1T, 1B (for the top and bottom of a flowcell slide). Finally I decided that the gel_cut should be of type integer, yes decimal is the "more general type" but I'm using integer in my sql schema so its only going to return integers. --- diff --git a/encode_submission/find-lib-by-cell.sparql b/encode_submission/find-lib-by-cell.sparql index 70bd145..7e34335 100644 --- a/encode_submission/find-lib-by-cell.sparql +++ b/encode_submission/find-lib-by-cell.sparql @@ -11,7 +11,7 @@ WHERE { libraryOntology:date ?submission_date. ?liburn libraryOntology:cell_line ?cell ; libraryOntology:replicate ?replicate ; - libraryOntology:species ?species . + libraryOntology:species_name ?species . OPTIONAL { ?liburn libraryOntology:treatement ?treatment . } FILTER(regex(?species, "Homo sapiens", "i")) #filter(?submission_date > "2011-04-01T00:00:00Z"^^xsd:dateTime) diff --git a/htsworkflow/frontend/samples/tests.py b/htsworkflow/frontend/samples/tests.py index 111e29e..4e0c2a3 100644 --- a/htsworkflow/frontend/samples/tests.py +++ b/htsworkflow/frontend/samples/tests.py @@ -208,14 +208,14 @@ class SampleWebTestCase(TestCase): body = """prefix rdf: prefix libns: - select ?library ?library_id ?name ?species + select ?library ?library_id ?name ?species_name where { ?library a libns:Library . OPTIONAL { ?library libns:library_id ?library_id . } - OPTIONAL { ?library libns:species ?species . } + OPTIONAL { ?library libns:species_name ?species_name . } OPTIONAL { ?library libns:name ?name . } }""" - bindings = set(['library', 'library_id', 'name', 'species']) + bindings = set(['library', 'library_id', 'name', 'species_name']) query = RDF.SPARQLQuery(body) count = 0 for r in query.execute(model): @@ -297,7 +297,7 @@ class TestRDFaLibrary(TestCase): self.check_literal_object(model, ['400'], p=libNS['gel_cut']) self.check_literal_object(model, ['Igor'], p=libNS['made_by']) self.check_literal_object(model, ['Paired End Multiplexed Sp-BAC'], p=libNS['name']) - self.check_literal_object(model, ['Drosophila melanogaster'], p=libNS['species']) + self.check_literal_object(model, ['Drosophila melanogaster'], p=libNS['species_name']) self.check_uri_object(model, [u'http://localhost/lane/1193'], diff --git a/htsworkflow/frontend/templates/sample_header.html b/htsworkflow/frontend/templates/sample_header.html index 8dc14ee..ed24bbd 100644 --- a/htsworkflow/frontend/templates/sample_header.html +++ b/htsworkflow/frontend/templates/sample_header.html @@ -22,7 +22,7 @@

Sample Details

Species: - {{ lib.library_species.scientific_name }} + {{ lib.library_species.scientific_name }}
Experiment Type: {{ lib.experiment_type }} diff --git a/htsworkflow/frontend/templates/samples/library_detail.html b/htsworkflow/frontend/templates/samples/library_detail.html index 9cc76f5..1db49df 100644 --- a/htsworkflow/frontend/templates/samples/library_detail.html +++ b/htsworkflow/frontend/templates/samples/library_detail.html @@ -133,7 +133,9 @@ {% if lib.lane_set.all %} {% for lane in lib.lane_set.all %} - + - {{ lane.lane_number }} {{ lane.comment }} diff --git a/htsworkflow/frontend/templates/samples/species_detail.html b/htsworkflow/frontend/templates/samples/species_detail.html index 5e47679..84f17ef 100644 --- a/htsworkflow/frontend/templates/samples/species_detail.html +++ b/htsworkflow/frontend/templates/samples/species_detail.html @@ -13,8 +13,8 @@

About this Genome

Common Name: - {{ species.common_name}}
+ {{ species.common_name}}
Scientific Name: - {{ species.scientific_name}}
+ {{ species.scientific_name}}
{% endblock %} diff --git a/htsworkflow/submission/test/test_condorfastq.py b/htsworkflow/submission/test/test_condorfastq.py index dd41c61..cffb5ac 100644 --- a/htsworkflow/submission/test/test_condorfastq.py +++ b/htsworkflow/submission/test/test_condorfastq.py @@ -384,12 +384,11 @@ lib_turtle = """@prefix : . libns:made_by "Gary Gygax"@en ; libns:name "Paired Ends ASDF"@en ; libns:replicate "1"@en; - libns:species "Mus musculus"@en ; + libns:species_name "Mus musculus"@en ; libns:stopping_point "Completed"@en ; libns:total_unique_locations 8841201 . # cell_line - a libns:Library ; libns:affiliation "TSR"@en; @@ -405,7 +404,7 @@ lib_turtle = """@prefix : . libns:made_by "Gary Gygax"@en ; libns:name "Paired Ends THING"@en ; libns:replicate "1"@en; - libns:species "Mus musculus"@en ; + libns:species_name "Mus musculus"@en ; libns:stopping_point "Completed"@en ; libns:total_unique_locations 8841201 . # cell_line diff --git a/htsworkflow/util/schemas/htsworkflow.turtle b/htsworkflow/util/schemas/htsworkflow.turtle index 12c1f55..8fe0362 100644 --- a/htsworkflow/util/schemas/htsworkflow.turtle +++ b/htsworkflow/util/schemas/htsworkflow.turtle @@ -274,7 +274,7 @@ htswlib:gel_cut rdfs:comment "The estimated fragment sizes cut from gel"; rdfs:label "Gel Cut" ; rdfs:domain htswlib:Library ; - rdfs:range xsd:decimal . + rdfs:range xsd:integer . htswlib:made_by a rdf:Property ; @@ -313,12 +313,19 @@ htswlib:affiliation htswlib:species a rdf:Property ; - rdfs:comment "Scientific name of sample species" ; + rdfs:comment "A species class" ; rdfs:label "Species" ; rdfs:domain htswlib:Library ; #rdfs:domain htswlib:IlluminaLane; rdfs:range htswlib:Species . +htswlib:species_name + a rdf:Property ; + rdfs:comment "Scientific name of sample species" ; + rdfs:label "Species name"; + rdfs:domain htswlib:Species, htswlib:Library ; + rdfs:range xsd:string . + htswlib:replicate a rdf:Property ; rdfs:comment "Which replicate this was" ; diff --git a/htsworkflow/util/schemas/xhtmlvocab.turtle b/htsworkflow/util/schemas/xhtmlvocab.turtle index 48442b3..b05add1 100644 --- a/htsworkflow/util/schemas/xhtmlvocab.turtle +++ b/htsworkflow/util/schemas/xhtmlvocab.turtle @@ -17,5 +17,7 @@ serving as a stylesheet for a resource. """^^xsd:string ; rdfs:member ; # rdfa:term "stylesheet" ; -# rdfa:uri "http://www.w3.org/1999/xhtml/vocab#stylesheet" +# rdfa:uri "http://www.w3.org/1999/xhtml/vocab#stylesheet" ; + rdfs:domain rdfs:Resource ; + rdfs:range rdfs:Resource .