| 1 | package parsersscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/" |
| 5 | "strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/" |
| 6 | "stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/" |
| 7 | "unsafescip-go gomod github.com/golang/go/src go1.23.0 unsafe/" |
| 8 | |
| 9 | "github.com/brentp/irelate/interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/" |
| 10 | ) |
| 11 | |
| 12 | const emptyscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/empty. = "" |
| 13 | |
| 14 | // Interval satisfies the Relatable interface. |
| 15 | type Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval# struct { |
| 16 | // chrom, start, end, line, source, related[] |
| 17 | chromscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#chrom. string |
| 18 | startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#start. uint32 |
| 19 | endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#end. uint32 |
| 20 | sourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#source. uint32 |
| 21 | Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields. [][]byte |
| 22 | relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related. []interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.Relatablescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/Relatable# |
| 23 | } |
| 24 | |
| 25 | func NewIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/NewInterval().(chrom string, start uint32, end uint32, fields [][]byte, source uint32, related []interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.Relatablescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/Relatable#) *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval# { |
| 26 | return &Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#{chromscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#chrom.: chrom, startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#start.: start, endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#end.: end, Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields.: fields, sourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#source.: source, relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related.: related} |
| 27 | } |
| 28 | |
| 29 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Chromscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Chrom().() string { return i.chromscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#chrom. } |
| 30 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Start().() uint32 { return i.startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#start. } |
| 31 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#End().() uint32 { return i.endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#end. } |
| 32 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Related().() []interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.Relatablescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/Relatable# { return i.relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related. } |
| 33 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) AddRelatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#AddRelated().(b interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.Relatablescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/Relatable#) { |
| 34 | i.relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related. = append(i.relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related., b) |
| 35 | } |
| 36 | |
| 37 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Sourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Source().() uint32 { return i.sourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#source. } |
| 38 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) SetSourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#SetSource().(src uint32) { i.sourcescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#source. = src } |
| 39 | |
| 40 | func (i *Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#) Stringscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#String().() string { |
| 41 | return string(bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Joinscip-go gomod github.com/golang/go/src go1.23.0 bytes/Join().(i.Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields., []byte{'\t'})) |
| 42 | } |
| 43 | |
| 44 | func unsafeStringscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/unsafeString().(b []byte) string { |
| 45 | return *(*string)(unsafescip-go gomod github.com/golang/go/src go1.23.0 unsafe/.Pointer(&b)) |
| 46 | } |
| 47 | |
| 48 | func IntervalFromBedLinescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/IntervalFromBedLine().(line []byte) (interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.Relatablescip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/Relatable#, error) { |
| 49 | line = bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.TrimRightscip-go gomod github.com/golang/go/src go1.23.0 bytes/TrimRight().(line, "\r\n") |
| 50 | fields := bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Splitscip-go gomod github.com/golang/go/src go1.23.0 bytes/Split().([]byte(string(line)), []byte{'\t'}) |
| 51 | start, err := strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/.ParseUintscip-go gomod github.com/golang/go/src go1.23.0 strconv/ParseUint().(unsafeStringscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/unsafeString().(fields[1]), 10, 32) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | end, err := strconvscip-go gomod github.com/golang/go/src go1.23.0 strconv/.ParseUintscip-go gomod github.com/golang/go/src go1.23.0 strconv/ParseUint().(unsafeStringscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/unsafeString().(fields[2]), 10, 32) |
| 56 | if err != nil { |
| 57 | return nil, err |
| 58 | } |
| 59 | i := Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#{chromscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#chrom.: string(fields[0]), startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#start.: uint32(start), endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#end.: uint32(end), relatedscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#related.: nil, Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields.: fields} |
| 60 | return &i, nil |
| 61 | } |
| 62 | |
| 63 | type RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval# struct { |
| 64 | Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#Interval. |
| 65 | refaltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#refalt. [2]int |
| 66 | HasEndscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#HasEnd. bool |
| 67 | } |
| 68 | |
| 69 | func (i *RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#) SetRefAltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#SetRefAlt().(ra []int) { |
| 70 | i.refaltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#refalt.[0] = ra[0] |
| 71 | i.refaltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#refalt.[1] = ra[1] |
| 72 | } |
| 73 | |
| 74 | func (i *RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#) Refscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#Ref().() string { |
| 75 | return string(i.Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields.[i.refaltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#refalt.[0]]) |
| 76 | } |
| 77 | |
| 78 | func (i *RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#) Altscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#Alt().() []string { |
| 79 | f := string(i.Fieldsscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Fields.[i.refaltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#refalt.[1]]) |
| 80 | return stringsscip-go gomod github.com/golang/go/src go1.23.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.23.0 strings/Split().(f, ",") |
| 81 | } |
| 82 | |
| 83 | func (i *RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#) Endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#End().() uint32 { |
| 84 | if i.HasEndscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#HasEnd. { |
| 85 | return i.Intervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#Interval..Endscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#End().() |
| 86 | } |
| 87 | return i.Startscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/Interval#Start().() + uint32(len(i.Refscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#Ref().())) |
| 88 | } |
| 89 | |
| 90 | var _ interfacesscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/.IRefAltscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/interfaces`/IRefAlt# = (*RefAltIntervalscip-go gomod github.com/brentp/irelate . `github.com/brentp/irelate/parsers`/RefAltInterval#)(nil) |