def add_homology(self, seq, search, id=None, idFormat='%s_%d',
                     autoIncrement=False, maxAnnot=999999,
                     maxLoss=None, sliceInfo=None, **kwargs):
        'find homology in our seq db and add as annotations'
        try: # ENSURE THAT sliceAttrDict COMPATIBLE WITH OUR TUPLE FORMAT
            if self.sliceAttrDict['id'] != 0:
                raise KeyError
        except KeyError:
            sliceAttrDict['id'] = 0 # USE TUPLE AS OUR INTERNAL STANDARD FORMAT
            sliceAttrDict['start'] = 1
            sliceAttrDict['stop'] = 2
        if autoIncrement:
            id = len(self.sliceDB)
        elif id is None:
            id = seq.id
        if isinstance(search, str): # GET SEARCH METHOD
            search = getattr(self.seqDB, search)
        if isinstance(seq, str): # CREATE A SEQ OBJECT
            seq = Sequence(seq, str(id))
        al = search(seq, **kwargs) # RUN THE HOMOLOGY SEARCH
        if maxLoss is not None: # REQUIRE HIT BE AT LEAST A CERTAIN LENGTH
            kwargs['minAlignSize'] = len(seq)-maxLoss
        hits = al[seq].keys(**kwargs) # OBTAIN LIST OF HIT INTERVALS
        if len(hits) > maxAnnot:
            raise ValueError((id, len(hits)) % 'too many hits for %s: %d')
        out = []
        i = 0
        k = id
        for ival in hits: # CREATE ANNOTATION FOR EACH HIT
            if len(hits)>1: # NEED TO CREATE AN ID FOR EACH HIT
                if autoIncrement:
                    k = len(self.sliceDB)
                else:
                    k = idFormat % (id, i)
                i += 1
            if sliceInfo is not None: # SAVE SLICE AS TUPLE WITH INFO
                a = self.new_annotation(k, (ival.id, ival.start, ival.stop)
                                        + sliceInfo)
            else:
                a = self.new_annotation(k, (ival.id, ival.start, ival.stop))
            out.append(a) # RETURN THE ANNOTATION
        return out
dataset/ETHPy150Open cjlee112/pygr/pygr/annotation.py/AnnotationDB.add_homology/swapped operands of `%`