Skip to content

Commit 6d19e23

Browse files
authored
check if modules in the order field are defined as modules and vice-versa (#163)
* check if modules in the `order` field are defined * improve check logic * dont ignore empty modules * add test for module with no parameters * cleaning * update `example_haddock30.yml` * improve error message * bump version
1 parent ae653ff commit 6d19e23

File tree

6 files changed

+788
-18
lines changed

6 files changed

+788
-18
lines changed

dataset/dataset.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ func (t *Target) WriteRunParamStub(projectDir string, haddockDir string) (string
184184
// - Creates the `run.toml` file
185185
func (t *Target) SetupHaddock3Scenario(wd string, s input.Scenario) (runner.Job, error) {
186186
glog.Info("Preparing : " + s.Name)
187+
188+
if err := s.Parameters.Modules.ValidateOrder(); err != nil {
189+
return runner.Job{}, errors.New("Validation error: " + err.Error())
190+
}
191+
187192
sPath := filepath.Join(wd, t.ID, "scenario-"+s.Name)
188193
dataPath := filepath.Join(wd, t.ID, "data")
189194
_ = os.MkdirAll(sPath, 0755)

dataset/dataset_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,30 @@ func TestSetupHaddock3Scenario(t *testing.T) {
616616
if err == nil {
617617
t.Errorf("Failed to detect wrong scenario")
618618
}
619+
620+
// Fail to setup a scenario in which modules defined in the `order` are not defined
621+
inp.Scenarios = []input.Scenario{
622+
{
623+
Name: "scenario1",
624+
Parameters: input.ParametersStruct{
625+
Modules: input.ModuleParams{
626+
Order: []string{"topoaa"},
627+
Topoaa: map[string]any{
628+
"some-param": "some-value",
629+
},
630+
Rigidbody: map[string]any{
631+
"ambig_fname": "_ti",
632+
},
633+
},
634+
},
635+
},
636+
}
637+
s = inp.Scenarios[0]
638+
j, err = target.SetupHaddock3Scenario(wd, s)
639+
if err == nil {
640+
t.Errorf("Failed to identify missing module")
641+
}
642+
// Fail to setup a scenarion in which modules defined in the parameters are not in the order
619643
}
620644

621645
func TestTarget_SetupHaddock24Scenario(t *testing.T) {

example/example_haddock30.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
general:
22
executable: /home/rodrigo/repos/haddock-runner/example/haddock3.sh
33
max_concurrent: 4
4-
haddock_dir: /opt/haddock3
4+
haddock_dir: /home/rodrigo/repos/haddock3
55
receptor_suffix: _r_u
66
ligand_suffix: _l_u
77
input_list: /home/rodrigo/repos/haddock-runner/example/docking/input_list.txt
@@ -35,7 +35,7 @@ scenarios:
3535
unambig_fname: _unambig.tbl
3636
ligand_top_fname: _ligand.top
3737
ligand_param_fname: _ligand.param
38-
emref: ~
38+
emref: {}
3939
caprieval:
4040
reference_fname: _ref.pdb
4141

0 commit comments

Comments
 (0)