-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_bio.py
More file actions
20 lines (19 loc) · 924 Bytes
/
Copy pathtest_bio.py
File metadata and controls
20 lines (19 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sys
for lines in open(sys.argv[1], 'rU'):
key, value = lines[:2], lines[5:].rstrip()
if key == 'RN':
print(value)
rns = lines.split("\n")[0]
words = rns.rsplit(" ", 2)
number = words[0]
assert number.startswith('[') and number.endswith(']'), "Missing brackets %s" % number
reference.number = int(number[1:-1])
if len(words) == 2:
evidence = words[1]
assert evidence.startswith('{') and evidence.endswith('}'), "Missing braces %s" % evidence
reference.evidence = evidence[1:-1].split('|')
elif len(words) > 2:
evidence = " ".join(words[1:])
assert evidence.startswith('{') and evidence.endswith('}'), "with multiple reference: %s. Missing braces %s" % evidence
reference.evidence = evidence[1:-1].split('|')
print(reference.number, reference.evidence)