forked from BurntSushi/cablastp
/
link_to_coarse.go
39 lines (34 loc) · 1.2 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
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
// Diff is no longer used, with the reduced alphabet approach.
// Instead, we simply store the original (sub)sequence.
OrigSeq string
CoarseSeqId uint
CoarseStart, CoarseEnd uint16
}
func NewLinkToCoarse(coarseSeqId, coarseStart, coarseEnd uint,
origSeq string) LinkToCoarse {
return LinkToCoarse{
OrigSeq: origSeq,
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.OrigSeq)
}