code: def extractSeqAndQuals(seq, quals, umi_bases, cell_bases, discard_bases,
                         retain_umi=False):
      '''Remove selected bases from seq and quals
      '''
  
      new_seq = ""
      new_quals = ""
      umi_quals = ""
      cell_quals = ""
  
      ix = 0
      for base, qual in zip(seq, quals):
          if ((ix not in discard_bases) and
              (ix not in cell_bases)):
  
              # if we are retaining the umi, this base is both seq and umi
              if retain_umi:
                  new_quals += qual
                  new_seq += base
                  umi_quals += qual
  
              else:  # base is either seq or umi
                  if ix not in umi_bases:
                      new_quals += qual
                      new_seq += base
                  else:
                      umi_quals += qual
  
          elif ix in cell_bases:
              cell_quals += qual
  
          ix += 1
  
      return new_seq, new_quals, umi_quals, cell_qualf extractSeqAndQuals(seq, quals, umi_bases, cell_bases, discard_bases,
                         retain_umi=False):
      '''Remove selected bases from seq and quals
      '''
  
      new_seq = ""
      new_quals = ""
      umi_quals = ""
      cell_quals = ""
  
      ix = 0
      for base, qual in zip(seq, quals):
          if ((ix not in discard_bases) and
              (ix not in cell_bases)):
  
              # if we are retaining the umi, this base is both seq and umi
              if retain_umi:
                  new_quals += qual
                  new_seq += base
                  umi_quals += qual
  
              else:  # base is either seq or umi
                  if ix not in umi_bases:
                      new_quals += qual
                      new_seq += base
                  else:
                      umi_quals += qual
  
          elif ix in cell_bases:
              cell_quals += qual
  
          ix += 1
  
      return new_seq, new_quals, umi_quals, cell_quals
docs: Remove selected bases from seq and quals