def _build(self): """ build the index """ occ = bwt.calc_first_occ(self.data) # FM Index FM = {} for i, c in enumerate(self.data): # we'll store the nearest LF mapping for each letter # space inefficient for x, v in occ.items(): FM[(i,x)] = v occ[c] += 1 i = len(self.data) for x, v in occ.items(): FM[(i,x)] = v del occ self.FM = FM
def _build(self): """ build the index """ occ = bwt.calc_first_occ(self.data) # FM Index FM = {} for i, c in enumerate(self.data): # we'll store the nearest LF mapping for each letter # space inefficient for x, v in occ.items(): FM[(i, x)] = v occ[c] += 1 i = len(self.data) for x, v in occ.items(): FM[(i, x)] = v del occ self.FM = FM
def _build(self, data): """ build the index """ self.occ = bwt.calc_first_occ(self.data)
def _build(self): """ build the index """ self.occ = bwt.calc_first_occ(self.data) self.C = bwt.calc_checkpoints(self.data, self.step)
myprint("Suffix array sa: ", sa) r = ''.join(tmp) myprint("BW trasformation of input string: ", r) print("####################################################" + "\n") print("Perform 'verbose' Inverse Burrows-Wheeler transformation") print("Using LF-Mapping" + "\n") import bwt # Calculate the first occurance of letters in left (first) column occ = bwt.calc_first_occ(r) mypprint("first occ: ", occ) # Calculate the full lf-mapping # lf is mapping from input letter rank occurance to left letter # this shows for which idx in last column corresponds to the first idx lf = [0] * len(r) myprint("LF: ", lf) for i, c in enumerate(r): print(i, c) lf[i] = occ[c] print(lf) occ[c] += 1 del occ print(" ") myprint("LF: ", lf)
def _build(self, data): # build the index self.occ = bwt.calc_first_occ(self.data)