Fix missing output.
authorTom Clegg <tom@tomclegg.ca>
Thu, 8 Jul 2021 23:06:07 +0000 (19:06 -0400)
committerTom Clegg <tom@tomclegg.ca>
Thu, 8 Jul 2021 23:06:07 +0000 (19:06 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

export.go
export_test.go

index e22e04a291f3c2a464526147261d1bf580e13685..8d455b15ac82429dc7221fc20fc8846ce2f6a7eb 100644 (file)
--- a/export.go
+++ b/export.go
@@ -138,7 +138,7 @@ func (cmd *exporter) RunCommand(prog string, args []string, stdin io.Reader, std
                if err != nil {
                        return 1
                }
-               fmt.Fprintln(stdout, output+"/export.csv")
+               fmt.Fprintln(stdout, output)
                return 0
        }
 
@@ -304,13 +304,14 @@ func (cmd *exporter) export(outdir string, bedout io.Writer, tilelib *tileLibrar
                                defer bedw.Close()
                        }
                        defer outw.Close()
-                       outwb := bufio.NewWriter(outw)
+                       outwb := bufio.NewWriterSize(outw, 8*1024*1024)
                        defer outwb.Flush()
                        cmd.exportSeq(outwb, bedw, tilelib.taglib.keylen, seqname, refseq[seqname], tilelib, cgs)
                }()
        }
 
        merges.Wait()
+       throttle.Wait()
        return nil
 }
 
index 1dc2ad87b636a25fff7fe2cf3f2e6651c889a2fd..8ee3ab48ef66e7e1c589f0d88ee3095356fdab82 100644 (file)
@@ -22,6 +22,7 @@ func (s *exportSuite) TestFastaToHGVS(c *check.C) {
        exited := (&importer{}).RunCommand("import", []string{"-local=true", "-tag-library", "testdata/tags", "-output-tiles", "-save-incomplete-tiles", "testdata/pipeline1", "testdata/ref.fasta"}, &bytes.Buffer{}, &buffer, os.Stderr)
        c.Assert(exited, check.Equals, 0)
        ioutil.WriteFile(tmpdir+"/library.gob", buffer.Bytes(), 0644)
+
        exited = (&exporter{}).RunCommand("export", []string{
                "-local=true",
                "-input-dir=" + tmpdir,
@@ -55,4 +56,34 @@ chr2.471_472delinsAA 1       0
        c.Check(string(labels), check.Equals, `0,"input1","out.csv"
 1,"input2","out.csv"
 `)
+
+       exited = (&exporter{}).RunCommand("export", []string{
+               "-local=true",
+               "-input-dir=" + tmpdir,
+               "-output-dir=" + tmpdir,
+               "-output-format=vcf",
+               "-ref=testdata/ref.fasta",
+       }, &buffer, os.Stderr, os.Stderr)
+       c.Check(exited, check.Equals, 0)
+       output, err = ioutil.ReadFile(tmpdir + "/out.chr1.vcf")
+       c.Check(err, check.IsNil)
+       c.Log(string(output))
+       c.Check(sortLines(string(output)), check.Equals, sortLines(`chr1        1       NNN     GGC     1/1     0/0
+chr1   41      TT      AA      1/0     0/0
+chr1   161     A       T       0/1     0/0
+chr1   178     A       T       0/1     0/0
+chr1   221     TCCA    T       1/1     0/0
+chr1   302     TTTT    AAAA    0/1     0/0
+`))
+       output, err = ioutil.ReadFile(tmpdir + "/out.chr2.vcf")
+       c.Check(err, check.IsNil)
+       c.Log(string(output))
+       c.Check(sortLines(string(output)), check.Equals, sortLines(`chr2        1       TTT     AAA     0/0     0/1
+chr2   125     CTT     AAA     0/0     1/1
+chr2   240     ATTTTTCTTGCTCTC A       1/0     0/0
+chr2   258     CCTTGTATTTTT    AA      1/0     0/0
+chr2   315     C       A       1/0     0/0
+chr2   469     GTGG    G       1/0     0/0
+chr2   471     GG      AA      0/1     0/0
+`))
 }