-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasmkit.go
88 lines (79 loc) · 2.07 KB
/
asmkit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package asmkit
import (
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "asmkit",
Short: "Toolkit for genome assembly",
Long: `
__ .__ __
_____ ______ _____ | | _|__|/ |_
\__ \ / ___// \| |/ / \ __\
/ __ \_\___ \| Y Y \ <| || |
(____ /____ >__|_| /__|_ \__||__|
\/ \/ \/ \/
`,
Version: Version,
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
bam2linkCmd := &cobra.Command{
Use: "bam2links <input.bam> <output.links>",
Short: "Extract mnd links from bam",
Long: `
bam2link function:
Given a bamfile, to extract links and store as mnd links file for juicebox assembly tools.
`,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
bamfile := args[0]
linkfile := args[1]
p := Bam2linker{Bamfile: bamfile, Linkfile: linkfile}
err := p.Run()
if err != nil {
log.Fatal(err)
}
},
}
agp2assemblyCmd := &cobra.Command{
Use: "agp2assembly <input.agp> <output.assembly>",
Short: "Convert agp file into 3d-dna assembly.",
Long: `
agp2assembly function:
Convert agp file into 3d-dna assembly for juicebox assembly tool.
`,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
agpfile := args[0]
assemblyfile := args[1]
p := Agp2assembler{Agpfile: agpfile, Assemblyfile: assemblyfile}
err := p.Run()
if err != nil {
log.Fatal(err)
}
},
}
var mapq int
bamStatCmd := &cobra.Command{
Use: "bamStat <input.bam>",
Short: "Stat the number of different types of alignments.",
Long: `
bamStat function:
Stat the number of different types of alignments, including unique ||
multiple || low quality alignments.
`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
bamfile := args[0]
p := BamStater{Bamfile: bamfile, MapQ: mapq}
err := p.Run()
if err != nil {
log.Fatal(err)
}
},
}
bamStatCmd.Flags().IntVarP(&mapq, "mapq", "", 10, "Minimum map quality")
rootCmd.AddCommand(agp2assemblyCmd, bam2linkCmd, bamStatCmd)
}