From 575108fde7574000d8ccb7164703902726e8b0f1 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Fri, 27 Mar 2015 11:07:06 -0700 Subject: [PATCH] Import flowcell details into the triple store from a lane --- htsworkflow/submission/submission.py | 15 +++++++++++++++ htsworkflow/templates/aws_flowcell.sparql | 7 +++++++ 2 files changed, 22 insertions(+) create mode 100644 htsworkflow/templates/aws_flowcell.sparql diff --git a/htsworkflow/submission/submission.py b/htsworkflow/submission/submission.py index 9cd9dc8..ee28e91 100644 --- a/htsworkflow/submission/submission.py +++ b/htsworkflow/submission/submission.py @@ -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 index 0000000..afbfea0 --- /dev/null +++ b/htsworkflow/templates/aws_flowcell.sparql @@ -0,0 +1,7 @@ +PREFIX htswlib: + +select distinct ?flowcell +WHERE { + ?lane htswlib:flowcell ?flowcell ; + a htswlib:IlluminaLane . +} -- 2.30.2