import RDF
from htsworkflow.util.rdfhelp import libraryOntology as libNS
from htsworkflow.util.rdfhelp import toTypedNode, fromTypedNode, rdfNS, \
- stripNamespace, dump_model, simplify_uri
+ strip_namespace, dump_model, simplify_uri
LOGGER = logging.getLogger(__name__)
raise KeyError(u"%s not found" % (unicode(seq_id),))
seq_type_node = model.get_target(seq_id, libNS['file_type'])
- seq_type = stripNamespace(libNS, seq_type_node)
+ seq_type = strip_namespace(libNS, seq_type_node)
path = urlparse(str(seq_id.uri)).path
flowcellNode = get_one(seq_id, libNS['flowcell'])
library = guess_library_from_model(model, base_url,
flowcell,
lane_id)
+ if library is None:
+ LOGGER.error("Unable to decypher: %s %s",
+ str(flowcell), str(lane_id))
+ continue
library_id = toTypedNode(simplify_uri(library))
LOGGER.debug("Adding file (%s) to library (%s) link",
str(filenode),
where {{
<{flowcell}> libns:has_lane ?lane ;
a libns:IlluminaFlowcell .
- ?lane libns:lane_number "{lane_id}" ;
+ ?lane libns:lane_number ?lane_id ;
libns:library ?library .
+ FILTER(str(?lane_id) = "{lane_id}")
}}
"""
lane_body = lane_body.format(flowcell=flowcell, lane_id=lane_id)
+ LOGGER.debug("guess_library_from_model: %s", lane_body)
lanes = []
tries = 3
while len(lanes) == 0 and tries > 0:
else:
# try grabbing data
model.load(flowcellNode.uri, name="rdfa")
-
-