Skip to content

Commit 009b44f

Browse files
committed
add exclusion of steps for run
1 parent 9db2216 commit 009b44f

File tree

3 files changed

+50
-36
lines changed

3 files changed

+50
-36
lines changed

ggsr

+40-34
Original file line numberDiff line numberDiff line change
@@ -42,40 +42,46 @@ if sys.argv[1] == '--help':
4242
with open(sys.argv[1]) as f:
4343
config_map = yaml.safe_load(f)
4444

45-
sys.argv = [sys.argv[0], config_map['seq_fn'], config_map['pdb_fn'],
46-
config_map['out_prefix']]
47-
run_args = [str(c)+' ' for c in sys.argv]
48-
run_args[0] = 'step1.py '
49-
print('Running:', ''.join(run_args))
50-
# exec(open(dirname + '/step1.py').read())
51-
print('Step1 done\n')
45+
excluded_steps = config_map['excluded_steps']
5246

53-
sys.argv = [sys.argv[0],
54-
config_map['num_bl'], config_map['minBL'], config_map['maxBL'],
55-
config_map['start_oh_seq'], config_map['start_oh_pos'],
56-
config_map['end_oh_seq'], config_map['end_oh_pos'],
57-
config_map['out_prefix']+'_AA.fasta',
58-
config_map['out_prefix']+'_contacts.json',
59-
config_map['libraries_fn']]
60-
run_args = [str(c)+' ' for c in sys.argv]
61-
run_args[0] = 'step2.py '
62-
print('Running:', ''.join(run_args))
63-
exec(open(dirname + '/step2.py').read())
64-
print('Step2 done\n')
47+
if 1 not in excluded_steps:
48+
sys.argv = [sys.argv[0], config_map['seq_fn'], config_map['pdb_fn'],
49+
config_map['out_prefix']]
50+
run_args = [str(c)+' ' for c in sys.argv]
51+
run_args[0] = 'step1.py '
52+
print('Running:', ''.join(run_args))
53+
exec(open(dirname + '/step1.py').read())
54+
print('Step1 done\n')
6555

66-
sys.argv = [sys.argv[0], config_map['libraries_fn'],
67-
config_map['gg_prob_threshold'], config_map['chosen_lib_fn']]
68-
run_args = [str(c)+' ' for c in sys.argv]
69-
run_args[0] = 'step3.py '
70-
print('Running:', ''.join(run_args))
71-
exec(open(dirname + '/step3.py').read())
72-
print('Step3 done\n')
56+
if 2 not in excluded_steps:
57+
sys.argv = [sys.argv[0],
58+
config_map['num_bl'], config_map['minBL'], config_map['maxBL'],
59+
config_map['start_oh_seq'], config_map['start_oh_pos'],
60+
config_map['end_oh_seq'], config_map['end_oh_pos'],
61+
config_map['out_prefix']+'_AA.fasta',
62+
config_map['out_prefix']+'_contacts.json',
63+
config_map['libraries_fn']]
64+
run_args = [str(c)+' ' for c in sys.argv]
65+
run_args[0] = 'step2.py '
66+
print('Running:', ''.join(run_args))
67+
exec(open(dirname + '/step2.py').read())
68+
print('Step2 done\n')
7369

74-
sys.argv = [sys.argv[0], config_map['out_prefix']+'_AA.fasta',
75-
config_map['out_prefix']+'_CDN.fasta', config_map['chosen_lib_fn'],
76-
config_map['frags_order_fn']]
77-
run_args = [str(c)+' ' for c in sys.argv]
78-
run_args[0] = 'step4.py '
79-
print('Running:', ''.join(run_args))
80-
exec(open(dirname + '/step4.py').read())
81-
print('Step4 done')
70+
if 3 not in excluded_steps:
71+
sys.argv = [sys.argv[0], config_map['libraries_fn'],
72+
config_map['gg_prob_threshold'], config_map['chosen_lib_fn']]
73+
run_args = [str(c)+' ' for c in sys.argv]
74+
run_args[0] = 'step3.py '
75+
print('Running:', ''.join(run_args))
76+
exec(open(dirname + '/step3.py').read())
77+
print('Step3 done\n')
78+
79+
if 4 not in excluded_steps:
80+
sys.argv = [sys.argv[0], config_map['out_prefix']+'_AA.fasta',
81+
config_map['out_prefix']+'_CDN.fasta',
82+
config_map['chosen_lib_fn'], config_map['frags_order_fn']]
83+
run_args = [str(c)+' ' for c in sys.argv]
84+
run_args[0] = 'step4.py '
85+
print('Running:', ''.join(run_args))
86+
exec(open(dirname + '/step4.py').read())
87+
print('Step4 done')

run_config.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# which steps to exclude during run.
2+
# example: [1, 2] to only run steps 3 and 4
3+
excluded_steps: []
4+
15
# names of step1 input files
26
# can make pdb_fn "search" to automatically search
37
# the PDB database and download a PDB structure

tests/bgl3_sample/run_config.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
# which steps to exclude during run.
2+
# example: [1, 2] to only run steps 3 and 4
3+
excluded_steps: [1, 2]
4+
15
# names of step1 input files
26
# can make pdb_fn "search" to automatically search
37
# the PDB database and download a PDB structure
48
# close to the first parent sequence
59
seq_fn: bgl3_sequences.fasta
6-
pdb_fn: 1GNX.pdb
10+
pdb_fn: search
711

812
# run parameters
913
num_bl: 4 # number of blocks in library
@@ -34,7 +38,7 @@ out_prefix: bgl3
3438
# name of step 2 output file
3539
libraries_fn: bgl3_libraries.json
3640

37-
# gg_prob threshold for acceptable libraries
41+
# gg_prob threshold for acceptable libraries (needs to be str for some reason)
3842
gg_prob_threshold: "0.95"
3943

4044
# name of step 3 output file

0 commit comments

Comments
 (0)