def bowtie(self):
        """
        Create threads and commands for performing reference mapping for qualimap analyses
        """
        for i in range(self.cpus):
            # Send the threads to the merge method. :args is empty as I'm using
            threads = Thread(target=self.align, args=())
            # Set the daemon to true - something to do with thread management
            threads.setDaemon(True)
            # Start the threading
            threads.start()
        with progressbar(self.metadata) as bar:
            for sample in bar:
                # Initialise the mapping GenObject
                sample.mapping = GenObject()
                # Set an easier to write shortcut for sample.general
                sagen = sample.general
                if sagen.bestassemblyfile != "NA":
                    sagen.QualimapResults = os.path.join(sagen.outputdirectory, 'qualimap_results')
                    # Set the results folder
                    # Create this results folder if necessary
                    make_path(sagen.QualimapResults)
                    # Set file names
                    sagen.sortedbam = os.path.join(sagen.QualimapResults, '{}_sorted.bam'.format(sample.name))
                    filenoext = os.path.splitext(sagen.filteredfile)[0]
                    sagen.filenoext = filenoext
                    sagen.bowtie2results = os.path.join(sagen.QualimapResults, sample.name)
                    # Use fancy new bowtie2 wrapper
                    bowtie2build = Bowtie2BuildCommandLine(reference=sagen.bestassemblyfile,
                                                           bt2=sagen.bowtie2results)
                    sample.mapping.BamFile = sagen.bowtie2results + "_sorted.bam"
                    # SAMtools sort v1.3 has different run parameters
                    samsort = SamtoolsSortCommandline(input=sample.mapping.BamFile,
                                                      o=True,
                                                      out_prefix="-")
                    samtools = [SamtoolsViewCommandline(b=True, S=True, input_file="-"), samsort]
                    indict = {'D': 5, 'R': 1, 'num_mismatches': 0, 'seed_length': 22, 'i_func': "S,0,2.50"}
                    #  Update the dictionary with the appropriate parameters for paired- vs. single-ended assemblies
                    try:
                        _ = sample.general.mergedreads
                        if len(sample.general.trimmedcorrectedfastqfiles) == 2:
                            indict.update({'m1': sample.general.trimmedcorrectedfastqfiles[0],
                                           'm2': sample.general.trimmedcorrectedfastqfiles[1]})
                        else:
                            indict.update({'U': sample.general.trimmedcorrectedfastqfiles[0]})
                    except AttributeError:
                        if len(sample.general.assemblyfastq) == 2:
                            indict.update({'m1': sample.general.assemblyfastq[0],
                                           'm2': sample.general.assemblyfastq[1]})
                        else:
                            indict.update({'U': sample.general.assemblyfastq[0]})
                    bowtie2align = Bowtie2CommandLine(bt2=sagen.bowtie2results,
                                                      threads=self.threads,
                                                      samtools=samtools,
                                                      **indict)

                    # Convert the commands to strings to allow them to be JSON serialized
                    sample.commands.bowtie2align = str(bowtie2align)
                    sample.commands.bowtie2build = str(bowtie2build)
                    self.bowqueue.put((sample, sample.commands.bowtie2build, sample.commands.bowtie2align))
                else:
                    sample.commands.samtools = "NA"
                    sample.mapping.MeanInsertSize = 'NA'
                    sample.mapping.MeanCoveragedata = 'NA'
        self.bowqueue.join()