Fix RDF schema problems with lane_number and species.
authorDiane Trout <diane@caltech.edu>
Tue, 20 Nov 2012 20:46:41 +0000 (12:46 -0800)
committerDiane Trout <diane@caltech.edu>
Tue, 20 Nov 2012 20:46:41 +0000 (12:46 -0800)
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.

encode_submission/find-lib-by-cell.sparql
htsworkflow/frontend/samples/tests.py
htsworkflow/frontend/templates/sample_header.html
htsworkflow/frontend/templates/samples/library_detail.html
htsworkflow/frontend/templates/samples/species_detail.html
htsworkflow/submission/test/test_condorfastq.py
htsworkflow/util/schemas/htsworkflow.turtle
htsworkflow/util/schemas/xhtmlvocab.turtle

index 70bd1457e388274021cde64f8d8b0eae232482c5..7e34335fd26b8f5f15280377b4eafd735474bf18 100644 (file)
@@ -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)
index 111e29e8f43f5a9edb80a880e9d354b380d30bdd..4e0c2a3cb87736033c117c650167a6254d5558be 100644 (file)
@@ -208,14 +208,14 @@ class SampleWebTestCase(TestCase):
         body =  """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
         prefix libns: <http://jumpgate.caltech.edu/wiki/LibraryOntology#>
 
-        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'],
index 8dc14ee37d559ae13ba8cb6831f6b7a158567d43..ed24bbde1e21b3e8d2c4267fdcd2c20920dd4b98 100644 (file)
@@ -22,7 +22,7 @@
   <div class="library_sample_detail">
     <h2>Sample Details</h2>
     <b>Species</b>:
-      <span property="libns:species" content="{{lib.library_species.scientific_name}}"><a href="{{lib.library_species.get_absolute_url}}">{{ lib.library_species.scientific_name }}</a></span>
+      <span property="libns:species_name" content="{{lib.library_species.scientific_name}}"><a href="{{lib.library_species.get_absolute_url}}">{{ lib.library_species.scientific_name }}</a></span>
     <br/>
     <b>Experiment Type</b>:
        <span property="libns:experiment_type">{{ lib.experiment_type }}</span>
index 9cc76f5b25279fe9f044d4c29fea0dfedd740a45..1db49dffbb92dd225c345d855d1af074118dfb66 100644 (file)
     {% if lib.lane_set.all %}
     <tbody>
       {% for lane in lib.lane_set.all %}
-      <tr rel="libns:has_lane" resource="{{lane.get_absolute_url}}">
+      <tr rel="libns:has_lane" 
+          about="{{lib.get_absolute_url}}"
+          resource="{{lane.get_absolute_url}}">
         <td>
           <a typeof="libns:IlluminaFlowcell" href="{{lane.flowcell.get_absolute_url}}">
             <span property="libns:flowcell_id"
         <td typeof="libns:IlluminaLane" about="{{lane.get_absolute_url}}">
           <span rel="libns:flowcell" resource="{{lane.flowcell.get_absolute_url}}"></span>
           <a href="{{lane.get_absolute_url}}">
-            <span property="libns:lane_number"  datatype="xsd:decimal"
+            <span property="libns:lane_number"
                >{{ lane.lane_number }}</span>
             </a></td>
         <td>{{ lane.comment }}</td>
index 5e47679a94a83d9f6f2e8f0932a8902464364a16..84f17ef9797f7bbf061ea2d0c89caf0f11820c88 100644 (file)
@@ -13,8 +13,8 @@
 <div id="genome_detail">
   <h2>About this Genome</h2>
   <b>Common Name</b>: 
-     <span property="libns:species">{{ species.common_name}}</span><br/>
+     <span property="libns:species_name">{{ species.common_name}}</span><br/>
   <b>Scientific Name</b>: 
-     <span property="libns:species">{{ species.scientific_name}}</span><br/>
+     <span property="libns:species_name">{{ species.scientific_name}}</span><br/>
 </div>  
 {% endblock %}
index dd41c61aab348d3877ebd2f3fb81dbc9c957ad35..cffb5ac17175f59a3a4fc10219c5e151f578882b 100644 (file)
@@ -384,12 +384,11 @@ lib_turtle = """@prefix : <http://www.w3.org/1999/xhtml> .
         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
 
-
 <http://localhost/library/12345/>
         a libns:Library ;
         libns:affiliation "TSR"@en;
@@ -405,7 +404,7 @@ lib_turtle = """@prefix : <http://www.w3.org/1999/xhtml> .
         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
index 12c1f55cfdc98b321f9780dfd37f514375ac6ad2..8fe0362d32a33b721d72c112fc7093f80ad34067 100644 (file)
@@ -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" ;
index 48442b32c357d739b4fa250cfe428cc3487a3845..b05add1cc8684a84330cdb59cbdff9899d9f9522 100644 (file)
@@ -17,5 +17,7 @@
       serving as a stylesheet for a resource. """^^xsd:string ;
     rdfs:member <http://www.w3.org/1999/xhtml/vocab#relrev-properties> ;
 #    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 
     .