annotate json_predict.py @ 0:e0bb949eac45 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:21 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
1 import json
e0bb949eac45 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
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
3
e0bb949eac45 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)
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
5
e0bb949eac45 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.
e0bb949eac45 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
e0bb949eac45 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"]
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
9
e0bb949eac45 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")
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
11
e0bb949eac45 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.
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
13 d["ecModelDir"] = ""
e0bb949eac45 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"
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
15
e0bb949eac45 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.
e0bb949eac45 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.
e0bb949eac45 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"
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
19
e0bb949eac45 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"
e0bb949eac45 planemo upload for repository https://github.com/Helmholtz-UFZ/galaxy-tools/tree/main/tools/dfpl commit 66c6acfeff5441c36fba97787ddc5ee3d6a4a6ec
ufz
parents:
diff changeset
21
e0bb949eac45 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))