def __init__(self, *p): PairRepeatState.__init__(self, *p) self.maxK = 0 self.time = self.mathType(0.0) self.backgroundProb = [] self.indelProb = self.mathType(0.0) self.indelExtProb = self.mathType(0.0) self.repeatProb = self.mathType(0.0) self.endProb = self.mathType(0.0) self.model = None self.memoize = dict()
def load(self, dictionary): PairRepeatState.load(self, dictionary) if 'maxK' not in dictionary: raise ParseException('maxK was not found in state') self.maxK = int(dictionary['maxK']) if 'time' not in dictionary: raise ParseException('time was not found in state') self.time = float(dictionary['time']) if 'backgroundprob' not in dictionary: raise ParseException('backgroundprob was not found in state') self.backgroundProb = dictionary['backgroundprob'] if 'indelprob' not in dictionary: raise ParseException('indelprob was not found in state') self.indelProb = dictionary['indelprob'] if 'indelextprob' not in dictionary: raise ParseException('indelextprob was not found in state') self.indelExtProb = dictionary['indelextprob'] if 'repeatprob' not in dictionary: raise ParseException('repeatprob was not found in state') self.repeatProb = dictionary['repeatprob'] if 'endprob' not in dictionary: raise ParseException('endprob was not found in state') self.endProb = dictionary['endprob'] if 'silendprob' not in dictionary: self.silEndProb = self.endProb else: self.silEndProb = dictionary['silendprob'] if 'initendprob' not in dictionary: self.initEndProb = self.endProb else: self.initEndProb = dictionary['initendprob'] self.model = createKRepeatHMM( self.mathType, self.maxK, self.time, self.backgroundProb, self.indelProb, self.indelExtProb, self.repeatProb, self.endProb, self.initEndProb, self.silEndProb, )
def toJSON(self): ret = PairRepeatState.toJSON(self) del ret['consensusdistribution'] ret['maxK'] = self.maxK ret['time'] = self.time ret['backgroundprob'] = dist_to_json(self.backgroundProb) ret['indelprob'] = self.indelProb ret['indelextprob'] = self.indelExtProb ret['repeatprob'] = self.repeatProb ret['endprob'] = self.endProb ret['silendprob'] = self.silEndProb ret['initendprob'] = self.initEndProb return ret