Exemple #1
0
        public Qs2000Result(List<short> data, List<short> fraction, List<Fraction> nots)
        {
            RawCurve c = new RawCurve(data.Select(i => (int)i).ToList());
            BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve { Raw = c};
            this.NumPoint = data.Count;
            this.Points = c.ToString();
            this.Peaks = new List<Peak>();
            int fracCount = fraction[0];
            correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]);
            for (int i = 1; i <= fracCount; i++)
            {
                Peak p = new Peak
                {
                    Index = i,
                    Left = i == 1 ? 0 : fraction[i - 1],
                    Right = fraction[i],
                    Name = nots[i].Label,
                    MSpike = false
                };
                int percent = i > 5 ? 0 : GlobalConfigVars.BaseLinePercent[i];
                correctedCurve.SetFraction(i, p.Right, percent);
                this.Peaks.Add(p);
            }
            if (this.Peaks.Count > 0)
            {
                //计算总值[]
                double total = correctedCurve.GetFractionTotal();
                double albumin = 0;
                double others = 0;
                foreach (var peak in this.Peaks)
                {
                    int start = peak.Left;
                    int end = peak.Right;
                    if (peak.Index == 1)
                    {
                        //albumin[]
                        double currFra = correctedCurve.GetFractionTotal(start, end);
                        peak.Percent = currFra / total;
                        albumin = currFra;
                    }
                    else
                    {
                        //other(]
                        double currFra = correctedCurve.GetFractionTotal(start + 1, end);
                        peak.Percent = currFra / total;
                        others += currFra;
                    }

                    if (peak.MSpike)
                    {
                        //m-spike()
                        double currSpike = correctedCurve.GetFractionTotal(start + 1, end - 1);
                        peak.Percent = currSpike / total;
                    }
                }

                this.AG = albumin / others;
            }
        }
Exemple #2
0
        /// <summary>
        /// 根据分段点位置计算各分区的比重
        /// </summary>
        private void CalculateFraction()
        {
            BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve {
                Raw = m_cv1
            };

            correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]);
            if (m_fra != null && m_fra.PointCount > 0)
            {
                int i = 1;
                foreach (int currPos in m_fra)
                {
                    correctedCurve.SetFraction(i, currPos, GlobalConfigVars.BaseLinePercent[i]);
                    i++;
                }

                m_fractions = new List <double>();
                //初始值为曲线的第一个点
                int prevPos = 0;
                //计算总值[]
                double total = correctedCurve.GetFractionTotal();
                i = 0;
                foreach (int currPos in m_fra)
                {
                    if (i == 0)
                    {
                        //albumin[]
                        double currFra = correctedCurve.GetFractionTotal(prevPos, currPos);
                        m_fractions.Add(currFra / total);
                    }
                    else
                    {
                        //other(]
                        double currFra = correctedCurve.GetFractionTotal(prevPos + 1, currPos);
                        m_fractions.Add(currFra / total);
                    }
                    prevPos = currPos;
                }

                if (m_spike != null)
                {
                    m_spikes = new List <KeyValuePair <string, double> >();
                    foreach (Block blk in m_spike)
                    {
                        string currSpikeName = GetProteinName(blk.FractionIndex);
                        //m-spike()
                        double currSpike = correctedCurve.GetFractionTotal(blk.StartIndex + 1, blk.EndIndex - 1);
                        m_spikes.Add(new KeyValuePair <string, double>(currSpikeName, currSpike / total));
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 根据分段点位置计算各分区的比重
        /// </summary>
        private void CalculateFraction()
        {
            BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve { Raw = m_cv1 };
            correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]);
            if (m_fra != null && m_fra.PointCount > 0)
            {
                int i = 1;
                foreach (int currPos in m_fra)
                {
                    correctedCurve.SetFraction(i, currPos, GlobalConfigVars.BaseLinePercent[i]);
                    i++;
                }

                m_fractions = new List<double>();
                //初始值为曲线的第一个点
                int prevPos = 0;
                //计算总值[]
                double total = correctedCurve.GetFractionTotal();
                i = 0;
                foreach (int currPos in m_fra)
                {
                    if (i == 0)
                    {
                        //albumin[]
                        double currFra = correctedCurve.GetFractionTotal(prevPos, currPos);
                        m_fractions.Add(currFra / total);
                    }
                    else
                    {
                        //other(]
                        double currFra = correctedCurve.GetFractionTotal(prevPos + 1, currPos);
                        m_fractions.Add(currFra / total);
                    }
                    prevPos = currPos;
                }

                if (m_spike != null)
                {
                    m_spikes = new List<KeyValuePair<string, double>>();
                    foreach (Block blk in m_spike)
                    {
                        string currSpikeName = GetProteinName(blk.FractionIndex);
                        //m-spike()
                        double currSpike = correctedCurve.GetFractionTotal(blk.StartIndex + 1, blk.EndIndex - 1);
                        m_spikes.Add(new KeyValuePair<string, double>(currSpikeName, currSpike / total));
                    }
                }
            }
        }
Exemple #4
0
        public Qs2000Result(List <short> data, List <short> fraction, List <Fraction> nots)
        {
            RawCurve c = new RawCurve(data.Select(i => (int)i).ToList());
            BaseLineCorrectedCurve correctedCurve = new BaseLineCorrectedCurve {
                Raw = c
            };

            this.NumPoint = data.Count;
            this.Points   = c.ToString();
            this.Peaks    = new List <Peak>();
            int fracCount = fraction[0];

            correctedCurve.SetFraction(0, 0, GlobalConfigVars.BaseLinePercent[0]);
            for (int i = 1; i <= fracCount; i++)
            {
                Peak p = new Peak
                {
                    Index  = i,
                    Left   = i == 1 ? 0 : fraction[i - 1],
                    Right  = fraction[i],
                    Name   = nots[i].Label,
                    MSpike = false
                };
                int percent = i > 5 ? 0 : GlobalConfigVars.BaseLinePercent[i];
                correctedCurve.SetFraction(i, p.Right, percent);
                this.Peaks.Add(p);
            }
            if (this.Peaks.Count > 0)
            {
                //计算总值[]
                double total   = correctedCurve.GetFractionTotal();
                double albumin = 0;
                double others  = 0;
                foreach (var peak in this.Peaks)
                {
                    int start = peak.Left;
                    int end   = peak.Right;
                    if (peak.Index == 1)
                    {
                        //albumin[]
                        double currFra = correctedCurve.GetFractionTotal(start, end);
                        peak.Percent = currFra / total;
                        albumin      = currFra;
                    }
                    else
                    {
                        //other(]
                        double currFra = correctedCurve.GetFractionTotal(start + 1, end);
                        peak.Percent = currFra / total;
                        others      += currFra;
                    }

                    if (peak.MSpike)
                    {
                        //m-spike()
                        double currSpike = correctedCurve.GetFractionTotal(start + 1, end - 1);
                        peak.Percent = currSpike / total;
                    }
                }

                this.AG = albumin / others;
            }
        }