Exemple #1
0
 private bool IsMatch(float value, ArrayList values)
 {
     foreach (object v in values)
     {
         if (Math.Abs(((mzint)v).mz - value) < MaxDiff)
         {
             mzint newv = new mzint();
             newv.mz                   = ((mzint)v).mz;
             newv.intensity            = ((mzint)v).intensity;
             newv.bMatched             = true;
             values[values.IndexOf(v)] = newv;
             return(true);
         }
     }
     return(false);
 }
    private bool IsMatch(float value, ArrayList values)
    {
        bool result = false;

        for (int i = 0; i < values.Count; i++)
        {
            if (Math.Abs(((mzint)values[i]).mz - value) < MaxDiff)
            {
                mzint newv = new mzint();
                newv.mz        = ((mzint)values[i]).mz;
                newv.intensity = ((mzint)values[i]).intensity;
                newv.bMatched  = true;
                values[i]      = newv;
                result         = true;
            }
        }
        return(result);
    }
Exemple #3
0
    private void ShowTheoryValues(string PepSeq)
    {
        //PepSeq = ValidePepSeq(PepSeq);
        if (dtaSpectra != "")
        {
            string[] lines = dtaSpectra.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string line in lines)
            {
                if (char.IsDigit(line, 0))
                {
                    string[]     tokens    = line.Split(new string[] { " ", "\t" }, StringSplitOptions.RemoveEmptyEntries);
                    string       mz        = tokens[0];
                    string       intensity = tokens[1];// line.Substring(sperator);
                    SpectrumData s         = new SpectrumData(float.Parse(tokens[0]), float.Parse(tokens[1]));
                    sd.Add(s);
                    mzint mzi = new mzint();
                    mzi.mz        = float.Parse(mz);
                    mzi.intensity = float.Parse(intensity);
                    mzi.bMatched  = false;
                    MZS.Add(mzi);
                }
            }
            bFileReaded = true;
        }

        string    modifiedSeq = PepSeq;
        PeptideMW PMW         = new PeptideMW(PepSeq);

        float[] Bs = PMW.GetPepFragmentBValues();
        float[] Ys = PMW.GetPepFragmentYValues();

        PepSeq = ValidePepSeq(PepSeq);
        int Length = PepSeq.Length;

        for (int i = 0; i <= Length - 1; i++)
        {
            TableRow  trValues = new TableRow();
            TableCell tcAA     = new TableCell();
            TableCell tcYA     = new TableCell();

            float ModifiedWeight = 0.0F;


            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
            {
                tcAA.Text = string.Format("{0}<sub>{1}</sub>+{2:F2}", PepSeq.Substring(i, 1), i + 1, ModifiedWeight);
            }
            else
            {
                tcAA.Text = string.Format("{0}<sub>{1}</sub>", PepSeq.Substring(i, 1), i + 1);
            }

            tcAA.HorizontalAlign = HorizontalAlign.Left;
            trValues.Cells.Add(tcAA);

            /* B format */
            float B1;
            if (i > (Length - 2))
            {
                B1 = Bs[0];
            }
            else
            {
                B1 = Bs[i];
            }
            if (i < Length - 1)
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = string.Format("{0:F2}", B1);
                if (IsMatch(B1, MZS))
                {
                    tcB1.ForeColor = B1Color;
                }
                console.Text        += "";
                tcB1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = string.Format("{0:F2}", (B1 - OH));
                if (IsMatch(B1 - OH, MZS))
                {
                    tcB2.ForeColor = B2Color;
                }
                tcB2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = string.Format("{0:F2}", (B1 - H2O));
                if (IsMatch(B1 - H2O, MZS))
                {
                    tcB3.ForeColor = B3Color;
                }
                tcB3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB3);

                float     B2   = (B1 + 1) / 2;
                TableCell tc2B = new TableCell();
                tc2B.Text = string.Format("{0:F2}", B2);
                if (IsMatch(B2, MZS))
                {
                    tc2B.ForeColor = B1Color;
                }
                tc2B.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }
            else
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = "";
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = "";
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = "";
                trValues.Cells.Add(tcB3);

                TableCell tc2B = new TableCell();
                tc2B.Text = "";
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }

            /* Y format */

            float Y1;
            if (i > (Length - 2) || i == 0)
            {
                Y1 = Ys[0];
            }
            else
            {
                Y1 = Ys[Length - 1 - i];
            }
            if (i != 0)
            {
                float     Y2   = (Y1 + 1) / 2;
                TableCell tc2Y = new TableCell();
                tc2Y.Text = string.Format("{0:F2}", Y2);
                if (IsMatch(Y2, MZS))
                {
                    tc2Y.ForeColor = Y1Color;
                }
                tc2Y.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2Y);

                TableCell tcY3 = new TableCell();
                tcY3.Text = string.Format("{0:F2}", (Y1 - H2O));
                if (IsMatch(Y1 - H2O, MZS))
                {
                    tcY3.ForeColor = Y3Color;
                }
                tcY3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY3);

                TableCell tcY2 = new TableCell();
                tcY2.Text = string.Format("{0:F2}", (Y1 - OH));
                if (IsMatch(Y1 - OH, MZS))
                {
                    tcY2.ForeColor = Y2Color;
                }
                tcY2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY2);

                TableCell tcY1 = new TableCell();
                tcY1.Text = string.Format("{0:F2}", Y1);
                if (IsMatch(Y1, MZS))
                {
                    tcY1.ForeColor = Y1Color;
                }
                tcY1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY1);
            }
            else
            {
                TableCell tcY1 = new TableCell();
                tcY1.Text = "";
                trValues.Cells.Add(tcY1);
                TableCell tcY2 = new TableCell();
                tcY2.Text = "";
                trValues.Cells.Add(tcY2);
                TableCell tcY3 = new TableCell();
                tcY3.Text = "";
                trValues.Cells.Add(tcY3);
                TableCell tc2Y = new TableCell();
                tc2Y.Text = "";
                trValues.Cells.Add(tc2Y);
            }
            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
            {
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub>+{2:F2}</span></div>", PepSeq.Substring(i, 1), Length - i, ModifiedWeight);
            }
            else
            {
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub></span></div>", PepSeq.Substring(i, 1), Length - i);
            }

            tcYA.HorizontalAlign = HorizontalAlign.Right;
            trValues.Cells.Add(tcYA);

            tbTheoryValues.Rows.Add(trValues);
        }
    }
    private void ShowTheoryValues(string PepSeq)
    {
        //PepSeq = ValidePepSeq(PepSeq);

        if (!bFileReaded)
        {
            if (SearchType == "DTA")
            {
                if (GuestSpectrums == "")
                {
                    GuestSpectrums = (string)(Session[SessionID]);
                }
                dtaconent = GuestSpectrums;
                string[] lines = GuestSpectrums.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string line in lines)
                {
                    if (char.IsDigit(line, 0))
                    {
                        int    sperator  = line.IndexOf(" ");
                        string mz        = line.Substring(0, sperator);
                        string intensity = line.Substring(sperator);
                        mzint  mzi       = new mzint();
                        mzi.mz        = float.Parse(mz);
                        mzi.intensity = float.Parse(intensity);
                        mzi.bMatched  = false;
                        MZS.Add(mzi);
                    }
                }
            }
            else
            {
                string TaskID = Request.QueryString["TaskID"];

                string   dtaFilePath = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + TaskID + string.Format("\\{0}_dta\\", MSFile) + SessionID + ".dta";
                FileInfo fiDta       = new FileInfo(dtaFilePath);
                if (!fiDta.Exists)
                {
                    Response.Redirect("ErrorPage.aspx?Err=1");
                    return;
                }
                dtaconent = "";
                // get from the generated dta file
                FileStream   gfs = File.Open(dtaFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                StreamReader gsr = new StreamReader(gfs);

                string line;
                while ((line = gsr.ReadLine()) != null)
                {
                    if (char.IsDigit(line, 0))
                    {
                        int    sperator  = line.IndexOf(" ");
                        string mz        = line.Substring(0, sperator);
                        string intensity = line.Substring(sperator);
                        mzint  mzi       = new mzint();
                        mzi.mz        = float.Parse(mz);
                        mzi.intensity = float.Parse(intensity);
                        mzi.bMatched  = false;
                        MZS.Add(mzi);
                    }
                    dtaconent += line + "\r\n";
                }
                gsr.Close();
            }
            bFileReaded = true;
        }
        string    modifiedSeq = PepSeq;
        PeptideMW PMW         = new PeptideMW(PepSeq);

        float[] Bs = PMW.GetPepFragmentBValues();
        float[] Ys = PMW.GetPepFragmentYValues();

        PepSeq = ValidePepSeq(PepSeq);
        int Length = PepSeq.Length;

        // started here! 123,456,,789
        for (int i = 0; i <= Length - 1; i++)
        {
            TableRow  trValues = new TableRow();
            TableCell tcAA     = new TableCell();
            TableCell tcYA     = new TableCell();

            float ModifiedWeight = 0.0F;


            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
            {
                tcAA.Text = string.Format("{0}<sub>{1}</sub>+{2:F2}", PepSeq.Substring(i, 1), i + 1, ModifiedWeight);
            }
            else
            {
                tcAA.Text = string.Format("{0}<sub>{1}</sub>", PepSeq.Substring(i, 1), i + 1);
            }

            tcAA.HorizontalAlign = HorizontalAlign.Left;
            trValues.Cells.Add(tcAA);

            /* B format */
            float B1;
            if (i > (Length - 2))
            {
                B1 = Bs[0];
            }
            else
            {
                B1 = Bs[i];
            }
            if (i < Length - 1)
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = string.Format("{0:F2}", B1);
                if (IsMatch(B1, MZS))
                {
                    tcB1.ForeColor = B1Color;
                }
                tcB1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = string.Format("{0:F2}", (B1 - OH));
                if (IsMatch(B1 - OH, MZS))
                {
                    tcB2.ForeColor = B2Color;
                }
                tcB2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = string.Format("{0:F2}", (B1 - H2O));
                if (IsMatch(B1 - H2O, MZS))
                {
                    tcB3.ForeColor = B3Color;
                }
                tcB3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB3);

                float     B2   = (B1 + 1) / 2;
                TableCell tc2B = new TableCell();
                tc2B.Text = string.Format("{0:F2}", B2);
                if (IsMatch(B2, MZS))
                {
                    tc2B.ForeColor = B1Color;
                }
                tc2B.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }
            else
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = "";
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = "";
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = "";
                trValues.Cells.Add(tcB3);

                TableCell tc2B = new TableCell();
                tc2B.Text = "";
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }

            /* Y format */

            float Y1;
            if (i > (Length - 2) || i == 0)
            {
                Y1 = Ys[0];
            }
            else
            {
                Y1 = Ys[Length - 1 - i];
            }
            if (i != 0)
            {
                float     Y2   = (Y1 + 1) / 2;
                TableCell tc2Y = new TableCell();
                tc2Y.Text = string.Format("{0:F2}", Y2);
                if (IsMatch(Y2, MZS))
                {
                    tc2Y.ForeColor = Y1Color;
                }
                tc2Y.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2Y);

                TableCell tcY3 = new TableCell();
                tcY3.Text = string.Format("{0:F2}", (Y1 - H2O));
                if (IsMatch(Y1 - H2O, MZS))
                {
                    tcY3.ForeColor = Y3Color;
                }
                tcY3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY3);

                TableCell tcY2 = new TableCell();
                tcY2.Text = string.Format("{0:F2}", (Y1 - OH));
                if (IsMatch(Y1 - OH, MZS))
                {
                    tcY2.ForeColor = Y2Color;
                }
                tcY2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY2);

                TableCell tcY1 = new TableCell();
                tcY1.Text = string.Format("{0:F2}", Y1);
                if (IsMatch(Y1, MZS))
                {
                    tcY1.ForeColor = Y1Color;
                }
                tcY1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY1);
            }
            else
            {
                TableCell tcY1 = new TableCell();
                tcY1.Text = "";
                trValues.Cells.Add(tcY1);
                TableCell tcY2 = new TableCell();
                tcY2.Text = "";
                trValues.Cells.Add(tcY2);
                TableCell tcY3 = new TableCell();
                tcY3.Text = "";
                trValues.Cells.Add(tcY3);
                TableCell tc2Y = new TableCell();
                tc2Y.Text = "";
                trValues.Cells.Add(tc2Y);
            }
            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
            {
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub>+{2:F2}</span></div>", PepSeq.Substring(i, 1), Length - i, ModifiedWeight);
            }
            else
            {
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub></span></div>", PepSeq.Substring(i, 1), Length - i);
            }

            tcYA.HorizontalAlign = HorizontalAlign.Right;
            trValues.Cells.Add(tcYA);

            tbTheoryValues.Rows.Add(trValues);
        }
    }
    private void ShowTheoryValues(string PepSeq)
    {
        //PepSeq = ValidePepSeq(PepSeq);
        if (dtaSpectra != "")
        {
            string[] lines = dtaSpectra.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string line in lines)
            {
                if (char.IsDigit(line, 0))
                {
                    string[] tokens = line.Split(new string[] { " ", "\t" }, StringSplitOptions.RemoveEmptyEntries);
                    string mz = tokens[0];
                    string intensity = tokens[1];// line.Substring(sperator);
                    SpectrumData s = new SpectrumData(float.Parse(tokens[0]), float.Parse(tokens[1]));
                    sd.Add(s);
                    mzint mzi = new mzint();
                    mzi.mz = float.Parse(mz);
                    mzi.intensity = float.Parse(intensity);
                    mzi.bMatched = false;
                    MZS.Add(mzi);
                }
            }
            bFileReaded = true;
        }

        string modifiedSeq = PepSeq;
        PeptideMW PMW = new PeptideMW(PepSeq);
        float[] Bs = PMW.GetPepFragmentBValues();
        float[] Ys = PMW.GetPepFragmentYValues();

        PepSeq = ValidePepSeq(PepSeq);
        int Length = PepSeq.Length;
        for (int i = 0; i <= Length - 1; i++)
        {
            TableRow trValues = new TableRow();
            TableCell tcAA = new TableCell();
            TableCell tcYA = new TableCell();

            float ModifiedWeight = 0.0F;

            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
                tcAA.Text = string.Format("{0}<sub>{1}</sub>+{2:F2}", PepSeq.Substring(i, 1), i + 1, ModifiedWeight);
            else
                tcAA.Text = string.Format("{0}<sub>{1}</sub>", PepSeq.Substring(i, 1), i + 1);

            tcAA.HorizontalAlign = HorizontalAlign.Left;
            trValues.Cells.Add(tcAA);

            /* B format */
            float B1;
            if (i > (Length - 2))
                B1 = Bs[0];
            else
                B1 = Bs[i];
            if (i < Length - 1)
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = string.Format("{0:F2}", B1);
                if (IsMatch(B1, MZS))
                    tcB1.ForeColor = B1Color;
                console.Text += "";
                tcB1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = string.Format("{0:F2}", (B1 - OH));
                if (IsMatch(B1 - OH, MZS))
                    tcB2.ForeColor = B2Color;
                tcB2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = string.Format("{0:F2}", (B1 - H2O));
                if (IsMatch(B1 - H2O, MZS))
                    tcB3.ForeColor = B3Color;
                tcB3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB3);

                float B2 = (B1 + 1) / 2;
                TableCell tc2B = new TableCell();
                tc2B.Text = string.Format("{0:F2}", B2);
                if (IsMatch(B2, MZS))
                    tc2B.ForeColor = B1Color;
                tc2B.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }
            else
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = "";
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = "";
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = "";
                trValues.Cells.Add(tcB3);

                TableCell tc2B = new TableCell();
                tc2B.Text = "";
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }

            /* Y format */

            float Y1;
            if (i > (Length - 2) || i == 0)
                Y1 = Ys[0];
            else
                Y1 = Ys[Length - 1 - i];
            if (i != 0)
            {
                float Y2 = (Y1 + 1) / 2;
                TableCell tc2Y = new TableCell();
                tc2Y.Text = string.Format("{0:F2}", Y2);
                if (IsMatch(Y2, MZS))
                    tc2Y.ForeColor = Y1Color;
                tc2Y.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2Y);

                TableCell tcY3 = new TableCell();
                tcY3.Text = string.Format("{0:F2}", (Y1 - H2O));
                if (IsMatch(Y1 - H2O, MZS))
                    tcY3.ForeColor = Y3Color;
                tcY3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY3);

                TableCell tcY2 = new TableCell();
                tcY2.Text = string.Format("{0:F2}", (Y1 - OH));
                if (IsMatch(Y1 - OH, MZS))
                    tcY2.ForeColor = Y2Color;
                tcY2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY2);

                TableCell tcY1 = new TableCell();
                tcY1.Text = string.Format("{0:F2}", Y1);
                if (IsMatch(Y1, MZS))
                    tcY1.ForeColor = Y1Color;
                tcY1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY1);
            }
            else
            {
                TableCell tcY1 = new TableCell();
                tcY1.Text = "";
                trValues.Cells.Add(tcY1);
                TableCell tcY2 = new TableCell();
                tcY2.Text = "";
                trValues.Cells.Add(tcY2);
                TableCell tcY3 = new TableCell();
                tcY3.Text = "";
                trValues.Cells.Add(tcY3);
                TableCell tc2Y = new TableCell();
                tc2Y.Text = "";
                trValues.Cells.Add(tc2Y);
            }
            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub>+{2:F2}</span></div>", PepSeq.Substring(i, 1), Length - i, ModifiedWeight);
            else
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub></span></div>", PepSeq.Substring(i, 1), Length - i);

            tcYA.HorizontalAlign = HorizontalAlign.Right;
            trValues.Cells.Add(tcYA);

            tbTheoryValues.Rows.Add(trValues);
        }
    }
    private bool IsMatch(float value, ArrayList values)
    {
        foreach (object v in values)
        {

            if (Math.Abs(((mzint)v).mz - value) < MaxDiff)
            {
                mzint newv = new mzint();
                newv.mz = ((mzint)v).mz;
                newv.intensity = ((mzint)v).intensity;
                newv.bMatched = true;
                values[values.IndexOf(v)] = newv;
                return true;

            }
        }
        return false;
    }
    private void ShowTheoryValues(string PepSeq)
    {
        //PepSeq = ValidePepSeq(PepSeq);

        if (!bFileReaded)
        {
            if (SearchType == "DTA")
            {
                if (GuestSpectrums == "")
                    GuestSpectrums = (string)(Session[SessionID]);
                dtaconent = GuestSpectrums;
                string[] lines = GuestSpectrums.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string line in lines)
                {
                    if (char.IsDigit(line, 0))
                    {
                        int sperator = line.IndexOf(" ");
                        string mz = line.Substring(0, sperator);
                        string intensity = line.Substring(sperator);
                        mzint mzi = new mzint();
                        mzi.mz = float.Parse(mz);
                        mzi.intensity = float.Parse(intensity);
                        mzi.bMatched = false;
                        MZS.Add(mzi);
                    }
                }
            }
            else
            {
                string TaskID = Request.QueryString["TaskID"];

                string dtaFilePath = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + TaskID + string.Format ("\\{0}_dta\\",MSFile ) + SessionID + ".dta";
                FileInfo fiDta = new FileInfo(dtaFilePath);
                if (!fiDta.Exists)
                {
                    Response.Redirect("ErrorPage.aspx?Err=1");
                    return;
                }
                dtaconent = "";
                // get from the generated dta file
                FileStream gfs = File.Open(dtaFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
                StreamReader gsr = new StreamReader(gfs);

                string line;
                while ((line = gsr.ReadLine()) != null)
                {
                    if (char.IsDigit(line, 0))
                    {
                        int sperator = line.IndexOf(" ");
                        string mz = line.Substring(0, sperator);
                        string intensity = line.Substring(sperator);
                        mzint mzi = new mzint();
                        mzi.mz = float.Parse(mz);
                        mzi.intensity = float.Parse(intensity);
                        mzi.bMatched = false;
                        MZS.Add(mzi);
                    }
                    dtaconent += line +"\r\n";
                }
                gsr.Close();
            }
            bFileReaded = true;
        }
        string modifiedSeq = PepSeq;
        PeptideMW PMW = new PeptideMW(PepSeq);
        float[] Bs = PMW.GetPepFragmentBValues();
        float[] Ys = PMW.GetPepFragmentYValues();

        PepSeq = ValidePepSeq(PepSeq);
        int Length = PepSeq.Length;
        // started here! 123,456,,789
        for (int i = 0; i <= Length - 1; i++)
        {
            TableRow trValues = new TableRow();
            TableCell tcAA = new TableCell();
            TableCell tcYA = new TableCell();

            float ModifiedWeight = 0.0F;

            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
                tcAA.Text = string.Format("{0}<sub>{1}</sub>+{2:F2}", PepSeq.Substring(i, 1), i + 1, ModifiedWeight);
            else
                tcAA.Text = string.Format("{0}<sub>{1}</sub>", PepSeq.Substring(i, 1), i + 1);

            tcAA.HorizontalAlign = HorizontalAlign.Left;
            trValues.Cells.Add(tcAA);

            /* B format */
            float B1;
            if (i > (Length - 2))
                B1 = Bs[0];
            else
                B1 = Bs[i];
            if (i < Length - 1)
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = string.Format("{0:F2}", B1);
                if (IsMatch(B1, MZS))
                    tcB1.ForeColor = B1Color;
                tcB1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = string.Format("{0:F2}", (B1 - OH));
                if (IsMatch(B1 - OH, MZS))
                    tcB2.ForeColor = B2Color;
                tcB2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = string.Format("{0:F2}", (B1 - H2O));
                if (IsMatch(B1 - H2O, MZS))
                    tcB3.ForeColor = B3Color;
                tcB3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcB3);

                float B2 = (B1 + 1) / 2;
                TableCell tc2B = new TableCell();
                tc2B.Text = string.Format("{0:F2}", B2);
                if (IsMatch(B2, MZS))
                    tc2B.ForeColor = B1Color;
                tc2B.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }
            else
            {
                TableCell tcB1 = new TableCell();
                tcB1.Text = "";
                trValues.Cells.Add(tcB1);
                TableCell tcB2 = new TableCell();
                tcB2.Text = "";
                trValues.Cells.Add(tcB2);
                TableCell tcB3 = new TableCell();
                tcB3.Text = "";
                trValues.Cells.Add(tcB3);

                TableCell tc2B = new TableCell();
                tc2B.Text = "";
                trValues.Cells.Add(tc2B);
                trValues.Height = new Unit("20px");
            }

            /* Y format */

            float Y1;
            if (i > (Length - 2) || i == 0)
                Y1 = Ys[0];
            else
                Y1 = Ys[Length - 1 - i];
            if (i != 0)
            {
                float Y2 = (Y1 + 1) / 2;
                TableCell tc2Y = new TableCell();
                tc2Y.Text = string.Format("{0:F2}", Y2);
                if (IsMatch(Y2, MZS))
                    tc2Y.ForeColor = Y1Color;
                tc2Y.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tc2Y);

                TableCell tcY3 = new TableCell();
                tcY3.Text = string.Format("{0:F2}", (Y1 - H2O));
                if (IsMatch(Y1 - H2O, MZS))
                    tcY3.ForeColor = Y3Color;
                tcY3.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY3);

                TableCell tcY2 = new TableCell();
                tcY2.Text = string.Format("{0:F2}", (Y1 - OH));
                if (IsMatch(Y1 - OH, MZS))
                    tcY2.ForeColor = Y2Color;
                tcY2.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY2);

                TableCell tcY1 = new TableCell();
                tcY1.Text = string.Format("{0:F2}", Y1);
                if (IsMatch(Y1, MZS))
                    tcY1.ForeColor = Y1Color;
                tcY1.HorizontalAlign = HorizontalAlign.Right;
                trValues.Cells.Add(tcY1);
            }
            else
            {
                TableCell tcY1 = new TableCell();
                tcY1.Text = "";
                trValues.Cells.Add(tcY1);
                TableCell tcY2 = new TableCell();
                tcY2.Text = "";
                trValues.Cells.Add(tcY2);
                TableCell tcY3 = new TableCell();
                tcY3.Text = "";
                trValues.Cells.Add(tcY3);
                TableCell tc2Y = new TableCell();
                tc2Y.Text = "";
                trValues.Cells.Add(tc2Y);
            }
            if (HadModifed(i + 1, modifiedSeq, ref ModifiedWeight))
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub>+{2:F2}</span></div>", PepSeq.Substring(i, 1), Length - i, ModifiedWeight);
            else
                tcYA.Text = string.Format("<div class=\"offset9 span3\"><span class=\"pull-left\">{0}<sub>{1}</sub></span></div>", PepSeq.Substring(i, 1), Length - i);

            tcYA.HorizontalAlign = HorizontalAlign.Right;
            trValues.Cells.Add(tcYA);

            tbTheoryValues.Rows.Add(trValues);
        }
    }
    private bool IsMatch(float value, ArrayList values)
    {
        bool result = false;
        for (int i=0;i<values.Count ;i++)
        {

            if (Math.Abs(((mzint)values[i]).mz - value) < MaxDiff)
            {
                mzint newv = new mzint();
                newv.mz = ((mzint)values[i]).mz;
                newv.intensity = ((mzint)values[i]).intensity;
                newv.bMatched = true;
                values[i] = newv;
                result = true;

            }
        }
        return result;
    }