-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringAlignment.go
More file actions
95 lines (72 loc) · 1.73 KB
/
stringAlignment.go
File metadata and controls
95 lines (72 loc) · 1.73 KB
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
package main
import (
"io/ioutil"
"github.com/olebedev/config"
"github.com/pkg/profile"
)
var cfg *config.Config
func main() {
cfg = readConf()
profileBool, err := cfg.Bool("profile")
check(err)
if profileBool == true {
defer profile.Start().Stop()
}
test, err := cfg.Bool("test")
check(err)
if test == true {
testAlgorithms()
} else {
profileAlgorithms()
}
}
func testAlgorithms() {
firstFile, err := cfg.String("files.first")
check(err)
secFile, err := cfg.String("files.second")
check(err)
runTimesComp := make([]runTimesArr, 2)
dataA := parseFiles(firstFile)
dataB := parseFiles(secFile)
alg := "snwa"
runTimesComp[0] = compareFilesTest(dataA, dataB, alg)
alg = "nwa"
runTimesComp[1] = compareFilesTest(dataA, dataB, alg)
runNamesComp := make([]string, 2)
runNamesComp[0] = "snwa"
runNamesComp[1] = "nwa"
saveTimes(runTimesComp[0], runNamesComp[0])
saveTimes(runTimesComp[1], runNamesComp[1])
}
func profileAlgorithms() {
firstFile, err := cfg.String("files.first")
check(err)
secFile, err := cfg.String("files.second")
check(err)
alg, err := cfg.String("algorithm")
check(err)
dataA := parseFiles(firstFile)
dataB := parseFiles(secFile)
dataRA := genEntr()
dataRB := genEntr()
runTimesComp := make([]runTimesArr, 2)
runTimesComp[0] = compareFiles(dataRA, dataRB, alg)
runTimesComp[1] = compareFiles(dataA, dataB, alg)
runNamesComp := make([]string, 2)
runNamesComp[0] = "fasta"
runNamesComp[1] = "Random"
plotIt(runTimesComp, runNamesComp)
}
func readConf() *config.Config {
var confFile, err = ioutil.ReadFile("config.yml")
check(err)
yamlString := string(confFile)
cfg, err := config.ParseYaml(yamlString)
check(err)
return cfg
}
func check(e error) {
if e != nil {
panic(e)
}
}