/
zdd.go
96 lines (89 loc) · 2.77 KB
/
zdd.go
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package main
import (
"flag"
"fmt"
"bitbucket.org/jgcarvalho/zdd/ligand"
"bitbucket.org/jgcarvalho/zdd/protein"
"bitbucket.org/jgcarvalho/zdd/score"
"bitbucket.org/jgcarvalho/zdd/search"
"bitbucket.org/jgcarvalho/zdd/train"
)
func main() {
doTrain := flag.Bool("train", false, "train using genetic algorithm")
doTrain2 := flag.Bool("train2", false, "train using nelder mead")
doTrain3 := flag.Bool("train3", false, "CMA-ES")
doTrain4 := flag.Bool("train4", false, "CMA-ES without ranking")
doTrain5 := flag.Bool("train5", false, "CMA-ES corr and ranking")
doScore := flag.Bool("score", false, "score conformation")
doDockGlobal := flag.Bool("dockG", false, "global docking")
fprot := flag.String("p", "", "protein mol2")
flig := flag.String("l", "", "ligand mol2")
flag.Parse()
if *doTrain {
train.Train(1)
return
} else if *doTrain2 {
train.Train(2)
return
} else if *doTrain3 {
train.Train(3)
return
} else if *doTrain4 {
train.Train(4)
return
} else if *doTrain5 {
train.Train(5)
return
} else if *doScore {
if *fprot == "" || *flig == "" {
fmt.Println("Protein or ligand not set")
return
}
params := score.LoadParams("/home/jgcarvalho/gocode/src/bitbucket.org/jgcarvalho/zdd/params/INITPARAMS")
prot := protein.LoadMol2(*fprot)
lig := ligand.LoadMol2(*flig)
total := params.Score(&prot, &lig)
fmt.Println(total)
} else if *doDockGlobal {
if *fprot == "" || *flig == "" {
fmt.Println("Protein or ligand not set")
return
}
prot := protein.LoadMol2(*fprot)
lig := ligand.LoadMol2(*flig)
search.Global(&prot, &lig)
}
// teste de otimizacao
// method := &optimize.CMAES{}
// initX := []float64{1, 2, 1, 1, 1, 1}
// problem := &optimize.Problem{}
// problem.Func = func(x []float64) (sum float64) {
// if len(x) != 6 {
// panic("dimension of the problem must be 6")
// }
//
// for i := 1; i <= 13; i++ {
// z := float64(i) / 10
// y := math.Exp(-z) - 5*math.Exp(-10*z) + 3*math.Exp(-4*z)
// f := x[2]*math.Exp(-x[0]*z) - x[3]*math.Exp(-x[1]*z) + x[5]*math.Exp(-x[4]*z) - y
// sum += f * f
// }
// return sum
// }
// result, err := optimize.Local(*problem, initX, nil, method)
// if err != nil {
// fmt.Println("Erro minimização:", err)
// }
// fmt.Println("###RESULT:", result)
// params := score.LoadParams("/home/jgcarvalho/gocode/src/bitbucket.org/jgcarvalho/zdd/params/INITPARAMS")
// // fmt.Println(params)
// // protein := protein.LoadMol2("/home/jgcarvalho/pdbbind/core/proteinmol2/10gs_protein.mol2")
// protein := protein.LoadMol2(*f_prot)
// // fmt.Println(protein)
// // ligand := ligand.LoadMol2("/home/jgcarvalho/pdbbind/core/ligands/10gs_ligand.mol2")
// ligand := ligand.LoadMol2(*f_lig)
// // fmt.Println(ligand)
// total := params.Score(&protein, &ligand)
// fmt.Println(total)
return
}