forked from roryk/junkdrawer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathie_tester.py
More file actions
executable file
·33 lines (28 loc) · 775 Bytes
/
Copy pathie_tester.py
File metadata and controls
executable file
·33 lines (28 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/local/bin/python
import numpy as np
import scipy.stats as stats
import sys
def parseIELine(line):
if line[0] == "#":
return []
else:
x = line.split("\t")
z = [int(y) for y in x[1:]]
return [x[0]] + z
def outputLine(line, p):
print "%s\t%f" %(line.strip(), p)
def main():
#header = sys.stdin.readline().split("\t")
for line in sys.stdin:
x = parseIELine(line)
z = [(y < 5) for y in x[1:]]
if True in z:
continue
z = np.array([[x[1], x[2]], [x[3], x[4]]])
chi2, p, dof, expected = stats.chi2_contingency(z, correction=False)
outputLine(line, p)
#if c[1] < 0.01:
# print line
# print c
if __name__ == "__main__":
main()