def filterunique(self):
        for sample in self.metadata:
            sample[self.analysistype].blastresults = list()
            resultdict = dict()
            rowdict = dict()
            try:
                for contig in sample[self.analysistype].queryranges:
                    for location in sample[self.analysistype].queryranges[contig]:
                        for row in sample[self.analysistype].results[contig]:
                            contig = row['query_id']
                            high = row['high']
                            low = row['low']
                            percentidentity = row['percentidentity']
                            locstr = ','.join([str(x) for x in location])
                            loc = set(range(low, high))
                            if loc.intersection(set(range(location[0], location[1]))):
                                try:
                                    resultdict[contig][locstr].append(percentidentity)
                                    rowdict[contig][locstr].append(row)
                                except KeyError:
                                    try:
                                        resultdict[contig][locstr] = list()
                                        resultdict[contig][locstr].append(percentidentity)
                                        rowdict[contig][locstr] = list()
                                        rowdict[contig][locstr].append(row)
                                    except KeyError:
                                        resultdict[contig] = dict()
                                        resultdict[contig][locstr] = list()
                                        resultdict[contig][locstr].append(percentidentity)
                                        rowdict[contig] = dict()
                                        rowdict[contig][locstr] = list()
                                        rowdict[contig][locstr].append(row)
            except KeyError:
                pass
            for contig in resultdict:
                genes = list()
                for location in resultdict[contig]:
                    multiple = False
                    for row in rowdict[contig][location]:
                        if row['percentidentity'] == max(resultdict[contig][location]) and not multiple \
                                and row['subject_id'] not in genes:
                            sample[self.analysistype].blastresults.append(row)
                            genes.append(row['subject_id'])
                            multiple = True