-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppac_merged_split_run_utils.py
31 lines (25 loc) · 1.08 KB
/
ppac_merged_split_run_utils.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
import os.path
import pickle
from orthologue_analysis.species import AltSourceMixin, Species
from reannotation.pipelines import suspicious_orthologue_pipeline
class Pristionchus(Species):
abbr = "P"
genus = "pristionchus"
clade = 0
class PristionchusFromTool(AltSourceMixin, Pristionchus):
pass
def pickle_cache_suspicious_orthologue_pipeline(tool, *args, **kwargs):
merged_path = os.path.join("data", "tmp", "ppac_{}_merged.pickle".format(tool))
split_path = os.path.join("data", "tmp", "ppac_{}_split.pickle".format(tool))
if os.path.isfile(merged_path) and os.path.isfile(split_path):
with open(merged_path, "rb") as f:
merged = pickle.load(f)
with open(split_path, "rb") as f:
split = pickle.load(f)
else:
merged, split = suspicious_orthologue_pipeline(*args, **kwargs)
with open(merged_path, 'wb') as f:
pickle.dump(merged, f, protocol=pickle.HIGHEST_PROTOCOL)
with open(split_path, 'wb') as f:
pickle.dump(split, f, protocol=pickle.HIGHEST_PROTOCOL)
return merged, split