-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.py
66 lines (53 loc) · 1.8 KB
/
runner.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
56
57
58
59
60
61
62
63
64
65
66
import os
import pandas as pd
from tqdm import tqdm
import numpy as np
import networkx as nx
import scipy as sc
from wasabi import msg
import sys
import subprocess
import multiprocessing as mp
def precomputeGDGV(file,save_path):
path = file[0]
name = file[1]
rungdgv = "{ time " +"src/./gdgv_exe " + path + " ; }" + " 2> " + save_path+name+".log"
os.system(rungdgv)
return rungdgv
def parallelprecomputeGDGV(file):
path = file[0]
name = file[1]
save_path = file[2]+name+".log"
rungdgv = "{ time " +"src/./gdgv_exe " + path + " ; }" + " 2> " + save_path
msg.info(rungdgv)
os.system(rungdgv)
return rungdgv
def runnerGC(read_path,save_path):
files = []
for r, _, f in os.walk(read_path):
for file in f:
if '.edges' in file:
files.append([os.path.join(r, file),file.replace(".edges","")])
files.sort()
for file in tqdm(files):
rungdgv = precomputeGDGV(file,save_path)
os.system("clear")
msg.info(rungdgv)
return True
def parallelrunnerGC(read_path,save_path,threads=4):
files = []
for r, _, f in os.walk(read_path):
for file in f:
if '.edges' in file:
files.append([os.path.join(r, file),file.replace(".edges","")])
files.sort()
with mp.Pool(threads) as p:
p.map(parallelprecomputeGDGV,[[file[0],file[1],save_path] for file in files])
return True
def runnerdistances(read_path,save_path,method,threads):
distances = { "DGCD-13": 1, "DGCD-129": 2, "RDGF": 3, "DGDDA": 4, "DSD": 5, "IODD": 6}
rungdgv = "{ time " +"python src/./Directed_Distances_v2.py " + read_path+" "+str(distances[method])+ " "+str(threads) + " ; }" + " 2> " + save_path+method+".log"
os.system(rungdgv)
os.system("clear")
msg.info(rungdgv)
return True