+// Copyright (C) The Lightning Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
package lightning
import (
"gopkg.in/check.v1"
)
-type exportSuite struct{}
+type exportNumpySuite struct{}
-var _ = check.Suite(&exportSuite{})
+var _ = check.Suite(&exportNumpySuite{})
-func (s *exportSuite) TestFastaToNumpy(c *check.C) {
+func (s *exportNumpySuite) TestFastaToNumpy(c *check.C) {
tmpdir := c.MkDir()
err := ioutil.WriteFile(tmpdir+"/chr1-12-100.bed", []byte("chr1\t12\t100\ttest.1\n"), 0644)
c.Check(err, check.IsNil)
var buffer bytes.Buffer
- exited := (&importer{}).RunCommand("import", []string{"-local=true", "-tag-library", "testdata/tags", "-output-tiles", "-save-incomplete-tiles", "testdata/a.1.fasta", "testdata/tinyref.fasta"}, &bytes.Buffer{}, &buffer, os.Stderr)
+ exited := (&importer{}).RunCommand("import", []string{"-local=true", "-o", tmpdir + "/library.gob.gz", "-tag-library", "testdata/tags", "-output-tiles", "-save-incomplete-tiles", "testdata/a.1.fasta", "testdata/tinyref.fasta"}, &bytes.Buffer{}, os.Stderr, os.Stderr)
c.Assert(exited, check.Equals, 0)
- var output bytes.Buffer
- exited = (&exportNumpy{}).RunCommand("export-numpy", []string{"-local=true", "-output-annotations", tmpdir + "/annotations.csv", "-regions", tmpdir + "/chr1-12-100.bed"}, &buffer, &output, os.Stderr)
+ exited = (&exportNumpy{}).RunCommand("export-numpy", []string{"-local=true", "-input-dir", tmpdir, "-output-dir", tmpdir, "-output-annotations", tmpdir + "/annotations.csv", "-regions", tmpdir + "/chr1-12-100.bed"}, &buffer, os.Stderr, os.Stderr)
c.Check(exited, check.Equals, 0)
- npy, err := gonpy.NewReader(&output)
+ f, err := os.Open(tmpdir + "/matrix.npy")
+ c.Assert(err, check.IsNil)
+ defer f.Close()
+ npy, err := gonpy.NewReader(f)
c.Assert(err, check.IsNil)
variants, err := npy.GetInt16()
c.Assert(err, check.IsNil)
}
}
-func (s *exportSuite) TestOnehot(c *check.C) {
+func (s *exportNumpySuite) TestOnehot(c *check.C) {
for _, trial := range []struct {
incols int
in []int16