Initial port to python3
[htsworkflow.git] / htsworkflow / submission / fastqname.py
index f749d4096246529b264d495d883cad6cb7c005fb..21341d6f16e71d451d32acc948b8aa262df5d7c9 100644 (file)
@@ -10,7 +10,13 @@ FASTQ_RE = re.compile(
     'c(?P<cycle>[\d]+)_l(?P<lane>[\d]+)(_r(?P<read>[\d]))?\.fastq')
 
 class FastqName(collections.Mapping):
+    """Utility class to convert to the standardized submission fastq name.
+    """
     def __init__(self, is_paired=None, **kwargs):
+        """Create a fastq name handler.
+
+        Takes filename or common attributes like flowcell, lib_id, lane, read, cycle
+        """
         self._attributes = ('flowcell', 'lib_id', 'lane', 'read', 'cycle')
         self._is_paired = is_paired
 
@@ -28,7 +34,6 @@ class FastqName(collections.Mapping):
                 value = kwargs[k]
             self[k] = value
 
-
     def _init_by_filename(self, filename):
         match = FASTQ_RE.match(filename)
         if match is None:
@@ -50,7 +55,7 @@ class FastqName(collections.Mapping):
         if self.is_paired and self['read'] is None:
             return False
 
-        for k in self.keys():
+        for k in list(self.keys()):
             if k == 'read':
                 continue
             if self[k] is None: