-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuse.py
55 lines (42 loc) · 1.43 KB
/
use.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
46
47
48
49
50
51
52
53
54
55
import argparse
import os
from src.annotate import annotate
# -----------------------------------------------------------------------------
# Parse the arguments
# -----------------------------------------------------------------------------
parser = argparse.ArgumentParser()
parser.add_argument('-set', type=str, required=False,
help='The directory path containing the files to be annotated')
args = parser.parse_args()
in_dir = 'data/metabolites_dataset/'
out_dir = 'data/metabolites_dataset/'
if args.set == 'large':
in_dir += 'large/txt/'
out_dir += 'large/ann/'
if args.set == 'cancer':
in_dir += 'cancer/txt/'
out_dir += 'cancer/ann/'
if args.set == 'exposome':
in_dir += 'exposome/txt/'
out_dir += 'exposome/ann/'
if args.set == 'inflammation':
in_dir += 'inflammation/txt/'
out_dir += 'inflammation/ann/'
if not os.path.exists(out_dir):
os.mkdir(out_dir)
# -----------------------------------------------------------------------------
# Annotate the input documents
# -----------------------------------------------------------------------------
annotate(
recognize = False,
link = True,
types = {'disease': 'medic',
'chemical': 'chebi',
'gene': 'ncbi_gene',
'organism': 'ncbi_taxon',
'bioprocess': 'go_bp'
},
in_dir = in_dir,
input_format = 'brat',
out_dir = out_dir
)