Esempio n. 1
0
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
}
Esempio n. 2
0
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
}