Example #1
0
// Join p to the sequence at the end specified by where.
func (self *Seq) Join(p *Seq, where int) (err error) {
	if self.circular {
		return bio.NewError("Cannot join circular sequence: receiver.", 0, self)
	} else if p.circular {
		return bio.NewError("Cannot join circular sequence: parameter.", 0, p)
	}

	switch where {
	case seq.Start:
		p = p.Copy().(*Seq)
		p.S.Align(seq.End)
		self.S.Align(seq.Start)
		self.S.LeftPad = p.S.LeftPad
	case seq.End:
		p = p.Copy().(*Seq)
		p.S.Align(seq.Start)
		self.S.Align(seq.End)
		self.S.RightPad = p.S.RightPad
	default:
		return bio.NewError("Undefined location.", 0, where)
	}

	tt, offset := sequtils.Join(self.S.Letters, p.S.Letters, where)
	self.offset = offset
	self.S.Letters = tt.([]alphabet.Pack)

	return
}
Example #2
0
File: seq.go Project: frogs/biogo
// Join p to the sequence at the end specified by where.
func (self *Seq) Join(p *Seq, where int) (err error) {
	if self.circular {
		return bio.NewError("Cannot join circular sequence: receiver.", 1, self)
	} else if p.circular {
		return bio.NewError("Cannot join circular sequence: parameter.", 1, p)
	}

	tt, offset := sequtils.Join(self.S, p.S, where)
	self.offset = offset
	self.S = tt.([]alphabet.Letter)

	return
}
Example #3
0
// Join p to the sequence at the end specified by where.
func (self *QSeq) Join(p *QSeq, where int) (err error) {
	if self.circular {
		return bio.NewError("Cannot join circular sequence: receiver.", 1, self)
	} else if p.circular {
		return bio.NewError("Cannot join circular sequence: parameter.", 1, p)
	}

	var tt interface{}

	tt, self.offset = sequtils.Join(self.S, p.S, where)
	self.S = tt.([]alphabet.QPack)

	return
}