-
Notifications
You must be signed in to change notification settings - Fork 18
/
rule_sets_examples.py
46 lines (40 loc) · 2.74 KB
/
rule_sets_examples.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
"""
Contains the rules examples that will be used throughout the tests.
The aim is to
"""
import logging
import csv
import os
rule_10_subset_address = "{}/tests/data/rules_r10_subset.tsv".format(os.path.dirname(__file__))
applicable_rules_10_dict = {}
with open(rule_10_subset_address, "r") as csv_file:
fieldnames = ["Rule_ID", "Reaction_ID", "Diameter", "Direction", "Rule_order", "Rule_SMARTS", "Substrate_ID", "Substrate_SMILES", "Product_IDs", "Product_SMILES", "Rule_SMILES", "Rule_SMARTS_lite"]
csv_reader = csv.DictReader(csv_file, delimiter = '\t', fieldnames = fieldnames)
next(csv_reader) # skip first line
for element in csv_reader:
applicable_rules_10_dict[element["Rule_ID"]] = {"Rule_SMARTS": element["Rule_SMARTS"],
"biological_score": 1,
"EC_number": ["EC: None"],
"Rule_SMILES": element["Rule_SMILES"]}
rule_2_subset_address = "{}/tests/data/rules_r2_subset.tsv".format(os.path.dirname(__file__))
applicable_rules_2_dict = {}
with open(rule_2_subset_address, "r") as csv_file:
fieldnames = ["Rule_ID", "Reaction_ID", "Diameter", "Direction", "Rule_order", "Rule_SMARTS", "Substrate_ID", "Substrate_SMILES", "Product_IDs", "Product_SMILES", "Rule_SMILES", "Rule_SMARTS_lite"]
csv_reader = csv.DictReader(csv_file, delimiter = '\t', fieldnames = fieldnames)
next(csv_reader) # skip first line
for element in csv_reader:
applicable_rules_2_dict[element["Rule_ID"]] = {"Rule_SMARTS": element["Rule_SMARTS"],
"biological_score": 1,
"EC_number": ["EC: None"],
"Rule_SMILES": element["Rule_SMILES"]}
rule_mixed_subset_address = "{}/tests/data/rules_mixed_subset.tsv".format(os.path.dirname(__file__))
applicable_rules_mixed_dict = {}
with open(rule_mixed_subset_address, "r") as csv_file:
fieldnames = ["Rule_ID", "Reaction_ID", "Diameter", "Direction", "Rule_order", "Rule_SMARTS", "Substrate_ID", "Substrate_SMILES", "Product_IDs", "Product_SMILES", "Rule_SMILES", "Rule_SMARTS_lite"]
csv_reader = csv.DictReader(csv_file, delimiter = '\t', fieldnames = fieldnames)
next(csv_reader) # skip first line
for element in csv_reader:
applicable_rules_mixed_dict[element["Rule_ID"]] = {"Rule_SMARTS": element["Rule_SMARTS"],
"biological_score": 1,
"EC_number": ["EC: None"],
"Rule_SMILES": element["Rule_SMILES"]}