<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_trees(self, input_dir):
 """ Read a directory full of tree files, matching them up to the already loaded alignments """


        if self.show_progress:
            pbar = setup_progressbar("Loading trees", len(self.records))
            pbar.start()

        for i, rec in enumerate(self.records):
            hook = os.path.join(input_dir, '{}.nwk*'.format(rec.name))
            filename = glob.glob(hook)
            try:
                with fileIO.freader(filename[0]) as infile:
                    tree = infile.read().decode('utf-8')

                d = dict(ml_tree=tree)

                rec.parameters.construct_from_dict(d)

            except (IOError, IndexError):
                continue

            finally:
                if self.show_progress:
                    pbar.update(i)

        if self.show_progress:
            pbar.finish()