Import flowcell details into the triple store from a lane
authorDiane Trout <diane@caltech.edu>
Fri, 27 Mar 2015 18:07:06 +0000 (11:07 -0700)
committerDiane Trout <diane@caltech.edu>
Fri, 27 Mar 2015 18:13:12 +0000 (11:13 -0700)
htsworkflow/submission/submission.py
htsworkflow/templates/aws_flowcell.sparql [new file with mode: 0644]

index 9cd9dc8d38e0ad08a027d17c64113c65072f42b5..ee28e91440f4d0056257b73c0140d2dd5ccfb290 100644 (file)
@@ -245,6 +245,7 @@ class Submission(object):
             self.model.append(s)
 
         self._add_lane_details(libNode)
+        self._add_flowcell_details()
 
     def _add_lane_details(self, libNode):
         """Import lane details
@@ -264,6 +265,20 @@ class Submission(object):
                 raise e
 
 
+    def _add_flowcell_details(self):
+        template = loader.get_template('aws_flowcell.sparql')
+        results = self.execute_query(template, Context())
+
+        parser = RDF.Parser(name='rdfa')
+        for r in self.execute_query(template, Context()):
+            flowcell = r['flowcell']
+            try:
+                parser.parse_into_model(self.model, flowcell.uri)
+            except RDF.RedlandError as e:
+                LOGGER.error("Error accessing %s" % (str(flowcell)))
+                raise e
+
+
     def find_best_match(self, filename):
         """Search through potential filename matching patterns
         """
diff --git a/htsworkflow/templates/aws_flowcell.sparql b/htsworkflow/templates/aws_flowcell.sparql
new file mode 100644 (file)
index 0000000..afbfea0
--- /dev/null
@@ -0,0 +1,7 @@
+PREFIX htswlib: <http://jumpgate.caltech.edu/wiki/LibraryOntology#>
+
+select distinct ?flowcell
+WHERE {
+  ?lane htswlib:flowcell ?flowcell ;
+        a htswlib:IlluminaLane .
+}