1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
15 "git.arvados.org/arvados.git/sdk/go/arvados"
16 log "github.com/sirupsen/logrus"
19 type flakecmd struct {
23 func (cmd *flakecmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
27 fmt.Fprintf(stderr, "%s\n", err)
30 flags := flag.NewFlagSet("", flag.ContinueOnError)
31 flags.SetOutput(stderr)
32 pprof := flags.String("pprof", "", "serve Go profile data at http://`[addr]:port`")
33 runlocal := flags.Bool("local", false, "run on local host (default: run in an arvados container)")
34 projectUUID := flags.String("project", "", "project `UUID` for output data")
35 priority := flags.Int("priority", 500, "container request priority")
36 inputDir := flags.String("input-dir", "./in", "input `directory`")
37 outputDir := flags.String("output-dir", "./out", "output `directory`")
38 cmd.filter.Flags(flags)
39 err = flags.Parse(args)
40 if err == flag.ErrHelp {
43 } else if err != nil {
49 log.Println(http.ListenAndServe(*pprof, nil))
54 runner := arvadosContainerRunner{
55 Name: "lightning flake",
56 Client: arvados.NewClientFromEnv(),
57 ProjectUUID: *projectUUID,
64 err = runner.TranslatePaths(inputDir)
68 runner.Args = []string{"flake", "-local=true",
70 "-input-dir", *inputDir,
71 "-output-dir", "/mnt/output",
72 "-max-variants", fmt.Sprintf("%d", cmd.filter.MaxVariants),
73 "-min-coverage", fmt.Sprintf("%f", cmd.filter.MinCoverage),
74 "-max-tag", fmt.Sprintf("%d", cmd.filter.MaxTag),
77 output, err = runner.Run()
81 fmt.Fprintln(stdout, output)
85 tilelib := &tileLibrary{
87 retainTileSequences: true,
88 compactGenomes: map[string][]tileVariantID{},
90 err = tilelib.LoadDir(context.Background(), *inputDir, nil)
96 cmd.filter.Apply(tilelib)
99 err = tilelib.WriteDir(*outputDir)