"""
Utilities to work with the various eras of sequence archive files
"""
+import collections
import logging
import os
+import types
import re
LOGGER = logging.getLogger(__name__)
""" %( {'table': SEQUENCE_TABLE_NAME} )
return cursor.execute(sql)
+FlowcellPath = collections.namedtuple('FlowcellPath',
+ 'flowcell start stop project')
+
class SequenceFile(object):
"""
Simple container class that holds the path to a sequence archive
"""
Extract flowcell, cycle from pathname
"""
+ path = os.path.normpath(path)
project = None
rest, tail = os.path.split(path)
if tail.startswith('Project_'):
if stop is not None:
stop = int(stop)
- return flowcell, start, stop, project
+ return FlowcellPath(flowcell, start, stop, project)
def parse_srf(path, filename):
flowcell_dir, start, stop, project = get_flowcell_cycle(path)
Scan through a list of directories for sequence like files
"""
sequences = []
+ if type(dirs) in types.StringTypes:
+ raise ValueError("You probably want a list or set, not a string")
+
for d in dirs:
LOGGER.info("Scanning %s for sequences" % (d,))
if not os.path.exists(d):