示例#1
0
func isSecondary(r *boom.Record) bool {
	seq := r.Seq()
	if len(seq) < 10 {
		return false
	}
	if r.Flags()&boom.Reverse == 0 {
		return seq[9]|' ' == 'a'
	}
	return seq[len(seq)-10]|' ' == 't'
}
示例#2
0
func isPrimary(r *boom.Record) bool {
	seq := r.Seq()
	if len(seq) < 1 {
		return false
	}
	if r.Flags()&boom.Reverse == 0 {
		return seq[0]|' ' == 't'
	}
	return seq[len(seq)-1]|' ' == 'a'
}
示例#3
0
文件: trans-diff.go 项目: henmt/2015
func qualOk(r *boom.Record, minId, minQ int, minAvQ float64) (ok bool) {
	var (
		off, l int
		match  int
		mQ     int
		edit   int
	)

	for _, t := range r.Tags() {
		if t.Tag() == [2]byte{'N', 'M'} {
			switch e := t.Value().(type) {
			case byte:
				edit = int(e)
			case uint16:
				edit = int(e)
			case uint32:
				edit = int(e)
			default:
				edit = 0
			}
		}
	}
	cigar := r.Cigar()
	qual := r.Quality()
	for _, c := range cigar {
		t := c.Type()
		if t == boom.CigarMatch || t == boom.CigarInsertion || t == boom.CigarSoftClipped || t == boom.CigarEqual || t == boom.CigarMismatch {
			off = l
			l += c.Len()
			for _, q := range qual[off:l] {
				if int(q) < minQ {
					return false
				}
				if t == boom.CigarMatch || t == boom.CigarEqual {
					match++
					mQ += int(q)
				}
			}
		}
	}
	match -= edit

	ok = match*100 >= minId*l && mQ >= int(minAvQ*float64(l))

	return
}