暂时修好了
This commit is contained in:
parent
e53203768f
commit
c0c60ce5a7
6 changed files with 28 additions and 25 deletions
15
a.nex
15
a.nex
|
@ -1,15 +1,16 @@
|
||||||
#NEXUS
|
#NEXUS
|
||||||
BEGIN DATA;
|
BEGIN DATA;
|
||||||
DIMENSIONS NTAX=4 NCHAR=6;
|
DIMENSIONS NTAX=4 NCHAR=2031;
|
||||||
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
||||||
MATRIX
|
MATRIX
|
||||||
'>Bradybaena circulus circulus' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
'Bradybaena circulus circulus' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
||||||
'>Bradybaena phaeogramma phaeogramma' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
'Bradybaena phaeogramma phaeogramma' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
||||||
'>Bradybaena similaris' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------???
|
'Bradybaena similaris' -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------aactatatg-gtatcatatatagctatttctgctcaatg-taatataaatagccgcagtactctgactgtgctaaggtagcataatcatttggcttataattgaagtctagtatgaaagaagatatgggagttaactgtttcctaaacgtttacttaatttacttagggggtgaaaatacccccacaaacataatagacgagaagacccttgaaatttttagtata---attttaaatcgtgctttttgttggggcgacaaggtagcatagtaaacctactaagtggttttattagaacaaaattgtatgaataattaaattactcaagggataacagcataatattttaaagtttgtgacctcgatgttggactaggacaatatagtttaaaagactattatttttgctctgttcg---------------------????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
|
||||||
'>Bradybaena virgo virgo' ???tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
'Bradybaena virgo virgo' ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------tatatattatttggtgtttggtgtgggatagttggtacaggtttaagattattgattcgaatagagttaggtagttctggtgttatagcagaagagcatttctacaatgttattgtaacagctcatgcttttgtaataattttttttatagttatgccaatcatgattggaggttttggaaattgaatagtaccgttgttgattggggcacccgatatgagctttccacgtataaacaatataaggttttgattgttacccccttcttttcttctattaattagaagtagtctagtagaaggcggtgcagggaccggttgaacagtgtatcctccacttagctcacttgtaggtcataggagagctgccgtagacttagcaatcttttctcttcatttggctgggatatcatcaattttaggtgcaatcaattttattacaactatttttaatatacgagccccaggaataactatggaacgtgttagactgtttgtttgatctattttagtgacagtgtttcttttattact-----------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
END;
|
END;
|
||||||
BEGIN SETS;
|
BEGIN SETS;
|
||||||
CHARSET ./data/16S.fas = 1-3;
|
CHARSET ./data/16S.fas = 1-811;
|
||||||
CHARSET ./data/CO1.fas = 4-6;
|
CHARSET ./data/CO1.fas = 812-1421;
|
||||||
|
CHARSET ./data/CO1.mega.fas = 1422-2031;
|
||||||
END;
|
END;
|
5
count.go
5
count.go
|
@ -19,9 +19,8 @@ func fas_sum() []dna {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整合若干文件的统计
|
// 整合若干文件的统计
|
||||||
func fas_count() []charset {
|
func fas_count(sum_nex []dna) []charset {
|
||||||
fas_charset := []charset{}
|
fas_charset := []charset{}
|
||||||
sum_nex := fas_sum()
|
|
||||||
for k, v := range sum_nex {
|
for k, v := range sum_nex {
|
||||||
n := v.name
|
n := v.name
|
||||||
f := 1
|
f := 1
|
||||||
|
@ -33,6 +32,6 @@ func fas_count() []charset {
|
||||||
new_charset := charset{n, f, t}
|
new_charset := charset{n, f, t}
|
||||||
fas_charset = append(fas_charset, new_charset)
|
fas_charset = append(fas_charset, new_charset)
|
||||||
}
|
}
|
||||||
// fmt.Println(sum_charset)
|
fmt.Println(fas_charset)
|
||||||
return fas_charset
|
return fas_charset
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ func main() {
|
||||||
|
|
||||||
sum_nex := fas_sum()
|
sum_nex := fas_sum()
|
||||||
|
|
||||||
sum_charset := fas_count()
|
sum_charset := fas_count(sum_nex)
|
||||||
|
|
||||||
sum_dna, ntax, nchar := dna_mix(sum_nex, sum_charset)
|
sum_dna, ntax, nchar := fas_mix(sum_nex, sum_charset)
|
||||||
|
|
||||||
matrix := make(map[string]string, ntax)
|
matrix := make(map[string]string, ntax)
|
||||||
for k := range sum_dna {
|
for k := range sum_dna {
|
||||||
|
|
9
mix.go
9
mix.go
|
@ -2,13 +2,13 @@ package main
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
func dna_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 的整合
|
// 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_dna {
|
for k1 := range v.min {
|
||||||
_, has := sum_dna[k1]
|
_, has := sum_dna[k1]
|
||||||
if !has {
|
if !has {
|
||||||
sum_dna[k1] = make([]string, len(sum_charset))
|
sum_dna[k1] = make([]string, len(sum_charset))
|
||||||
|
@ -17,12 +17,13 @@ func dna_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range sum_nex {
|
for k, v := range sum_nex {
|
||||||
for _, v1 := range v.min_dna {
|
for _, v1 := range v.min {
|
||||||
for k2 := range sum_dna {
|
for k2 := range sum_dna {
|
||||||
if _, ok := v.min_dna[k2]; ok {
|
if _, ok := v.min[k2]; ok {
|
||||||
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)
|
||||||
|
// 之前就没写错吗
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
3
nex.tmpl
3
nex.tmpl
|
@ -4,7 +4,8 @@ BEGIN DATA;
|
||||||
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
FORMAT DATATYPE=DNA GAP=- MISSING=?;
|
||||||
MATRIX
|
MATRIX
|
||||||
{{- range $k, $v := .Matrix }}
|
{{- range $k, $v := .Matrix }}
|
||||||
'{{ $k }}' {{ $v }}{{ end }}
|
'{{ $k }}' {{ $v }}
|
||||||
|
{{- end }}
|
||||||
;
|
;
|
||||||
END;
|
END;
|
||||||
BEGIN SETS;
|
BEGIN SETS;
|
||||||
|
|
13
parser.go
13
parser.go
|
@ -3,12 +3,13 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dna struct {
|
type dna struct {
|
||||||
name string
|
name string
|
||||||
count int
|
count int
|
||||||
min_dna map[string]string
|
min map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取fas文件
|
// 读取fas文件
|
||||||
|
@ -25,24 +26,24 @@ func fas_parser(file_name string) dna {
|
||||||
i := 0 // acgt行计数
|
i := 0 // acgt行计数
|
||||||
j := -1 // 标题行计数
|
j := -1 // 标题行计数
|
||||||
seq := make(map[string]string)
|
seq := make(map[string]string)
|
||||||
section := ""
|
indid := ""
|
||||||
|
|
||||||
for k, v := range f {
|
for k, v := range f {
|
||||||
switch v {
|
switch v {
|
||||||
case '>':
|
case '>':
|
||||||
j = k
|
j = k + 1
|
||||||
count++
|
|
||||||
case '\n':
|
case '\n':
|
||||||
if j != -1 {
|
if j != -1 {
|
||||||
section = string(f[j:k])
|
indid = string(f[j:k])
|
||||||
i = k + 1
|
i = k + 1
|
||||||
j = -1
|
j = -1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
seq[section] = seq[section] + string(f[i:k])
|
seq[indid] = seq[indid] + strings.ToLower(string(f[i:k]))
|
||||||
i = k + 1
|
i = k + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
count = len(seq[indid])
|
||||||
// for k1, v1 := range seq {
|
// for k1, v1 := range seq {
|
||||||
// fmt.Println(k1)
|
// fmt.Println(k1)
|
||||||
// fmt.Println(v1)
|
// fmt.Println(v1)
|
||||||
|
|
Loading…
Reference in a new issue