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