def method_erfc(self, space, value): return space.newfloat(rfloat.erfc(value))
def test_erfc(self, space): w_res = space.execute("return [Math.erfc(-1), Math.erfc(0), Math.erfc(1.5)]") assert self.unwrap(space, w_res) == [rfloat.erfc(-1), 1.0, rfloat.erfc(1.5)]
return start, end # reverse complementary of sequence # waston crick pair wcp = {'a': 'T', 'A': 'T', 'g': 'C', 'G': 'C', 't': 'A', 'T': 'A', 'c': 'G', 'C': 'G'} def rc(s): n = len(s) return ''.join([wcp.get(s[elem], 'N') for elem in xrange(n - 1, -1, -1)]) # cdf of normal distribution ncdf = lambda x: erfc(-x / 1.4142135623730951) / 2 # the sum, mean and std of an array/list def sum(x): flag = 0 #a = [[1] * 100 for elem in xrange(pow(10, 6))] for i in x: flag += i # a.append(i) return flag mean = lambda x: 1. * sum(x) / len(x) def std(x):
def test_erfc(self, space): w_res = space.execute( "return [Math.erfc(-1), Math.erfc(0), Math.erfc(1.5)]") assert self.unwrap(space, w_res) == [rfloat.erfc(-1), 1.0, rfloat.erfc(1.5)]