docs: def read_alignments(self, input_dir, file_format, header_grep=None):
          """ Get list of alignment files from an input directory *.fa, *.fas and
          *.phy files only
  
          Stores in self.files """
  
          compression = ['', 'gz', 'bz2']
  
          if file_format == 'fasta':
              extensions = ['fa', 'fas', 'fasta']
  
          elif file_format == 'phylip':
              extensions = ['phy']
  
          else:
              extensions = []
  
          extensions = list('.'.join([x,y]) if y else x for x,y in itertools.product(extensions, compression))
  
          files = fileIO.glob_by_extensions(input_dir, extensions)
          files.sort(key=SORT_KEY)
          self._input_files = files
          records = []
  
          if self.show_progress:
              pbar = setup_progressbar("Loading files", len(files), simple_progress=True)
              pbar.start()
  
          for i, f in enumerate(files):
              if f.endswith('.gz') or f.endswith('.bz2'):
                  fd, tmpfile = tempfile.mkstemp()
                  with fileIO.freader(f, f.endswith('.gz'), f.endswith('.bz2')) as reader,\
                       fileIO.fwriter(tmpfile) as writer:
                      for line in reader:
                          if ISPY3:
                              line = line.decode()
                          writer.write(line)
                  try:
                      record = Alignment(tmpfile, file_format, True)
                  except ValueError:
                      record = Alignment(tmpfile, file_format, False)
                  finally:
                      os.close(fd)
                      os.unlink(tmpfile)
  
              else:
                  try:
                      record = Alignment(f, file_format, True)
                  except RuntimeError:
                      record = Alignment(f, file_format, False)
  
              if header_grep:
                  try:
                      datatype = 'dna' if record.is_dna() else 'protein'
  
                      record = Alignment([(header_grep(x), y) for (x, y) in record.get_sequences()], datatype)
  
                  except TypeError:
                      raise TypeError("Couldn't apply header_grep to header\n"
                                      "alignment number={}, name={}\n"
                                      "header_grep={}".format(i, fileIO.strip_extensions(f), header_grep))
                  except RuntimeError:
                      print('RuntimeError occurred processing alignment number={}, name={}'
                            .format(i, fileIO.strip_extensions(f)))
                      raise
  
              record.name = (fileIO.strip_extensions(f))
              records.append(record)
              if self.show_progress:
                  pbar.update(i)
          if self.show_progress:
              pbar.finish()
          return records