예제 #1
0
파일: utils.go 프로젝트: mingzhi/pileup
func newMeanVars(size int) []*meanvar.MeanVar {
	mvs := make([]*meanvar.MeanVar, size)
	for i := range mvs {
		mvs[i] = meanvar.New()
	}
	return mvs
}
예제 #2
0
파일: meanvars.go 프로젝트: mingzhi/pileup
// NewMeanVariances return a new MeanVariances of length maxl.
func NewMeanVariances(size int) *MeanVariances {
	mcc := MeanVariances{}
	for i := 0; i < size; i++ {
		mv := meanvar.New()
		mcc.meanvars = append(mcc.meanvars, mv)
	}
	return &mcc
}
예제 #3
0
파일: cr.go 프로젝트: mingzhi/pileup
func (cmd *cmdCr) collect(covsChan chan []Covariance) (covMVs, xMVs, yMVs []*meanvar.MeanVar) {
	covMVs = make([]*meanvar.MeanVar, cmd.maxl)
	xMVs = make([]*meanvar.MeanVar, cmd.maxl)
	yMVs = make([]*meanvar.MeanVar, cmd.maxl)
	for i := range covMVs {
		covMVs[i] = meanvar.New()
		xMVs[i] = meanvar.New()
		yMVs[i] = meanvar.New()
	}
	for covs := range covsChan {
		for i := range covs {
			n := covs[i].GetN()
			v := covs[i].GetResult()
			if n > 10 && !math.IsNaN(v) {
				covMVs[i].Increment(v)
				xMVs[i].Increment(covs[i].MeanX())
				yMVs[i].Increment(covs[i].MeanY())
			}
		}
	}
	return
}