Mercurial > repos > ufz > dfpl_predict
annotate json_predict.py @ 0:8956e949d466 draft default tip
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
author | ufz |
---|---|
date | Thu, 19 Dec 2024 12:51:08 +0000 |
parents | |
children |
rev | line source |
---|---|
0
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
1 import json |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
2 from sys import stdin |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
3 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
4 d = json.load(stdin) |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
5 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
6 # The directory where the full model of the fnn is loaded from. |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
7 d["fnnModelDir"] = "" # 'dfpl predict' looks for "model_weights.h5" in this directory |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
8 del d["fnn_weights"] |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
9 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
10 d["compressFeatures"] = bool(d["compressFeatures"] == "true") |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
11 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
12 # The encoder file where it is loaded from, to compress the fingerprints. |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
13 d["ecModelDir"] = "" |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
14 d["ecWeightsFile"] = "encoder_weights.h5" |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
15 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
16 # Output csv file name which will contain one prediction per input line. |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
17 # Default: prefix of input file name. |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
18 d["outputFile"] = "predictions.csv" |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
19 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
20 d["py/object"] = "dfpl.options.Options" |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
21 |
8956e949d466
planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff
changeset
|
22 print(json.dumps(d)) |