def compute_likelihood_spec2(strand,start,stop,hyp,lamb): i_list = xrange(stop,stop+10*mfl,+1) if strand == '+' else xrange(start,start-10*mfl,-1) likelihood = alo(hyp[start:stop]) p_no_occ_so_far = 1 - likelihood endpoint = stop if strand == '+' else start for i in i_list: likelihood += p_no_occ_so_far*(1-lamb)**abs(i-endpoint)*hyp[i%G] p_no_occ_so_far *= (1-hyp[i%G]) return likelihood
def p_occ_in_seq_region(strand,start,stop,hyp): return alo(hyp[start:stop])