Skip to content

Commit 69cc314

Browse files
authored
Merge pull request #99 from openproblems-bio/jalil
all metrics integrated
2 parents ca5d88e + 08c42c4 commit 69cc314

File tree

15 files changed

+97
-85
lines changed

15 files changed

+97
-85
lines changed

scripts/run_all.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
set -e
22

3-
datasets=('replogle' 'nakatake' 'adamson' 'norman' 'xaira_HEK293T' 'xaira_HCT116' 'parsebioscience' 'ibd' '300BCG') #'replogle' 'op' 'nakatake' 'adamson' 'norman' 'xaira_HEK293T' 'xaira_HCT116' 'parsebioscience' 'ibd' '300BCG') #
3+
datasets=('replogle' 'op') #'replogle' 'op' 'nakatake' 'adamson' 'norman' 'xaira_HEK293T' 'xaira_HCT116' 'parsebioscience' 'ibd' '300BCG') #
44

55
run_local=false # set to true to run locally, false to run on AWS
66

77
run_grn_inference=false
8-
run_grn_evaluation=true
9-
run_download=false
8+
run_grn_evaluation=false
9+
run_download=true
1010

1111

1212
for dataset in "${datasets[@]}"; do
@@ -56,7 +56,7 @@ for dataset in "${datasets[@]}"; do
5656
fi
5757

5858
echo "Running GRN evaluation for dataset: $dataset"
59-
# bash scripts/run_grn_evaluation.sh --dataset=$dataset --run_local=$run_local --build_images=false
59+
bash scripts/run_grn_evaluation.sh --dataset=$dataset --run_local=$run_local --build_images=false
6060
fi
6161

6262
if [ "$run_download" = true ]; then

scripts/run_grn_evaluation.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fi
6565

6666

6767
num_workers=10
68-
metric_ids="[regression, ws_distance, sem, tf_recovery, replica_consistency]" #
68+
metric_ids="[all_metrics]" # regression, ws_distance, sem, tf_recovery, replica_consistency
6969
RUN_ID="${DATASET}_evaluation"
7070
models_folder="${DATASET}/"
7171
apply_tf=true

src/api/comp_metric.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,29 @@ arguments:
5959
direction: input
6060
default: ridge
6161
description: name of regression to use
62+
- name: --ground_truth
63+
type: file
64+
direction: input
65+
must_exist: false
66+
required: false
67+
example: resources_test/grn_benchmark/ground_truth/PBMC.csv
68+
- name: --ws_consensus
69+
type: file
70+
direction: input
71+
must_exist: false
72+
required: false
73+
example: resources_test/grn_benchmark/prior/ws_consensus_norman.csv
74+
- name: --ws_distance_background
75+
type: file
76+
direction: input
77+
must_exist: false
78+
required: false
79+
example: resources_test/grn_benchmark/prior/ws_distance_background_norman.csv
80+
- name: --silent_missing_dependencies
81+
type: boolean
82+
required: false
83+
direction: input
84+
default: true
6285

6386

6487
test_resources:

src/metrics/all_metrics/config.vsh.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,33 @@ resources:
1212
- path: helper.py
1313
- path: /src/utils/util.py
1414
dest: util.py
15+
- path: /src/metrics/regression/helper.py
16+
dest: regression_helper.py
17+
- path: /src/metrics/ws_distance/helper.py
18+
dest: ws_helper.py
19+
- path: /src/metrics/sem/helper.py
20+
dest: sem_helper.py
21+
- path: /src/metrics/tf_recovery/helper.py
22+
dest: tf_recovery_helper.py
23+
- path: /src/metrics/tf_binding/helper.py
24+
dest: tf_binding_helper.py
25+
- path: /src/metrics/replica_consistency/helper.py
26+
dest: replica_consistency_helper.py
27+
- path: /src/utils/dataset_config.py
28+
dest: dataset_config.py
29+
- path: /src/metrics/metrics_config.py
30+
dest: metrics_config.py
31+
32+
33+
1534

1635
engines:
1736
- type: docker
1837
image: pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel
1938
__merge__: /src/api/base_requirements.yaml
2039
setup:
2140
- type: python
22-
packages: [ lightgbm==4.3.0, numpy==1.26.4 , tqdm_joblib==0.0.5]
41+
packages: [ lightgbm==4.3.0, numpy==1.26.4 , tqdm_joblib==0.0.5, decoupler==2.1.1]
2342

2443

2544
runners:

src/metrics/all_metrics/helper.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,39 @@
77
import sys
88
import os
99

10+
try:
11+
from regression_helper import main as main_reg
12+
except:
13+
from regression.helper import main as main_reg
14+
15+
try:
16+
from ws_helper import main as main_ws_distance
17+
except:
18+
from ws_distance.helper import main as main_ws_distance
19+
20+
try:
21+
from sem_helper import main as main_sem
22+
except:
23+
from sem.helper import main as main_sem
24+
25+
26+
try:
27+
from tf_recovery_helper import main as main_tf_rec
28+
except:
29+
from tf_recovery.helper import main as main_tf_rec
30+
31+
32+
try:
33+
from tf_binding_helper import main as main_tf_binding
34+
except:
35+
from tf_binding.helper import main as main_tf_binding
36+
37+
38+
try:
39+
from replica_consistency_helper import main as main_replica_consistency
40+
except:
41+
from replica_consistency.helper import main as main_replica_consistency
1042

11-
from regression.helper import main as main_reg2
12-
from ws_distance.helper import main as main_ws_distance
13-
from sem.helper import main as main_sem
14-
from tf_recovery.helper import main as main_tf_rec
15-
from tf_binding.helper import main as main_tf_binding
16-
from replica_consistency.helper import main as main_replica_consistency
1743
from metrics_config import datasets_metrics
1844

1945

@@ -51,7 +77,7 @@ def replica_consistency_metric(par, dataset_id):
5177
def reg2_metric(par, dataset_id):
5278
if dataset_id in datasets_metrics:
5379
if 'regression' in datasets_metrics[dataset_id]:
54-
output = main_reg2(par)
80+
output = main_reg(par)
5581
return output
5682
return None
5783

src/metrics/all_metrics/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
viash run src/metrics/all_metrics/config.vsh.yaml -- \
3-
--prediction resources/grn_models/op/scprint.h5ad \
3+
--prediction resources/results/op/op.scprint.scprint.prediction.h5ad \
44
--evaluation_data resources/grn_benchmark/evaluation_data/op_bulk.h5ad \
55
--score output/score.h5ad \
66
--regulators_consensus resources/grn_benchmark/prior/regulators_consensus_op.json

src/metrics/all_metrics/script.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
try:
2828
sys.path.append(meta["resources_dir"])
29+
from sem_helper import main as main_sem
30+
print(main_sem)
2931
except:
3032
meta = {
3133
"all_dir":'src/metrics/',

src/metrics/replica_consistency/script.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@
3333
method_id = ad.read_h5ad(par['prediction'], backed='r').uns['method_id']
3434
dataset_id = ad.read_h5ad(par['evaluation_data'], backed='r').uns['dataset_id']
3535

36-
try:
37-
output = main(par)
38-
except Exception as e:
39-
print({'error': str(e)})
40-
41-
output = pd.DataFrame({
42-
'key': ["None"],
43-
'value': ["None"],
44-
})
36+
output = main(par)
4537

4638
format_save_score(output, method_id, dataset_id, par['score'])

src/metrics/sem/config.vsh.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ engines:
2121
__merge__: /src/api/base_requirements.yaml
2222
setup:
2323
- type: python
24-
packages: [ ]
24+
packages: []
2525
runners:
2626
- type: executable
2727
- type: nextflow

src/metrics/sem/script.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,9 @@
4949
par[key] = value
5050

5151
if __name__ == "__main__":
52-
try:
53-
output = main_sem(par)
54-
except Exception as e:
55-
print(f"Error in SEM evaluation: {e}")
56-
output = pd.DataFrame({
57-
'key': ["None"],
58-
'value': ["None"]
59-
})
60-
52+
53+
output = main_sem(par)
54+
6155
dataset_id = ad.read_h5ad(par['evaluation_data'], backed='r').uns['dataset_id']
6256
method_id = ad.read_h5ad(par['prediction'], backed='r').uns['method_id']
6357
format_save_score(output, method_id, dataset_id, par['score'])

0 commit comments

Comments
 (0)