Skip to content

Commit

Permalink
closes #151
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed May 18, 2021
1 parent 2a0c183 commit 09595b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v0.2.7
======
+ use csi index for bams to support larger organisms
+ fix ordering of error-checking (#146)
+ support for longer file-lists (#151)

v0.2.6
======
Expand Down
32 changes: 22 additions & 10 deletions paste/paste.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,27 @@ func Main() {

cli := cliargs{OutDir: "./"}
arg.MustParse(&cli)

wg := &sync.WaitGroup{}
wg.Add(len(cli.VCFs))
procs := 5

go count(wg, procs, cli.VCFs)

outvcf := fmt.Sprintf(filepath.Join(cli.OutDir, cli.Name) + ".smoove.square.vcf.gz")
shared.Slogger.Printf("squaring %d files to %s", len(cli.VCFs), outvcf)
var wg *sync.WaitGroup

// TODO: check files in list
if !strings.HasSuffix(cli.VCFs[0], ".list") {
wg = &sync.WaitGroup{}
wg.Add(len(cli.VCFs))
procs := 5

go count(wg, procs, cli.VCFs)
shared.Slogger.Printf("squaring %d files to %s", len(cli.VCFs), outvcf)
} else {
shared.Slogger.Printf("squaring files from %s to %s", cli.VCFs[0], outvcf)
}

args := []string{"merge", "-o", outvcf, "-O", "z", "--threads", "3"}
args = append(args, cli.VCFs...)
if strings.HasSuffix(cli.VCFs[0], ".list") && len(cli.VCFs) == 1 {
args = append(args, []string{"-l", cli.VCFs[0]}...)
} else {
args = append(args, cli.VCFs...)
}

p := exec.Command("bcftools", args...)
p.Stderr = shared.Slogger
Expand All @@ -118,5 +128,7 @@ func Main() {
log.Fatal(err)
}
shared.Slogger.Printf("wrote squared file to %s", outvcf)
wg.Wait()
if wg != nil {
wg.Wait()
}
}

0 comments on commit 09595b1

Please sign in to comment.