File: bam_test.go

package info (click to toggle)
golang-github-brentp-irelate 0.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 12,624 kB
  • sloc: makefile: 10; python: 5; sh: 4
file content (48 lines) | stat: -rw-r--r-- 739 bytes parent folder | download
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
package parsers_test

import (
	"testing"

	"github.com/brentp/irelate/parsers"

	. "gopkg.in/check.v1"
)

func Test(t *testing.T) { TestingT(t) }

type BamSuite struct{}

var _ = Suite(&BamSuite{})

type ip struct {
	chrom string
	start uint32
	end   uint32
}

func (p ip) Chrom() string {
	return p.chrom
}
func (p ip) Start() uint32 {
	return p.start
}
func (p ip) End() uint32 {
	return p.end
}

func (s *BamSuite) TestBamQuery(c *C) {
	b, err := parsers.NewBamQueryable("../data/ex.bam")
	c.Assert(err, IsNil)
	reg := ip{"chr1", 3048448, 3049340}

	q, err := b.Query(reg)
	c.Assert(err, IsNil)

	j := 0
	for rec, e := q.Next(); e == nil; rec, e = q.Next() {
		c.Assert(rec.Chrom(), Equals, "chr1")
		j++
	}
	c.Assert(j, Equals, 2)

}