Run BLAST, and record results to the object

def epcrparse(self):
        """
        Run BLAST, and record results to the object
        """
        from Bio.Blast.Applications import NcbiblastnCommandline
        while True:
            sample, record, line = self.epcrparsequeue.get()
            # Split the data on tabs
            gene, chromosome, strand, start, end, m_match, gaps, act_len_exp_len = line.split('\t')
            # Extract the gene sequence from the contigs
            # The record dictionary has the contig name, and the sequence. Splice out the data using the start and
            # end coordinates specified by ePCR
            genesequence = record[chromosome][int(start) - 1:int(end)]
            # Set up BLASTn using blastn-short, as the probe sequences tend to be very short
            blastn = NcbiblastnCommandline(db=sample[self.analysistype].probes.split('.')[0],
                                           num_threads=12,
                                           task='blastn-short',
                                           num_alignments=1,
                                           outfmt="'6 qseqid sseqid positive mismatch gaps "
                                                  "evalue bitscore slen length'")
            # Run the BLASTn, with the gene sequence as stdin
            out, err = blastn(stdin=genesequence)
            # Split the output string on tabs
            results = out.rstrip().split('\t')
            # Populate the raw blast results
            sample[self.analysistype].rawblastresults[gene] = results
            # Create named variables from the list
            positives = float(results[2])
            mismatches = float(results[3])
            gaps = float(results[4])
            subjectlength = float(results[7])
            # Calculate the percent identity
            percentidentity = float('{:0.2f}'.format((positives - gaps) / subjectlength * 100))
            # Create a dictionary with the desired values to store in the metadata object
            resultdict = {
                'matches': positives,
                'mismatches': mismatches,
                'gaps': gaps,
                'subject_length': subjectlength,
                'percent_identity': percentidentity,
                'match_length': results[8].split('\n')[0]
            }
            # Populate the metadata object with the dictionary
            sample[self.analysistype].blastresults[gene] = resultdict
            self.epcrparsequeue.task_done()