Skip to content

Commit 90ee7a3

Browse files
authored
Merge pull request #329 from tristan-f-r/config-args
feat!: typed PRA#run
2 parents cd01e67 + 569a49b commit 90ee7a3

43 files changed

Lines changed: 1259 additions & 956 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Snakefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ _config.init_global(config)
2222

2323
out_dir = _config.config.out_dir
2424
algorithm_params = _config.config.algorithm_params
25-
algorithm_directed = _config.config.algorithm_directed
2625
pca_params = _config.config.pca_params
2726
hac_params = _config.config.hac_params
2827
container_settings = _config.config.container_settings
@@ -273,16 +272,12 @@ rule reconstruct:
273272
run:
274273
# Create a copy so that the updates are not written to the parameters logfile
275274
params = reconstruction_params(wildcards.algorithm, wildcards.params).copy()
276-
# Add the input files
277-
params.update(dict(zip(runner.get_required_inputs(wildcards.algorithm), *{input}, strict=True)))
278-
# Add the output file
279-
# All run functions can accept a relative path to the output file that should be written that is called 'output_file'
280-
params['output_file'] = output.pathway_file
281-
# Remove the default placeholder parameter added for algorithms that have no parameters
282-
if 'spras_placeholder' in params:
283-
params.pop('spras_placeholder')
284-
params['container_settings'] = container_settings
285-
runner.run(wildcards.algorithm, params)
275+
# Declare the input files as a dictionary.
276+
inputs = dict(zip(runner.get_required_inputs(wildcards.algorithm), *{input}, strict=True))
277+
# Remove the _spras_run_name parameter added for keeping track of the run name for parameters.yml
278+
if '_spras_run_name' in params:
279+
params.pop('_spras_run_name')
280+
runner.run(wildcards.algorithm, inputs, output.pathway_file, params, container_settings)
286281

287282
# Original pathway reconstruction output to universal output
288283
# Use PRRunner as a wrapper to call the algorithm-specific parse_output

config/config.yaml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# The length of the hash used to identify a parameter combination
44
hash_length: 7
55

6+
# Collection of container options
67
containers:
78
# Specify the container framework used by each PRM wrapper. Valid options include:
89
# - docker (default if not specified)
@@ -60,23 +61,23 @@ containers:
6061

6162
algorithms:
6263
- name: "pathlinker"
63-
params:
64-
include: true
64+
include: true
65+
runs:
6566
run1:
6667
k: range(100,201,100)
6768

6869
- name: "omicsintegrator1"
69-
params:
70-
include: true
70+
include: true
71+
runs:
7172
run1:
7273
b: [5, 6]
7374
w: np.linspace(0,5,2)
7475
d: 10
7576
dummy_mode: "file" # Or "terminals", "all", "others"
7677

7778
- name: "omicsintegrator2"
78-
params:
79-
include: true
79+
include: true
80+
runs:
8081
run1:
8182
b: 4
8283
g: 0
@@ -85,52 +86,50 @@ algorithms:
8586
g: 3
8687

8788
- name: "meo"
88-
params:
89-
include: true
89+
include: true
90+
runs:
9091
run1:
9192
max_path_length: 3
92-
local_search: "Yes"
93+
local_search: true
9394
rand_restarts: 10
9495

9596
- name: "mincostflow"
96-
params:
97-
include: true
97+
include: true
98+
runs:
9899
run1:
99-
flow: 1 # The flow must be an int
100+
flow: 1
100101
capacity: 1
101102

102103
- name: "allpairs"
103-
params:
104-
include: true
104+
include: true
105105

106106
- name: "domino"
107-
params:
108-
include: true
107+
include: true
108+
runs:
109109
run1:
110110
slice_threshold: 0.3
111111
module_threshold: 0.05
112112

113113
- name: "strwr"
114-
params:
115-
include: true
114+
include: true
115+
runs:
116116
run1:
117117
alpha: [0.85]
118118
threshold: [100, 200]
119119

120120
- name: "rwr"
121-
params:
122-
include: true
121+
include: true
122+
runs:
123123
run1:
124124
alpha: [0.85]
125125
threshold: [100, 200]
126126

127127
- name: "bowtiebuilder"
128-
params:
129-
include: true
128+
include: true
130129

131130
- name: "responsenet"
132-
params:
133-
include: true
131+
include: true
132+
runs:
134133
run1:
135134
gamma: [10]
136135

config/egfr.yaml

Lines changed: 41 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# The length of the hash used to identify a parameter combination
21
hash_length: 7
32

43
containers:
@@ -29,108 +28,83 @@ containers:
2928

3029
algorithms:
3130
- name: pathlinker
32-
params:
33-
include: true
31+
include: true
32+
runs:
3433
run1:
3534
k:
3635
- 10
3736
- 20
3837
- 70
3938
- name: omicsintegrator1
40-
params:
41-
include: true
39+
include: true
40+
runs:
4241
run1:
4342
b:
4443
- 0.55
4544
- 2
4645
- 10
47-
d:
48-
- 10
49-
g:
50-
- 1e-3
51-
r:
52-
- 0.01
53-
w:
54-
- 0.1
55-
mu:
56-
- 0.008
46+
d: 10
47+
g: 1e-3
48+
r: 0.01
49+
w: 0.1
50+
mu: 0.008
5751
dummy_mode: ["file"]
5852
- name: omicsintegrator2
59-
params:
60-
include: true
53+
include: true
54+
runs:
6155
run1:
62-
b:
63-
- 4
64-
g:
65-
- 0
56+
b: 4
57+
g: 0
6658
run2:
67-
b:
68-
- 2
69-
g:
70-
- 3
59+
b: 2
60+
g: 3
7161
- name: meo
72-
params:
73-
include: true
62+
include: true
63+
runs:
7464
run1:
75-
local_search:
76-
- "Yes"
77-
max_path_length:
78-
- 3
79-
rand_restarts:
80-
- 10
65+
local_search: true
66+
max_path_length: 3
67+
rand_restarts: 10
8168
run2:
82-
local_search:
83-
- "No"
84-
max_path_length:
85-
- 2
86-
rand_restarts:
87-
- 10
69+
local_search: false
70+
max_path_length: 2
71+
rand_restarts: 10
8872
- name: allpairs
89-
params:
90-
include: true
73+
include: true
9174
- name: domino
92-
params:
93-
include: true
75+
include: true
76+
runs:
9477
run1:
95-
slice_threshold:
96-
- 0.3
97-
module_threshold:
98-
- 0.05
78+
slice_threshold: 0.3
79+
module_threshold: 0.05
9980
- name: mincostflow
100-
params:
101-
include: true
81+
include: true
82+
runs:
10283
run1:
103-
capacity:
104-
- 15
105-
flow:
106-
- 80
84+
capacity: 15
85+
flow: 80
10786
run2:
108-
capacity:
109-
- 1
110-
flow:
111-
- 6
87+
capacity: 1
88+
flow: 6
11289
run3:
113-
capacity:
114-
- 5
115-
flow:
116-
- 60
90+
capacity: 5
91+
flow: 60
11792
- name: "strwr"
118-
params:
119-
include: true
93+
include: true
94+
runs:
12095
run1:
12196
alpha: [0.85]
12297
threshold: [100, 200]
12398

12499
- name: "rwr"
125-
params:
126-
include: true
100+
include: true
101+
runs:
127102
run1:
128103
alpha: [0.85]
129104
threshold: [100, 200]
130105

131106
- name: "bowtiebuilder"
132-
params:
133-
include: false
107+
include: false
134108
datasets:
135109
- data_dir: input
136110
edge_files:

docker-wrappers/SPRAS/example_config.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ containers:
4949

5050
algorithms:
5151
- name: "pathlinker"
52-
params:
53-
include: false
52+
include: false
53+
runs:
5454
run1:
5555
k: range(100,201,100)
5656

5757
- name: "omicsintegrator1"
58-
params:
59-
include: true
58+
include: true
59+
runs:
6060
run1:
6161
r: [5]
6262
b: [5, 6]
@@ -65,8 +65,8 @@ algorithms:
6565
d: [10]
6666

6767
- name: "omicsintegrator2"
68-
params:
69-
include: true
68+
include: true
69+
runs:
7070
run1:
7171
b: [4]
7272
g: [0]
@@ -75,27 +75,26 @@ algorithms:
7575
g: [3]
7676

7777
- name: "meo"
78-
params:
79-
include: true
78+
include: true
79+
runs:
8080
run1:
8181
max_path_length: [3]
82-
local_search: ["Yes"]
82+
local_search: [true]
8383
rand_restarts: [10]
8484

8585
- name: "mincostflow"
86-
params:
87-
include: true
86+
include: true
87+
runs:
8888
run1:
8989
flow: [1] # The flow must be an int
9090
capacity: [1]
9191

9292
- name: "allpairs"
93-
params:
94-
include: true
93+
include: true
9594

9695
- name: "domino"
97-
params:
98-
include: true
96+
include: true
97+
runs:
9998
run1:
10099
slice_threshold: [0.3]
101100
module_threshold: [0.05]

0 commit comments

Comments
 (0)