File: from_path_to_edges.py

package info (click to toggle)
discosnp 1%3A2.6.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,656 kB
  • sloc: python: 5,893; sh: 2,966; cpp: 2,692; makefile: 14
file content (31 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (4)
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
import sys
if len(sys.argv)>1:
    file = open(sys.argv[1])
else:
    file=sys.stdin
# print("source\t target\t type")
def printLine(line, type='r'):
    for i in range(len(line)-1):
        if int(line[i][:-1])<int(line[i+1][:-1]):
            print (line[i]+'\t'+line[i+1]+"\t"+type)
        else:
            print (line[i+1]+'\t'+line[i]+"\t"+type)


# 1000547h;2286435h; 1330792h;1152525l;
for line in file: 
    line=line.strip().rstrip().split(' ')
    line1=line[0].rstrip().split(';')[:-1]
    printLine(line1)
    if len(line)==2: # pairend links:
        line2=line[1].rstrip().split(';')[:-1]
        printLine(line2)
        # print the pairend link:
        printLine([line1[-1],line2[0]],'p')