old_contents: def log_progress(sequence, name, every=None, size=None):
      from ipywidgets import IntProgress, HTML, VBox
      from IPython.display import display
      
      is_iterator = False
      if size is None:
          try:
              size = len(sequence)
          except TypeError:
              is_iterator = True
      if size is not None:
          if every is None:
              if size <= 200:
                  every = 1
              else:
                  every = size / 200     # every 0.5%
      else:
          assert every is not None, 'sequence is iterator, set every'
      
      if is_iterator:
          progress = IntProgress(min=0, max=1, value=1)
          progress.bar_style = 'info'
      else:
          progress = IntProgress(min=0, max=size, value=0)
      label = HTML()
      box = VBox(children=[label, progress])
      display(box)
      
      index = 0
      try:
          for index, record in enumerate(sequence, 1):
              if index == 1 or index % every == 0:
                  if is_iterator:
                      label.value = name + ': ' + '{index} reads / ?'.format(index=index)
                  else:
                      progress.value = index
                      label.value = u'{index} / {size}'.format(
                      index=index,
                          size=size
                      )
              yield record
      except:
          progress.bar_style = 'danger'
          raise
      else:
          progress.bar_style = 'success'
          progress.value = index
          label.value = str(name + ': ' + str(index) + ' reads' or '?')
  
  
  
  def count_lines(filepath):
      res = 0
      with open(filepath) as f:
          for line in f:
              res += 1
      return res
  
  
  def count_fastq_records(filepath):
      return int(count_lines(filepath) / 4)
new_contents: def log_progress(sequence, name, every=None, size=None):
      from ipywidgets import IntProgress, HTML, VBox
      from IPython.display import display
      
      is_iterator = False
      if size is None:
          try:
              size = len(sequence)
          except TypeError:
              is_iterator = True
      if size is not None:
          if every is None:
              if size <= 200:
                  every = 1
              else:
                  every = size / 200     # every 0.5%
      else:
          assert every is not None, 'sequence is iterator, set every'
      
      if is_iterator:
          progress = IntProgress(min=0, max=1, value=1)
          progress.bar_style = 'info'
      else:
          progress = IntProgress(min=0, max=size, value=0)
      label = HTML()
      box = VBox(children=[label, progress])
      display(box)
      
      index = 0
      try:
          for index, record in enumerate(sequence, 1):
              if index == 1 or index % every == 0:
                  if is_iterator:
                      label.value = name + ': ' + '{index} reads / ?'.format(index=index)
                  else:
                      progress.value = index
                      label.value = u'{name}: {index} / {size}'.format(name=name, index=index, size=size)
              yield record
      except:
          progress.bar_style = 'danger'
          raise
      else:
          progress.bar_style = 'success'
          progress.value = index
          label.value = str(name + ': ' + str(index) + ' reads' or '?')
  
  
  
  def count_lines(filepath):
      res = 0
      with open(filepath) as f:
          for line in f:
              res += 1
      return res
  
  
  def count_fastq_records(filepath):
      return int(count_lines(filepath) / 4)
subject: add filenames in progress bars