示例#1
0
func init() {
	var err error
	m, err = NewMulti("example multi",
		[]nucleic.Sequence{
			nucleic.NewSeq("example DNA 1", []alphabet.Letter("ACGCTGACTTGGTGCACGT"), alphabet.DNA),
			nucleic.NewSeq("example DNA 2", []alphabet.Letter("ACGGTGACCTGGCGCGCAT"), alphabet.DNA),
			nucleic.NewSeq("example DNA 3", []alphabet.Letter("ACGATGACGTGGCGCTCAT"), alphabet.DNA),
		},
		nucleic.Consensify)

	if err != nil {
		panic(err)
	}
}
示例#2
0
文件: packed.go 项目: frogs/biogo
// Return an unpacked sequence.
func (self *Seq) Unpack() (n *nucleic.Seq) {
	n = nucleic.NewSeq(self.ID, alphabet.BytesToLetters([]byte(self.String())), self.alphabet)
	n.Circular(self.circular)
	n.Offset(self.offset)

	return
}
示例#3
0
func ExampleSet_AppendEach() {
	ss := [][]alphabet.Letter{
		[]alphabet.Letter("ACGCTGACTTGGTGCACGT"),
		[]alphabet.Letter("ACGACTGGGACGT"),
		[]alphabet.Letter("ACGCTGACTGGCCGT"),
		[]alphabet.Letter("GCCTTTGCACGT"),
	}
	set = make(Set, 4)
	for i := range set {
		set[i] = nucleic.NewSeq(fmt.Sprintf("example DNA %d", i), ss[i], alphabet.DNA)
	}
	as := [][]alphabet.QLetter{
		alphabet.QLetter{L: 'A'}.Repeat(2),
		alphabet.QLetter{L: 'C'}.Repeat(2),
		alphabet.QLetter{L: 'G'}.Repeat(2),
		alphabet.QLetter{L: 'T'}.Repeat(2),
	}

	set.AppendEach(as)

	for _, s := range set {
		fmt.Println(s)
	}
	// Output:
	// ACGCTGACTTGGTGCACGTAA
	// ACGACTGGGACGTCC
	// ACGCTGACTGGCCGTGG
	// GCCTTTGCACGTTT
}
示例#4
0
文件: alignment.go 项目: frogs/biogo
func (self *Seq) Extract(i int) nucleic.Sequence {
	s := make([]alphabet.Letter, 0, self.Len())
	for _, c := range self.S {
		s = append(s, c[i])
	}

	return nucleic.NewSeq(self.SubIDs[i], s, self.alphabet)
}
示例#5
0
func ExampleNewMulti() {
	m, err := NewMulti("example multi",
		[]nucleic.Sequence{
			nucleic.NewSeq("example DNA 1", []alphabet.Letter("ACGCTGACTTGGTGCACGT"), alphabet.DNA),
			nucleic.NewSeq("example DNA 2", []alphabet.Letter("ACGGTGACCTGGCGCGCAT"), alphabet.DNA),
			nucleic.NewSeq("example DNA 3", []alphabet.Letter("ACGATGACGTGGCGCTCAT"), alphabet.DNA),
		},
		nucleic.Consensify)

	if err != nil {
		return
	}

	aligned(m)
	// Output:
	// ACGCTGACTTGGTGCACGT
	// ACGGTGACCTGGCGCGCAT
	// ACGATGACGTGGCGCTCAT
	//
	// acgntgacntggcgcncat
}
示例#6
0
文件: qpacked.go 项目: frogs/biogo
// Return an unpacked sequence and quality.
func (self *QSeq) Unpack() (n *nucleic.Seq, q *quality.Phred) {
	n = nucleic.NewSeq(self.ID, alphabet.BytesToLetters([]byte(self.String())), self.alphabet)
	n.Circular(self.circular)
	n.Offset(self.offset)
	qb := make([]alphabet.Qphred, self.Len())
	for i, v := range self.S {
		qb[i] = alphabet.Qphred(v >> 2)
	}
	q = quality.NewPhred(self.ID, qb, self.encoding)
	q.Circular(self.circular)
	q.Offset(self.offset)

	return
}