11 "git.arvados.org/arvados.git/sdk/go/arvados"
12 log "github.com/sirupsen/logrus"
15 type flakecmd struct {
19 func (cmd *flakecmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
23 fmt.Fprintf(stderr, "%s\n", err)
26 flags := flag.NewFlagSet("", flag.ContinueOnError)
27 flags.SetOutput(stderr)
28 pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
29 runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
30 projectUUID := flags.String("project", "", "project `UUID` for output data")
31 priority := flags.Int("priority", 500, "container request priority")
32 inputDir := flags.String("input-dir", "./in", "input `directory`")
33 outputDir := flags.String("output-dir", "./out", "output `directory`")
34 cmd.filter.Flags(flags)
35 err = flags.Parse(args)
36 if err == flag.ErrHelp {
39 } else if err != nil {
45 log.Println(http.ListenAndServe(*pprof, nil))
50 runner := arvadosContainerRunner{
51 Name: "lightning flake",
52 Client: arvados.NewClientFromEnv(),
53 ProjectUUID: *projectUUID,
60 err = runner.TranslatePaths(inputDir)
64 runner.Args = []string{"flake", "-local=true",
66 "-input-dir", *inputDir,
67 "-output-dir", "/mnt/output",
68 "-max-variants", fmt.Sprintf("%d", cmd.filter.MaxVariants),
69 "-min-coverage", fmt.Sprintf("%f", cmd.filter.MinCoverage),
70 "-max-tag", fmt.Sprintf("%d", cmd.filter.MaxTag),
73 output, err = runner.Run()
77 fmt.Fprintln(stdout, output)
81 tilelib := &tileLibrary{
83 retainTileSequences: true,
84 compactGenomes: map[string][]tileVariantID{},
86 err = tilelib.LoadDir(context.Background(), *inputDir, nil)
92 cmd.filter.Apply(tilelib)
95 err = tilelib.WriteDir(*outputDir)