diff options
Diffstat (limited to 'data/goldman.py')
| -rwxr-xr-x | data/goldman.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/data/goldman.py b/data/goldman.py new file mode 100755 index 0000000..ee49bf9 --- /dev/null +++ b/data/goldman.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +import sys + +sk_file = open(sys.argv[1]) +labels = sk_file.readline().strip().split(',') +limbs = [('RHML','LHML'),('RRML','LRML'),('RFML','LFML'),('RTML','LTML'),('RIBL','LIBL'),('RAcH','LAcH')] +index = map(lambda x: (labels.index(x[0]),labels.index(x[1])),limbs) +sid = 1 + +for line in sk_file: + line = line.strip().split(',') + try: + lidx = map(lambda x: (line[x[0]],line[x[1]]),index) + except: + continue + out = [str(sid)] + for (l,r) in lidx: + if l == r != '': + out += [l] + elif l != r: + if l == '': + out += [r] + elif r == '': + out += [l] + else: + out += [str((float(l)+float(r))/2)] + else: + out = None + break + if out: + print ','.join(out) + sid += 1 + + + |
