示例#1
0
文件: filter.go 项目: mingzhi/pileup
func readRefSeq(fnaFile string) map[string][]byte {
	f := openFile(fnaFile)
	fastaReader := seq.NewFastaReader(f)
	fastaReader.DeflineParser = func(s string) string { return strings.Split(strings.TrimSpace(s), " ")[0] }
	m := make(map[string][]byte)
	sequences, err := fastaReader.ReadAll()
	raiseError(err)
	for _, s := range sequences {
		m[s.Id] = bytes.ToUpper(s.Seq)
	}
	return m
}
示例#2
0
文件: feat.go 项目: mingzhi/pileup
func readFna(filename string, getAcc func(string) string) (accessions []string, sequences [][]byte) {
	f, err := os.Open(filename)
	if err != nil {
		log.Panicln(err)
	}
	defer f.Close()
	fastaReader := seq.NewFastaReader(f)
	ss, err := fastaReader.ReadAll()
	if err != nil {
		log.Panicln(err)
	}
	for _, a := range ss {
		id := getAcc(a.Id)
		accessions = append(accessions, id)
		sequences = append(sequences, a.Seq)
	}
	return
}