Skip to content

Commit

Permalink
Update toppar regex (#137)
Browse files Browse the repository at this point in the history
* update toppar regex

* bump version
  • Loading branch information
rvhonorato authored Jan 31, 2025
1 parent d507f7e commit 218174a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 1 addition & 3 deletions dataset/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
}

Expand Down
8 changes: 7 additions & 1 deletion dataset/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"+
Expand Down Expand Up @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/golang/glog"
)

const version = "v1.12.0"
const version = "v1.12.1"

func init() {
var versionPrint bool
Expand Down

0 comments on commit 218174a

Please sign in to comment.