forked from kusterlab/picked_group_fdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
59 lines (45 loc) · 2.35 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from __future__ import print_function
import sys
import os
import json
configDir = sys.argv[1]
localDir = sys.argv[2]
with open(os.path.join(configDir, 'config.json')) as f:
config = json.load(f)
if sys.argv[3] == "PERC_RESULT_FILES":
if config["uploads"]["prosit_target.psms"] and config["uploads"]["prosit_decoy.psms"]:
print(os.path.join(localDir, "prosit_target.psms"), os.path.join(localDir, "prosit_decoy.psms"))
else:
print(os.path.join(localDir, "out/percolator/andromeda.mokapot.psms.txt"), os.path.join(localDir, "out/percolator/andromeda.mokapot.decoys.psms.txt"))
elif sys.argv[3] == "PROSIT_FLAG":
if config["uploads"]["prosit_target.psms"] and config["uploads"]["prosit_decoy.psms"]:
print("--pout_input_type prosit")
else:
print()
elif sys.argv[3] == "DIGEST_PARAMS":
digest_params = []
if config["options"]["protease"]:
digest_params.append("--enzyme " + config["options"]["protease"])
if config["options"].get("digestion", False):
digest_params.append("--digestion " + config["options"]["digestion"])
if config["options"]["minPeptideLength"]:
digest_params.append("--min-length " + str(config["options"]["minPeptideLength"]))
if config["options"]["maxPeptideLength"]:
digest_params.append("--max-length " + str(config["options"]["maxPeptideLength"]))
if config["options"]["specialAAs"]:
digest_params.append("--special-aas " + config["options"]["specialAAs"])
else:
digest_params.append("--special-aas \\\"\\\"")
if not isinstance(config["options"]["missedCleavages"], bool): # check for bool, as value can be 0 which also evaluates to False
digest_params.append("--cleavages " + str(config["options"]["missedCleavages"]))
print(" ".join(digest_params))
elif sys.argv[3] == "PICKED_GROUP_FDR_EXTRA_PARAMS":
if config["options"].get("minLFQPeptides", False):
print("--lfq_min_peptide_ratios " + str(config["options"]["minLFQPeptides"]))
else:
print()
elif sys.argv[3] == "NUM_THREADS":
if "numThreads" in config:
print(config["numThreads"])
else:
print(1)