Beispiel #1
0
func ExampleNewSeq_2() {
	if _, err := NewSeq("example RNA", []alphabet.Letter("ACGCTGACTTGGTGCACGT"), alphabet.RNA); err != nil {
		fmt.Printf("%v: %v\n", err, alphabet.Letters(err.(bio.Error).Items()[0].([]alphabet.Letter)))
	}
	// Output:
	// Encoding error: packed: invalid letter 'T' at position 4.: ACGCTGACTTGGTGCACGT
}
Beispiel #2
0
		self.S = s
		self.circular = false
		self.offset = 0
	}

	return
}

// Return a string representation of the sequence. Representation is determined by the Stringify field.
func (self *QSeq) String() string { return self.Stringify(self) }

// The default Stringify function for QSeq.
var QStringify = func(s seq.Polymer) string {
	t := s.(*QSeq)
	gap := t.Alphabet().Gap()
	cs := make([]alphabet.Letter, 0, len(t.S))
	for _, ql := range t.S {
		if alphabet.Qphred(ql.Q) > t.Threshold || ql.L == gap {
			cs = append(cs, ql.L)
		} else {
			cs = append(cs, t.LowQFilter(t, ql.L))
		}
	}

	return alphabet.Letters(cs).String()
}

// The default LowQFilter function for QSeq.
var LowQFilter = func(s seq.Sequence, _ alphabet.Letter) alphabet.Letter { return s.(*QSeq).alphabet.Ambiguous() }
Beispiel #3
0
	return
}

// Join segments of the sequence, returning any error.
func (self *Seq) Compose(f feat.FeatureSet) (err error) {
	tt, err := sequtils.Compose(self.S, self.offset, f)
	if err == nil {
		s := []alphabet.Letter{}
		complement := self.alphabet.ComplementTable()
		for i, ts := range tt {
			if f[i].Strand == -1 {
				s = append(s, self.revComp(ts.([]alphabet.Letter), complement)...)
			} else {
				s = append(s, ts.([]alphabet.Letter)...)
			}
		}

		self.S = s
		self.circular = false
		self.offset = 0
	}

	return
}

// Return a string representation of the sequence. Representation is determined by the Stringify field.
func (self *Seq) String() string { return self.Stringify(self) }

// The default Stringify function for Seq.
var Stringify = func(s seq.Polymer) string { return alphabet.Letters(s.(*Seq).S).String() }