def generate_intervals(self):
        yield CoordsGroupStart() # bracket with grouping markers

        query_ori, query_factor = get_ori_letterunit(self.query_start,\
                  self.query_end, self.query_seq, self.gapchar)
        subject_ori, subject_factor = get_ori_letterunit(self.subject_start,\
                  self.subject_end, self.subject_seq, self.gapchar)
        q_start= -1
        s_start= -1
        i_query=0
        i_subject=0
        for i in range(len(self.query_seq)): # SCAN ALIGNMENT FOR GAPS
            if self.query_seq[i] == self.gapchar or \
               self.subject_seq[i] == self.gapchar:
                if q_start >= 0: # END OF AN UNGAPPED INTERVAL
                    yield self.get_interval_obj(q_start, i_query,
                                                s_start, i_subject,
                                                query_ori, query_factor,
                                                subject_ori, subject_factor)
                q_start= -1
            elif q_start<0: # START OF AN UNGAPPED INTERVAL
                q_start=i_query
                s_start=i_subject
            if self.query_seq[i]!=self.gapchar: # COUNT QUERY LETTERS
                i_query+=1
            if self.subject_seq[i]!=self.gapchar: # COUNT SUBJECT LETTERS
                i_subject+=1
        if q_start>=0: # REPORT THE LAST INTERVAL
            yield self.get_interval_obj(q_start, i_query,
                                        s_start, i_subject,
                                        query_ori, query_factor,
                                        subject_ori, subject_factor)

        yield CoordsGroupEnd()
After DB I/O
dataset/ETHPy150Open cjlee112/pygr/pygr/parse_blast.py/BlastHitParser.generate_intervals--crossover with--dataset/ETHPy150Open sahana/eden/modules/s3db/cap.py/S3CAPModel.cap_info_onaccept