add version fix -1

This commit is contained in:
qaqland 2022-01-16 09:55:32 +08:00
parent caedf4c123
commit 6043c89842
2 changed files with 21 additions and 8 deletions

20
flag.go
View file

@ -7,12 +7,13 @@ import (
) )
var ( var (
version bool
file_output string file_output string
file_input []string file_input []string
) )
// http://www.network-science.de/ascii/ // ascii img is build from http://www.network-science.de/ascii/
// is there any better way to print logo? plz contact us // is there any better way to print logo? please contact us
func print_logo() { func print_logo() {
fmt.Print("__ ___ _ ___ \n" + fmt.Print("__ ___ _ ___ \n" +
"/ _\\ ___ __ _ / __\\___ _ __ ___ | |__ / _ \\___ \n" + "/ _\\ ___ __ _ / __\\___ _ __ ___ | |__ / _ \\___ \n" +
@ -31,16 +32,25 @@ func print_logo() {
// \__/\___|\__, \____/\___/|_| |_| |_|_.__/\____/\___/ // \__/\___|\__, \____/\___/|_| |_| |_|_.__/\____/\___/
// |_| // |_|
// is for cmd
func dna_flag() { func dna_flag() {
flag.StringVar(&file_output, "o", "a.nex", "output file") flag.StringVar(&file_output, "o", "a.nex", "output file")
flag.BoolVar(&version, "v", false, "version")
flag.Usage = usage flag.Usage = usage
flag.Parse() flag.Parse()
if version {
fmt.Println("SeqCombGo version: SeqCombGo/0.0.1")
os.Exit(0)
}
file_input = flag.Args() // []string{"foo", "bar"} file_input = flag.Args() // []string{"foo", "bar"}
// 这里应该加个判断,如果输入不符合,后面的正则会报错 // 这里应该加个判断,如果输入不符合,后面的正则会报错
if len(file_input) == 0 {
fmt.Println("please use it in right way! see -h for help")
os.Exit(0)
}
print_logo() print_logo()
fmt.Println() fmt.Println("\n[import files:]", file_input)
fmt.Println("[input file:]", file_input) fmt.Println("[export file :]", file_output)
fmt.Println("[output file:]", file_output)
} }
func usage() { func usage() {

9
mix.go
View file

@ -2,12 +2,15 @@ package main
import "strings" import "strings"
// dna 的整合
// comb of dna
func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, int) { func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, int) {
// dna 的整合
// comb of dna
ntax := 0 ntax := 0
nchar := sum_charset[len(sum_charset)-1].To nchar := sum_charset[len(sum_charset)-1].To
sum_dna := make(map[string][]string) sum_dna := make(map[string][]string)
for _, v := range sum_nex { for _, v := range sum_nex {
for k1 := range v.min { for k1 := range v.min {
_, has := sum_dna[k1] _, has := sum_dna[k1]
@ -24,7 +27,7 @@ func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, in
sum_dna[k2][k] = v1 sum_dna[k2][k] = v1
} else { } else {
sum_dna[k2][k] = strings.Repeat("?", v.count) sum_dna[k2][k] = strings.Repeat("?", v.count)
// 之前就没写错吗 // 之前就没写错吗?已修复
} }
} }
} }