From 218174a03b16b6642112752ba2fb7feec202876a Mon Sep 17 00:00:00 2001 From: Rodrigo Vargas Honorato Date: Fri, 31 Jan 2025 11:00:06 +0100 Subject: [PATCH] Update toppar regex (#137) * update toppar regex * bump version --- dataset/dataset.go | 4 +--- dataset/dataset_test.go | 8 +++++++- main.go | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dataset/dataset.go b/dataset/dataset.go index beb7301..3111e5c 100644 --- a/dataset/dataset.go +++ b/dataset/dataset.go @@ -368,7 +368,6 @@ func LoadDataset(projectDir string, pdbList string, rsuf string, lsuf string, ss // Find root and receptor/ligand names match := rootRegex.FindStringSubmatch(basePath) if len(match) == 0 { - glog.Info(fullPath) // Neither receptor nor ligand, add to a list of PDBs pdbArr = append(pdbArr, fullPath) continue @@ -448,7 +447,7 @@ func LoadDataset(projectDir string, pdbList string, rsuf string, lsuf string, ss } // Handle the Toppar - topparRegex := regexp.MustCompile(`(` + k + `)\w+\.(top|param)`) + topparRegex := regexp.MustCompile(`(` + k + `)_.*(top|param)`) topparMatch := topparRegex.FindStringSubmatch(line) if len(topparMatch) != 0 { v.Toppar = append(v.Toppar, s.Text()) @@ -480,7 +479,6 @@ func LoadDataset(projectDir string, pdbList string, rsuf string, lsuf string, ss for _, v := range m { arr = append(arr, v) } - return arr, nil } diff --git a/dataset/dataset_test.go b/dataset/dataset_test.go index a35b3d3..c0c5838 100644 --- a/dataset/dataset_test.go +++ b/dataset/dataset_test.go @@ -152,7 +152,9 @@ func TestLoadDataset(t *testing.T) { "some/path/structure4_ambig.tbl\n"+ "some/path/structure4_unambig-rest.tbl\n"+ "some/path/structure4_ATP.top\n"+ + "some/path/structure42_ATP.top\n"+ "some/path/structure4_ATP.param\n"+ + "some/path/structure42_ATP.param\n"+ "some/path/structure5_r_u.pdb\n"+ "some/path/structure5_l_u.pdb\n"+ "some/path/structure5_target.pdb\n"+ @@ -181,7 +183,11 @@ func TestLoadDataset(t *testing.T) { t.Errorf("Failed: Not all restraints were loaded") } if len(v.Toppar) != 2 { - t.Errorf("Failed: Not all toppar files were loaded") + if len(v.Toppar) > 2 { + t.Errorf("Failed: Too many toppar were loaded") + } else { + t.Errorf("Failed: Not all toppar files were loaded") + } } } if v.ID == "structure3" { diff --git a/main.go b/main.go index 77acf8a..891d2a3 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( "github.com/golang/glog" ) -const version = "v1.12.0" +const version = "v1.12.1" func init() { var versionPrint bool