From 67d7838a76d445a651cddf715dc15a5aab8e3034 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Sep 2012 11:32:55 -0700 Subject: [PATCH] Tweaks to make the sample gather query faster. 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 | 2 +- htsworkflow/templates/geo_samples.sparql | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htsworkflow/submission/daf.py b/htsworkflow/submission/daf.py index a74d71a..09b285b 100644 --- a/htsworkflow/submission/daf.py +++ b/htsworkflow/submission/daf.py @@ -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))) diff --git a/htsworkflow/templates/geo_samples.sparql b/htsworkflow/templates/geo_samples.sparql index 850d99a..b4d4b0b 100644 --- a/htsworkflow/templates/geo_samples.sparql +++ b/htsworkflow/templates/geo_samples.sparql @@ -7,18 +7,22 @@ PREFIX cells: 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 . -- 2.30.2