+ def add_fastq_metadata(self, filename, fileNode):
+ # How should I detect if this is actually a fastq file?
+ try:
+ fqname = FastqName(filename=filename)
+ except ValueError:
+ # currently its just ignore it if the fastq name parser fails
+ return
+
+ terms = [('flowcell', libraryOntology['flowcell_id']),
+ ('lib_id', libraryOntology['library_id']),
+ ('lane', libraryOntology['lane_number']),
+ ('read', libraryOntology['read']),
+ ('cycle', libraryOntology['read_length'])]
+ for file_term, model_term in terms:
+ value = fqname.get(file_term)
+ if value is not None:
+ s = RDF.Statement(fileNode, model_term, toTypedNode(value))
+ self.model.append(s)
+
+ def add_label(self, file_type, file_node, lib_node):
+ """Add rdfs:label to a file node
+ """
+ #template_term = libraryOntology['label_template']
+ template_term = libraryOntology['label_template']
+ label_template = self.model.get_target(file_type, template_term)
+ if label_template:
+ template = loader.get_template('submission_view_rdfs_label_metadata.sparql')
+ context = Context({
+ 'library': str(lib_node.uri),
+ })
+ for r in self.execute_query(template, context):
+ context = Context(r)
+ label = Template(label_template).render(context)
+ s = RDF.Statement(file_node, rdfsNS['label'], unicode(label))
+ self.model.append(s)
+