Allow importing all-hom (reference) data from single fasta file.
[lightning.git] / pipeline_test.go
1 package main
2
3 import (
4         "bytes"
5         "io"
6         "os"
7         "sync"
8
9         "gopkg.in/check.v1"
10 )
11
12 type pipelineSuite struct{}
13
14 var _ = check.Suite(&pipelineSuite{})
15
16 func (s *pipelineSuite) TestImport(c *check.C) {
17         for _, infile := range []string{
18                 "testdata/pipeline1/",
19                 "testdata/ref.fasta",
20         } {
21                 c.Logf("TestImport: %s", infile)
22                 var wg sync.WaitGroup
23
24                 statsin, importout := io.Pipe()
25                 wg.Add(1)
26                 go func() {
27                         defer wg.Done()
28                         code := (&importer{}).RunCommand("lightning import", []string{"-local=true", "-skip-ooo=true", "-output-tiles", "-tag-library", "testdata/tags", infile}, bytes.NewReader(nil), importout, os.Stderr)
29                         c.Check(code, check.Equals, 0)
30                         importout.Close()
31                 }()
32                 statsout := &bytes.Buffer{}
33                 wg.Add(1)
34                 go func() {
35                         defer wg.Done()
36                         code := (&stats{}).RunCommand("lightning stats", []string{"-local"}, statsin, statsout, os.Stderr)
37                         c.Check(code, check.Equals, 0)
38                 }()
39                 wg.Wait()
40                 os.Stdout.Write(statsout.Bytes())
41         }
42 }