def pp2intervals (self, p1, p2):
        (startposs,endposs,vs) = self.pp2cages(p1,p2)
        p1_in_cages = bisect_left(startposs,p1)
        p2_in_cages = bisect_right(endposs,p2)
        output_startpos_list = startposs[p1_in_cages:p2_in_cages]
        output_endpos_list = endposs[p1_in_cages:p2_in_cages]

        # check if the bin (p1_in_cages-1) covers p1
        if p1 < endposs[p1_in_cages-1]:
            # add this interval
            output_startpos_list = array(BYTE4,[p1,])+output_startpos_list
            output_endpos_list = array(BYTE4,[endposs[p1_in_cages-1],])+output_endpos_list

        # check if the bin (p2_in_cages+1) covers p2
        if p2 > startposs[p2_in_cages+1]:
            # add this interval
            output_startpos_list = array(BYTE4,[startposs[p2_in_cages+1],])+output_startpos_list
            output_endpos_list = array(BYTE4,[p2,])+output_endpos_list

        return zip(output_startpos_list,output_endpos_list)
Given an interval, return the intervals list between two given positions.
dataset/ETHPy150Open taoliu/MACS/MACS2/IO/BinKeeper.py/BinKeeperII.pp2intervals