<commit_before>package vcfgo

import (
	"fmt"
	"io"
	"strings"

	. "gopkg.in/check.v1"
)

type VariantSuite struct {
	reader io.Reader
}

var _ = Suite(&VariantSuite{})

func (s *VariantSuite) SetUpTest(c *C) {
	s.reader = strings.NewReader(vcfStr)
}

func (s *VariantSuite) TestVariantGetInt(c *C) {
	rdr, err := NewReader(s.reader, true)
	c.Assert(err, IsNil)
	v := rdr.Read()

	ns, err := v.Info.Get("NS")
	c.Assert(err, IsNil)
	c.Assert(ns, Equals, 3)

	dp, err := v.Info.Get("DP")
	c.Assert(dp, Equals, 14)
	c.Assert(err, IsNil)

	nsf, err := v.Info.Get("NS")
	c.Assert(err, IsNil)
	c.Assert(nsf, Equals, int(3))

	dpf, err := v.Info.Get("DP")
	c.Assert(err, IsNil)
	c.Assert(dpf, Equals, int(14))

	hqs, err := v.Info.Get("AF")
	c.Assert(hqs, DeepEquals, []interface{}{0.5})
	c.Assert(err, IsNil)

	dpfs, err := v.Info.Get("DP")
	c.Assert(err, IsNil)
	c.Assert(dpfs, DeepEquals, 14)

}

func (s *VariantSuite) TestInfoField(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()
	vstr := fmt.Sprintf("%s", v.Info)
	c.Assert(vstr, Equals, "NS=3;DP=14;AF=0.5;DB;H2")
}

func (s *VariantSuite) TestInfoMap(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()

	vstr := fmt.Sprintf("%s", v)
	c.Assert(vstr, Equals, "20\t14370\trs6054257\tG\tA\t29.0\tPASS\tNS=3;DP=14;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:.,.")

	v.Info.Add("asdf", 123)
	v.Info.Add("float", 123.2001)
	has := v.Info.Contains("asdf")
	c.Assert(has, Equals, true)
	val, err := v.Info.Get("float")
	vv, ok := val.(float64)
	c.Assert(ok, Equals, true)
	c.Assert(vv-123.2001 < 1e-4 || 123.2001-vv < 1e-4, Equals, true)
	c.Assert(err, IsNil)

	c.Assert(fmt.Sprintf("%s", v.Info), Equals, "NS=3;DP=14;AF=0.5;DB;H2;asdf=123;float=123.2001")

	rdr.Clear()

}

func (s *VariantSuite) TestStartEnd(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()

	c.Assert(int(v.Start()), Equals, 14369)
	c.Assert(int(v.End()), Equals, 14370)
}

func (s *VariantSuite) TestIs(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v1 := rdr.Read()
	v2 := rdr.Read()
	c.Assert(v1.Is(v1), Equals, true)

	c.Assert(v1.Is(v2), Equals, false)
	c.Assert(v2.Is(v1), Equals, false)
}<commit_msg>remove is as it's in irelate<commit_after>package vcfgo

import (
	"fmt"
	"io"
	"strings"

	. "gopkg.in/check.v1"
)

type VariantSuite struct {
	reader io.Reader
}

var _ = Suite(&VariantSuite{})

func (s *VariantSuite) SetUpTest(c *C) {
	s.reader = strings.NewReader(vcfStr)
}

func (s *VariantSuite) TestVariantGetInt(c *C) {
	rdr, err := NewReader(s.reader, true)
	c.Assert(err, IsNil)
	v := rdr.Read()

	ns, err := v.Info.Get("NS")
	c.Assert(err, IsNil)
	c.Assert(ns, Equals, 3)

	dp, err := v.Info.Get("DP")
	c.Assert(dp, Equals, 14)
	c.Assert(err, IsNil)

	nsf, err := v.Info.Get("NS")
	c.Assert(err, IsNil)
	c.Assert(nsf, Equals, int(3))

	dpf, err := v.Info.Get("DP")
	c.Assert(err, IsNil)
	c.Assert(dpf, Equals, int(14))

	hqs, err := v.Info.Get("AF")
	c.Assert(hqs, DeepEquals, []interface{}{0.5})
	c.Assert(err, IsNil)

	dpfs, err := v.Info.Get("DP")
	c.Assert(err, IsNil)
	c.Assert(dpfs, DeepEquals, 14)

}

func (s *VariantSuite) TestInfoField(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()
	vstr := fmt.Sprintf("%s", v.Info)
	c.Assert(vstr, Equals, "NS=3;DP=14;AF=0.5;DB;H2")
}

func (s *VariantSuite) TestInfoMap(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()

	vstr := fmt.Sprintf("%s", v)
	c.Assert(vstr, Equals, "20\t14370\trs6054257\tG\tA\t29.0\tPASS\tNS=3;DP=14;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:.,.")

	v.Info.Add("asdf", 123)
	v.Info.Add("float", 123.2001)
	has := v.Info.Contains("asdf")
	c.Assert(has, Equals, true)
	val, err := v.Info.Get("float")
	vv, ok := val.(float64)
	c.Assert(ok, Equals, true)
	c.Assert(vv-123.2001 < 1e-4 || 123.2001-vv < 1e-4, Equals, true)
	c.Assert(err, IsNil)

	c.Assert(fmt.Sprintf("%s", v.Info), Equals, "NS=3;DP=14;AF=0.5;DB;H2;asdf=123;float=123.2001")

	rdr.Clear()

}

func (s *VariantSuite) TestStartEnd(c *C) {
	rdr, err := NewReader(s.reader, false)
	c.Assert(err, IsNil)
	v := rdr.Read()

	c.Assert(int(v.Start()), Equals, 14369)
	c.Assert(int(v.End()), Equals, 14370)
}
{'fraction_non_alphanumeric': 0.22181146025878004, 'fraction_numerical': 0.05683918669131238, 'mean_word_length': 4.318181818181818, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5063262', 'n_tokens_mistral': 2236, 'n_tokens_neox': 2080, 'n_words': 369}