Use tadpole from the bbmap suite of tools to perform error correction of the reads

def error_correction(self):
        """
        Use tadpole from the bbmap suite of tools to perform error correction of the reads
        """
        logging.info('Error correcting reads')
        for sample in self.metadata:
            sample.general.trimmedcorrectedfastqfiles = [fastq.split('.fastq.gz')[0] + '_trimmed_corrected.fastq.gz'
                                                         for fastq in sorted(sample.general.fastqfiles)]
            try:
                if not os.path.isfile(sample.general.trimmedcorrectedfastqfiles[0]):
                    try:
                        out, err, cmd = bbtools.tadpole(forward_in=sorted(sample.general.trimmedfastqfiles)[0],
                                                        forward_out=sample.general.trimmedcorrectedfastqfiles[0],
                                                        returncmd=True,
                                                        mode='correct',
                                                        threads=self.cpus)
                        # Set the command in the object
                        sample[self.analysistype].errorcorrectcmd = cmd
                        write_to_logfile(out=out,
                                         err=err,
                                         logfile=self.logfile,
                                         samplelog=sample.general.logout,
                                         sampleerr=sample.general.logerr,
                                         analysislog=None,
                                         analysiserr=None)
                    except IndexError:
                        sample.general.trimmedcorrectedfastqfiles = list()
            except CalledProcessError:
                sample.general.trimmedcorrectedfastqfiles = sample.general.trimmedfastqfiles
            except AttributeError:
                sample.general.trimmedcorrectedfastqfiles = list()
            except IndexError:
                sample.general.trimmedcorrectedfastqfiles = list()