Esempio n. 1
0
        public double GetRandomP(SnpDataSet dataSet)
        {
            double minusLogRandonP = 0;

            for (int i = 0; i < this.GetHaplotype().Length; i++)
            {
                if (this.GetHaplotype(i) == 2)
                {
                    minusLogRandonP += -Math.Log10(dataSet.GetMAF(i + this.GetStart()));
                }
                else
                {
                    minusLogRandonP += -Math.Log10((double)1 - dataSet.GetMAF(i + this.GetStart()));
                }
            }
            return(minusLogRandonP);
        }
Esempio n. 2
0
        public double GetRandomModelLikelihood(SnpDataSet dataSet)
        {
            double minorLikelihood = 0;
            double majorLikelihood = 0;

            for (int i = 0; i < this.GetSequence().Length; i++)
            {
                if (this.GetHaplotype(i) == 0)
                {
                    majorLikelihood += (double)1 / (1 - dataSet.GetMAF(i + this.GetStart()));
                }
                else
                {
                    minorLikelihood += (double)1 / dataSet.GetMAF(i + this.GetStart());
                }
            }
            return((double)Math.Abs(majorLikelihood / (majorLikelihood + minorLikelihood)));
        }