-
Notifications
You must be signed in to change notification settings - Fork 4
/
link_to_coarse.go
47 lines (40 loc) · 1.31 KB
/
link_to_coarse.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
package cablastp
import (
"fmt"
)
// LinkToCoarse represents a component of a compressed original sequence
// that allows perfect reconstruction (i.e., decompression) of the original
// sequence.
type LinkToCoarse struct {
// Diff, when "applied" to the porition of the reference sequence indicated
// by this link, will yield the original sequence corresponding to this
// link precisely. If Diff is empty, then the subsequence of the reference
// sequence indicated here is equivalent to the corresponding piece of
// the original sequence.
Diff string
CoarseSeqId uint
CoarseStart, CoarseEnd uint16
}
func NewLinkToCoarse(coarseSeqId, coarseStart, coarseEnd uint,
alignment [2][]byte) LinkToCoarse {
return LinkToCoarse{
Diff: NewEditScript(alignment).String(),
CoarseSeqId: coarseSeqId,
CoarseStart: uint16(coarseStart),
CoarseEnd: uint16(coarseEnd),
}
}
func NewLinkToCoarseNoDiff(
coarseSeqId, coarseStart, coarseEnd uint) LinkToCoarse {
return LinkToCoarse{
Diff: "",
CoarseSeqId: coarseSeqId,
CoarseStart: uint16(coarseStart),
CoarseEnd: uint16(coarseEnd),
}
}
func (lk LinkToCoarse) String() string {
return fmt.Sprintf(
"reference sequence id: %d, reference range: (%d, %d)\n%s",
lk.CoarseSeqId, lk.CoarseStart, lk.CoarseEnd, lk.Diff)
}