-
Notifications
You must be signed in to change notification settings - Fork 11
/
fuseProfiles.py
executable file
·45 lines (31 loc) · 1.08 KB
/
fuseProfiles.py
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
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#================================================================#
import argparse
#================================================================#
def getArgs():
parser = argparse.ArgumentParser(description="",version="1.0.0")
parser.add_argument('-u',dest="up",type=argparse.FileType('r'),required=True,help='upstream csv file')
parser.add_argument('-d',dest="down",type=argparse.FileType('r'),required=True,help='downstream csv file')
args = parser.parse_args()
return args
def splitcsv(csv):
csvdict = {}
for line in csv:
elem = line.split(',')
id = elem[0]
pos = elem[1:-1]
csvdict[id] = pos
return csvdict
def main(args):
up = splitcsv(args.up)
down = splitcsv(args.down)
for sample in sorted(up.keys()):
upPos = up[sample]
upPos.reverse()
downPos = down[sample]
profiles = [sample] + upPos[:-1] + downPos
print ','.join(profiles)
if __name__ == '__main__':
args = getArgs()
main(args)