def doublebait(self):
        """
        In order to ensure that there is enough sequence data to bridge the gap between the two primers, the paired
        .fastq files produced above will be used to bait the original input .fastq files
        """
        with progressbar(self.metadata) as bar:
            for sample in bar:
                if sample.general.bestassemblyfile != 'NA':
                    if sample[self.analysistype].filetype == 'fastq':
                        sample[self.analysistype].doublebaitedfastq = os.path.join(
                            sample[self.analysistype].outputdir,
                            '{at}_doubletargetMatches.fastq.gz'.format(at=self.analysistype))
                        # Make the system call
                        if len(sample.general.fastqfiles) == 2:
                            # Create the command to run the baiting
                            sample[self.analysistype].bbdukcmd2 = \
                                'bbduk.sh ref={baitfile} in1={forward} in2={reverse} hdist={mismatches} ' \
                                'threads={threads} interleaved=t outm={outfile}' \
                                .format(baitfile=sample[self.analysistype].baitedfastq,
                                        forward=sample.general.trimmedcorrectedfastqfiles[0],
                                        reverse=sample.general.trimmedcorrectedfastqfiles[1],
                                        mismatches=self.mismatches,
                                        threads=str(self.cpus),
                                        outfile=sample[self.analysistype].doublebaitedfastq)
                        else:
                            sample[self.analysistype].bbdukcmd2 = \
                                'bbduk.sh ref={baitfile} in={fastq} hdist={mismatches} threads={threads} ' \
                                'interleaved=t outm={outfile}' \
                                .format(baitfile=sample[self.analysistype].baitedfastq,
                                        fastq=sample.general.trimmedcorrectedfastqfiles[0],
                                        mismatches=self.mismatches,
                                        threads=str(self.cpus),
                                        outfile=sample[self.analysistype].doublebaitedfastq)
                        # Run the system call (if necessary)
                        if not os.path.isfile(sample[self.analysistype].doublebaitedfastq):
                            run_subprocess(sample[self.analysistype].bbdukcmd2)
In order to ensure that there is enough sequence data to bridge the gap between the two primers, the paired
        .fastq files produced above will be used to bait the original input .fastq files