Tweaks to make the sample gather query faster.
authorDiane Trout <diane@caltech.edu>
Wed, 12 Sep 2012 18:32:55 +0000 (11:32 -0700)
committerDiane Trout <diane@caltech.edu>
Wed, 12 Sep 2012 18:32:55 +0000 (11:32 -0700)
Instead of creating a new library term for submissions, I
changed it back to using the stanrard library ontology term.
(making it easier to link things together).

Also apparently you can have nested optional statements.

htsworkflow/submission/daf.py
htsworkflow/templates/geo_samples.sparql

index a74d71a667d1cb788cbdaab24cdf8661738c9413..09b285b095ee2a15cfabee5bc5de3d866522c4f9 100644 (file)
@@ -361,7 +361,7 @@ class UCSCSubmission(object):
                           rdfNS['type'],
                           submissionOntology['submission']))
         self.model.add_statement(RDF.Statement(submissionNode,
-                                               submissionOntology['library'],
+                                               libraryOntology['library'],
                                                libNode))
 
         LOGGER.debug("Adding statements to {0}".format(str(submissionView)))
index 850d99a944ee51009675a381aa5c8a023d521a9d..b4d4b0bc8102db05b84f16472b4508a82db48afa 100644 (file)
@@ -7,18 +7,22 @@ PREFIX cells: <http://encodewiki.ucsc.edu/EncodeDCC/index.php/Cell_lines#>
 
 select distinct ?name ?cell ?antibody ?sex ?control ?strain ?controlId ?library_id ?treatment ?protocol ?readType ?insertLength ?replicate, ?mapAlgorithm ?species_name ?taxon_id ?extractMolecule ?growthProtocol ?extractProtocol ?dataProtocol ?experiment_type ?library_selection ?library_source
 WHERE {
-  <{{submission}}> a submissionOntology:submission .
+  <{{submission}}> a submissionOntology:submission ;
+                   submissionOntology:library ?library ;
+                   submissionOntology:name ?name .
 
   OPTIONAL { <{{submission}}> ucscDaf:control ?control }
   OPTIONAL { <{{submission}}> ucscDaf:controlId ?controlId }
   OPTIONAL { ?library libraryOntology:antibody ?antibody }
   OPTIONAL { ?library libraryOntology:cell_line ?cell .
-             ?cell_line cells:cell ?cell ;
-                        cells:documents ?growthProtocol . }
+             OPTIONAL { ?cell_line cells:cell ?cell ;
+                                   cells:documents ?growthProtocol . }}
   OPTIONAL { ?library ucscDaf:sex ?sex }
   OPTIONAL { ?library libraryOntology:library_id ?library_id }
   OPTIONAL { ?library libraryOntology:replicate ?replicate }
-  OPTIONAL { ?library libraryOntology:species ?species_name }
+  OPTIONAL { ?library libraryOntology:species ?species_name .
+             ?species libraryOntology:species ?species_name ;
+                      libraryOntology:taxon_id ?taxon_id . }
   OPTIONAL { ?library libraryOntology:condition_term ?treatment }
   OPTIONAL { ?library libraryOntology:experiment_type ?experiment_type }
   OPTIONAL { ?library libraryOntology:librarySelection ?library_selection }
@@ -32,8 +36,6 @@ WHERE {
   OPTIONAL { ?library libraryOntology:insert_size ?insertLength }
   OPTIONAL { ?library ucscDaf:mapAlgorithm ?mapAlgorithm }
 
-  <{{submission}}> submissionOntology:library ?library ;
-                   submissionOntology:name ?name .
   ?species libraryOntology:species ?species_name ;
            libraryOntology:taxon_id ?taxon_id .