Skip to content

Commit 32a8d3d

Browse files
committed
update for pip
1 parent 19ac458 commit 32a8d3d

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

grim/grim.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,30 @@
2323
#
2424

2525

26-
from validation import runfile
27-
from imputation.graph_generation import generate_neo4j_multi_hpf
26+
from .validation import runfile
27+
from .imputation.graph_generation import generate_neo4j_multi_hpf
2828

29-
from imputation.imputegl import Imputation
30-
from imputation.imputegl.networkx_graph import Graph
29+
from .imputation.imputegl import Imputation
30+
from .imputation.imputegl.networkx_graph import Graph
31+
import os
32+
33+
def graph_freqs(conf_file = "", freq_file='default', path='default', for_em = False, em_pop=None ):
34+
if conf_file == "":
35+
conf_file = os.path.dirname(os.path.realpath(__file__)) + '/conf/minimal-configuration.json'
36+
if path == "default":
37+
path = os.path.dirname(os.path.realpath(__file__)) + '/imputation/graph_generation/'
38+
if freq_file == "default":
39+
freq_file = 'output/hpf.csv'
3140

32-
def graph_freqs(conf_file = "./conf/minimal-configuration.json", for_em = False, em_pop=None, freq_file='hpf.csv', path='imputation/graph_generation/' ):
3341
generate_neo4j_multi_hpf.generate_graph(freq_file=freq_file, path=path, config_file=conf_file, em_pop=em_pop,
3442
em=for_em)
3543

36-
def impute(conf_file = "./conf/minimal-configuration.json"):
37-
runfile.run_impute(conf_file)
44+
def impute(conf_file = ""):
45+
project_dir = ""
46+
if conf_file == "":
47+
conf_file = os.path.dirname(os.path.realpath(__file__)) + '/conf/minimal-configuration.json'
48+
project_dir = os.path.dirname(os.path.realpath(__file__)) + '/'
49+
runfile.run_impute(conf_file, project_dir)
3850

3951
def impute_instance(config):
4052
graph = Graph(config)

grim/imputation/graph_generation/generate_neo4j_multi_hpf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def loci_order(loc_values):
192192

193193
return FULL_LOCI, full_name_index_dict
194194

195-
def generate_graph(freq_file = 'hpf.csv', path = '', config_file = "../../conf/minimal-configuration.json", em_pop = None, em= False):
195+
def generate_graph(freq_file = 'output/hpf.csv', path = '', config_file = "../../conf/minimal-configuration.json", em_pop = None, em= False):
196196
##############################################################################
197197
# Configure
198198
##############################################################################
@@ -201,7 +201,7 @@ def generate_graph(freq_file = 'hpf.csv', path = '', config_file = "../../conf/m
201201
pathlib.Path(csvdir).mkdir(parents=True, exist_ok=True)
202202

203203
# Input file
204-
freq_file = path + 'output/' + freq_file
204+
freq_file = path + freq_file
205205

206206
parser = argparse.ArgumentParser()
207207
parser.add_argument("-c", "--config",

grim/validation/runfile.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88
sys.path.insert(0, os.path.join(".."))
99

10-
from imputation.imputegl import Imputation
11-
from imputation.imputegl.networkx_graph import Graph
10+
from ..imputation.imputegl import Imputation
11+
from ..imputation.imputegl.networkx_graph import Graph
1212

1313
# Profiler start
1414
#pr = cProfile.Profile()
1515
#pr.enable()
1616

17-
def run_impute(conf_file = "../conf/minimal-configuration.json"):
17+
def run_impute(conf_file = "../conf/minimal-configuration.json", project_dir = ""):
1818

1919
configuration_file = conf_file
2020

21-
project_dir = ""# "../"
21+
#project_dir = ""# "../"
2222
output_dir = "output/"
2323

24+
2425
# Read configuration file and load properties
2526
with open(configuration_file) as f:
2627
json_conf = json.load(f)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
numpy==1.20.2
1+
numpy>=1.20.2
22
networkx==2.5.1

0 commit comments

Comments
 (0)