Пример #1
0
func translateQueries(reader *fasta.Reader, f *fasta.Writer) error {

	sequence, err := reader.Read()
	if err == io.EOF {
		return nil
	}
	if err != nil {
		fatalf("Could not read input fasta query: %s\n", err)
	}

	origSeq := sequence.Bytes()
	n := sequence.Name
	// generate 6 ORFs
	transSeqs := cablastp.Translate(origSeq)

	for _, s := range transSeqs {
		// reduce each one
		result := seq.NewSequenceString(n, string(cablastp.Reduce(s)))

		f.Write(result)

	}
	f.Flush()
	return nil
}
Пример #2
0
func readSequence(r *fasta.Reader) (s seq.Sequence, err error) {
	s, err = r.ReadSequence(translateA2M) // A2M encompasses FASTA/A3M
	if !s.IsNull() {
		return s, nil
	}
	if err == io.EOF {
		return seq.Sequence{}, err
	}
	if err != nil {
		return seq.Sequence{}, err
	}
	panic("unreachable")
}