Example #1
0
func (self *QSeq) Extract(i int) protein.Sequence {
	s := make([]alphabet.QLetter, 0, self.Len())
	for _, c := range self.S {
		s = append(s, c[i])
	}

	return protein.NewQSeq(self.SubIDs[i], s, self.alphabet, self.encoding)
}
Example #2
0
func ExampleMulti_Add() {
	fmt.Printf("%v %v\n", m.Count(), m)
	m.Add(protein.NewQSeq("example protein",
		[]alphabet.QLetter{{'a', 40}, {'c', 39}, {'g', 40}, {'C', 38}, {'t', 35}, {'g', 20}},
		alphabet.Protein, alphabet.Sanger))
	fmt.Printf("%v %v\n", m.Count(), m)
	// Output:
	// 3 acgxtgacxtggcgcxcat
	// 4 acgctgacxtggcgcxcat
}
Example #3
0
File: multi.go Project: frogs/biogo
func (self *Multi) Consensus(includeMissing bool) (c *protein.QSeq) {
	cs := make([]alphabet.QLetter, 0, self.Len())
	for i := self.Start(); i < self.End(); i++ {
		cs = append(cs, self.Consensify(self, i, includeMissing))
	}

	c = protein.NewQSeq("Consensus:"+self.ID, cs, self.alphabet, self.encoding)
	c.Offset(self.offset)

	return
}
Example #4
0
func (self *Seq) Consensus(_ bool) (qs *protein.QSeq) {
	cs := make([]alphabet.QLetter, 0, self.Len())
	for i := range self.S {
		cs = append(cs, self.Consensify(self, i, false))
	}

	qs = protein.NewQSeq("Consensus:"+self.ID, cs, self.alphabet, alphabet.Sanger)
	qs.Offset(self.offset)
	qs.Circular(self.circular)

	return
}