new logo
This commit is contained in:
parent
c501d1dcd1
commit
caedf4c123
7 changed files with 60 additions and 27 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
a.nex
|
||||
test.go
|
||||
test.go
|
||||
SeqCombGo
|
|
@ -37,3 +37,7 @@ SeqCombGo -o export.nex import1.fas import2.fas
|
|||
url = {https://github.com/MalacoLab/SeqCombGo},
|
||||
}
|
||||
```
|
||||
|
||||
# Detail
|
||||
|
||||
tobedo
|
1
count.go
1
count.go
|
@ -47,5 +47,6 @@ func fas_name(old_name string) string {
|
|||
matchArr := compileRegex.FindStringSubmatch(old_name)
|
||||
//needed to use the string get from the old string
|
||||
new_name := matchArr[len(matchArr)-1]
|
||||
// 这里有 bug
|
||||
return new_name
|
||||
}
|
||||
|
|
36
flag.go
36
flag.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -10,11 +11,44 @@ var (
|
|||
file_input []string
|
||||
)
|
||||
|
||||
// http://www.network-science.de/ascii/
|
||||
// is there any better way to print logo? plz contact us
|
||||
func print_logo() {
|
||||
fmt.Print("__ ___ _ ___ \n" +
|
||||
"/ _\\ ___ __ _ / __\\___ _ __ ___ | |__ / _ \\___ \n" +
|
||||
"\\ \\ / _ \\/ _` |/ / / _ \\| '_ ` _ \\| '_ \\ / /_\\/ _ \\ \n" +
|
||||
"_\\ \\ __/ (_| / /__| (_) | | | | | | |_) / /_\\ (_) |\n" +
|
||||
"\\__/\\___|\\__, \\____/\\___/|_| |_| |_|_.__/\\____/\\___/ \n" +
|
||||
" |_| \n")
|
||||
fmt.Println(" Sequence Combination tool written in Golang")
|
||||
fmt.Println("Version 0.0.1 Authors:An,G;Zhang,G License:GPL-3.0")
|
||||
}
|
||||
|
||||
// __ ___ _ ___
|
||||
// / _\ ___ __ _ / __\___ _ __ ___ | |__ / _ \___
|
||||
// \ \ / _ \/ _` |/ / / _ \| '_ ` _ \| '_ \ / /_\/ _ \
|
||||
// _\ \ __/ (_| / /__| (_) | | | | | | |_) / /_\\ (_) |
|
||||
// \__/\___|\__, \____/\___/|_| |_| |_|_.__/\____/\___/
|
||||
// |_|
|
||||
|
||||
func dna_flag() {
|
||||
flag.StringVar(&file_output, "o", "a.nex", "output file")
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
file_input = flag.Args() // []string{"foo", "bar"}
|
||||
fmt.Println("==============")
|
||||
// 这里应该加个判断,如果输入不符合,后面的正则会报错
|
||||
print_logo()
|
||||
fmt.Println()
|
||||
fmt.Println("[input file:]", file_input)
|
||||
fmt.Println("[output file:]", file_output)
|
||||
}
|
||||
|
||||
func usage() {
|
||||
print_logo()
|
||||
fmt.Fprintf(os.Stderr, `
|
||||
Example:
|
||||
SeqCombGo -o export.nex import1.fas import2.fas ...
|
||||
Options:
|
||||
`)
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
|
|
15
nex.tmpl
15
nex.tmpl
|
@ -1,15 +0,0 @@
|
|||
#NEXUS
|
||||
BEGIN DATA;
|
||||
DIMENSIONS NTAX={{ .Ntax }} NCHAR={{ .Nchar }};
|
||||
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
||||
MATRIX
|
||||
{{- range $k, $v := .Matrix }}
|
||||
'{{ $k }}' {{ $v }}
|
||||
{{- end }}
|
||||
;
|
||||
END;
|
||||
BEGIN SETS;
|
||||
{{- range $_, $i := .Charset }}
|
||||
CHARSET {{ $i.Name }} = {{ $i.From }}-{{ $i.To }};
|
||||
{{- end }}
|
||||
END;
|
|
@ -2,22 +2,30 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
const f string = `#NEXUS
|
||||
BEGIN DATA;
|
||||
DIMENSIONS NTAX={{ .Ntax }} NCHAR={{ .Nchar }};
|
||||
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
||||
MATRIX
|
||||
{{- range $k, $v := .Matrix }}
|
||||
'{{ $k }}' {{ $v }}
|
||||
{{- end }}
|
||||
;
|
||||
END;
|
||||
BEGIN SETS;
|
||||
{{- range $_, $i := .Charset }}
|
||||
CHARSET {{ $i.Name }} = {{ $i.From }}-{{ $i.To }};
|
||||
{{- end }}
|
||||
END;`
|
||||
|
||||
func do_impl(last_data tmpl_data) {
|
||||
|
||||
f, err := ioutil.ReadFile("nex.tmpl")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// 读取模板
|
||||
// read the template
|
||||
nex_tmpl, err := template.New("nex").Parse(string(f))
|
||||
// read the template
|
||||
nex_tmpl, err := template.New("nex").Parse(f)
|
||||
if err != nil {
|
||||
fmt.Println("[ tmpl err ]", err)
|
||||
return
|
Loading…
Reference in a new issue