-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (36 loc) · 925 Bytes
/
main.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
package main
import (
"bio-splitter/logic"
"encoding/json"
"fmt"
)
type MarshallStruct struct {
Index int `json:"index"`
Range string `json:"range"`
}
func marshalAndReturn(s logic.Splitter) {
ranges := s.GetRanges()
rnstrings := convertRangeToJsonRange(ranges)
va, err := json.Marshal(rnstrings)
if err != nil {
fmt.Println(err.Error())
}
fmt.Println(string(va))
}
func convertRangeToJsonRange(rngs []logic.Range) (retstr []MarshallStruct) {
for _, rn := range rngs {
retstr = append(retstr, MarshallStruct{
Index: rn.Index,
Range: fmt.Sprintf("Range:bytes=%v-%v", rn.StartByte, rn.StopByte),
})
}
return retstr
}
func main() {
// Created Splitter logic, must react to ENV-VARS INPUTFILE AND PARAMS
// INPUTFILE = String with URL
// PARAMS = JSON obj. with list of parameters
// Must implement logic.Splitter interface
splitter := logic.FastaSplitter{}
marshalAndReturn(splitter)
}