def score(self,site,both_strands=False): ef = self.directional_score(site) if both_strands: eb = self.directional_score(wc(site)) return log(exp(beta*ef) + exp(beta*eb))/(beta) else: return ef
def binding_energy(self,site,double_stranded=False): """Compute binding energy of site. See calcBindingEnergy,Organism.cpp""" w = len(site) E_f = self.activation(site) * w * (-2/beta) - 0.05 E_b = double_stranded and (self.activation(wc(site)) * w * (-2/beta) - 0.05) E_t = ((1 / -beta) * log(exp(-beta * E_f) + exp(-beta * E_b)) if double_stranded else E_f) return E_t
def __init__(self,seq_line): fields = seq_line.split(",") numeric_fields = map(float,fields[1:]) self.site = fields[0] (self.position, self.strand, self.ep, self.act, self.tProb, self.gc, self.tConc) = numeric_fields[:7] self.position_energies = map(float,fields[6:]) self.complements = sum(map(lambda(x,y):x==y,zip(self.site,wc(self.site))))
def adjust(site): if self.recognizer.score(site) < self.recognizer.score(wc(site)): return site else: return wc(site)
def matched_base_pairs(self): return sum(map(lambda(x,y):x==y, zip(self.site,wc(self.site))))