Пример #1
0
        //Calculate All possible Products Masses based on ModMass and linkPos
        public static List <ProductMassesMightHave> XlCalculateTotalProductMasses(PsmCross psmCross, double modMass,
                                                                                  CrosslinkerTypeClass crosslinker, List <ProductType> lp, bool Charge_2_3, bool Charge_2_3_PrimeFragment, List <int> linkPos)
        {
            int length = psmCross.compactPeptide.NTerminalMasses.Length;
            var pmmh   = psmCross.ProductMassesMightHaveDuplicatesAndNaNs(lp);
            ProductMassesMightHave pmmhTop = new ProductMassesMightHave();

            List <ProductMassesMightHave> pmmhList = new List <ProductMassesMightHave>();

            foreach (var ipos in linkPos)
            {
                var pmmhCurr = new ProductMassesMightHave();
                pmmhCurr.XlPos = ipos;
                List <double> x = new List <double>();
                List <string> y = new List <string>();
                if (crosslinker.Cleavable)
                {
                    x.Add((double)psmCross.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.CleaveMassShort);
                    y.Add("PepS");
                    x.Add(((double)psmCross.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.CleaveMassShort) / 2);
                    y.Add("PepS2");
                    x.Add((double)psmCross.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.CleaveMassLong);
                    y.Add("PepL");
                    x.Add(((double)psmCross.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.CleaveMassLong) / 2);
                    y.Add("PepL2");
                }
                for (int i = 0; i < pmmh.ProductMz.Length; i++)
                {
                    var cr = pmmh.ProductName[i][0];
                    //get the position of amino acid
                    var nm = Int32.Parse(System.Text.RegularExpressions.Regex.Match(pmmh.ProductName[i], @"\d+").Value);
                    if ((cr == 'b' || cr == 'c') && nm < ipos + 1)
                    {
                        x.Add(pmmh.ProductMz[i]);
                        y.Add(pmmh.ProductName[i]);
                        if (Charge_2_3_PrimeFragment && cr == 'b')
                        {
                            x.Add(pmmh.ProductMz[i] / 2);
                            y.Add("t2b" + nm.ToString());
                            x.Add(pmmh.ProductMz[i] / 3);
                            y.Add("t3b" + nm.ToString());
                        }
                        if (Charge_2_3_PrimeFragment && cr == 'c')
                        {
                            x.Add(pmmh.ProductMz[i] / 2);
                            y.Add("t2c" + nm.ToString());
                            x.Add(pmmh.ProductMz[i] / 3);
                            y.Add("t3c" + nm.ToString());
                        }
                    }
                    if ((cr == 'y' || cr == 'z') && nm < length - ipos + 1)
                    {
                        x.Add(pmmh.ProductMz[i]);
                        y.Add(pmmh.ProductName[i]);
                        if (Charge_2_3_PrimeFragment && cr == 'y')
                        {
                            x.Add(pmmh.ProductMz[i] / 2);
                            y.Add("t2y" + nm.ToString());
                            x.Add(pmmh.ProductMz[i] / 3);
                            y.Add("t3y" + nm.ToString());
                        }
                        if (Charge_2_3_PrimeFragment && cr == 'z')
                        {
                            x.Add(pmmh.ProductMz[i] / 2);
                            y.Add("t2z" + nm.ToString());
                            x.Add(pmmh.ProductMz[i] / 3);
                            y.Add("t3z" + nm.ToString());
                        }
                    }
                    if (cr == 'b' && nm >= ipos + 1)
                    {
                        x.Add(pmmh.ProductMz[i] + modMass);
                        y.Add("t1b" + nm.ToString());
                        if (Charge_2_3)
                        {
                            x.Add((pmmh.ProductMz[i] + modMass) / 2);
                            y.Add("t2b" + nm.ToString());
                            x.Add((pmmh.ProductMz[i] + modMass) / 3);
                            y.Add("t3b" + nm.ToString());
                        }
                        if (crosslinker.Cleavable)
                        {
                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassShort);
                            y.Add("sb" + nm.ToString());

                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassLong);
                            y.Add("lb" + nm.ToString());
                        }
                    }

                    if (cr == 'c' && nm >= ipos + 1)
                    {
                        x.Add(pmmh.ProductMz[i] + modMass);
                        y.Add("t1c" + nm.ToString());
                        if (Charge_2_3)
                        {
                            x.Add((pmmh.ProductMz[i] + modMass) / 2);
                            y.Add("t2c" + nm.ToString());
                            x.Add((pmmh.ProductMz[i] + modMass) / 3);
                            y.Add("t3c" + nm.ToString());
                        }

                        if (crosslinker.Cleavable)
                        {
                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassShort);
                            y.Add("sc" + nm.ToString());

                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassLong);
                            y.Add("lc" + nm.ToString());
                        }
                    }

                    if (cr == 'y' && (nm >= length - ipos + 1))
                    {
                        x.Add(pmmh.ProductMz[i] + modMass);
                        y.Add("t1y" + nm.ToString());

                        if (Charge_2_3)
                        {
                            x.Add((pmmh.ProductMz[i] + modMass) / 2);
                            y.Add("t2y" + nm.ToString());
                            x.Add((pmmh.ProductMz[i] + modMass) / 3);
                            y.Add("t3y" + nm.ToString());
                        }
                        if (crosslinker.Cleavable)
                        {
                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassShort);
                            y.Add("sy" + nm.ToString());

                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassLong);
                            y.Add("ly" + nm.ToString());
                        }
                    }

                    if (cr == 'z' && (nm >= length - ipos + 1))
                    {
                        x.Add(pmmh.ProductMz[i] + modMass);
                        y.Add("t1z" + nm.ToString());
                        if (Charge_2_3)
                        {
                            x.Add((pmmh.ProductMz[i] + modMass) / 2);
                            y.Add("t2z" + nm.ToString());
                            x.Add((pmmh.ProductMz[i] + modMass) / 3);
                            y.Add("t3z" + nm.ToString());
                        }
                        if (crosslinker.Cleavable)
                        {
                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassShort);
                            y.Add("sz" + nm.ToString());

                            x.Add(pmmh.ProductMz[i] + crosslinker.CleaveMassLong);
                            y.Add("lz" + nm.ToString());
                        }
                    }
                }
                pmmhCurr.ProductMz   = x.ToArray();
                pmmhCurr.ProductName = y.ToArray();
                Array.Sort(pmmhCurr.ProductMz, pmmhCurr.ProductName);
                pmmhList.Add(pmmhCurr);
            }

            return(pmmhList);
        }
Пример #2
0
        //Calculate All possible Products Masses based on ModMass and linkPos
        public static List <ProductMassesMightHave> XlCalculateTotalProductMassesForLoopCrosslink(PsmCross psmCross, double modMass, CrosslinkerTypeClass crosslinker, List <ProductType> lp, List <int> linkPos)
        {
            int length = psmCross.compactPeptide.NTerminalMasses.Length;
            var pmmh   = psmCross.ProductMassesMightHaveDuplicatesAndNaNs(lp);
            ProductMassesMightHave pmmhTop = new ProductMassesMightHave();

            List <ProductMassesMightHave> pmmhList = new List <ProductMassesMightHave>();

            if (linkPos.Count() >= 2)
            {
                for (int ipos = 0; ipos < linkPos.Count() - 1; ipos++)
                {
                    for (int jpos = ipos + 1; jpos < linkPos.Count(); jpos++)
                    {
                        var pmmhCurr = new ProductMassesMightHave();
                        pmmhCurr.XlPos  = linkPos[ipos];
                        pmmhCurr.XlPos2 = linkPos[jpos];
                        List <double> x = new List <double>();
                        List <string> y = new List <string>();

                        for (int i = 0; i < pmmh.ProductMz.Length; i++)
                        {
                            var cr = pmmh.ProductName[i][0];
                            //get the position of amino acid
                            var nm = Int32.Parse(System.Text.RegularExpressions.Regex.Match(pmmh.ProductName[i], @"\d+").Value);
                            if ((cr == 'b' || cr == 'c') && nm < linkPos[ipos] + 1)
                            {
                                x.Add(pmmh.ProductMz[i]);
                                y.Add(pmmh.ProductName[i]);
                            }
                            if ((cr == 'y' || cr == 'z') && nm < length - linkPos[jpos] + 1)
                            {
                                x.Add(pmmh.ProductMz[i]);
                                y.Add(pmmh.ProductName[i]);
                            }
                            if (cr == 'b' && nm >= linkPos[jpos] + 1)
                            {
                                x.Add(pmmh.ProductMz[i] + modMass);
                                y.Add("t1b" + nm.ToString());
                            }

                            if (cr == 'c' && nm >= linkPos[jpos] + 1)
                            {
                                x.Add(pmmh.ProductMz[i] + modMass);
                                y.Add("t1c" + nm.ToString());
                            }

                            if (cr == 'y' && (nm >= length - linkPos[ipos] + 1))
                            {
                                x.Add(pmmh.ProductMz[i] + modMass);
                                y.Add("t1y" + nm.ToString());
                            }

                            if (cr == 'z' && (nm >= length - linkPos[ipos] + 1))
                            {
                                x.Add(pmmh.ProductMz[i] + modMass);
                                y.Add("t1z" + nm.ToString());
                            }
                        }
                        pmmhCurr.ProductMz   = x.ToArray();
                        pmmhCurr.ProductName = y.ToArray();
                        Array.Sort(pmmhCurr.ProductMz, pmmhCurr.ProductName);
                        pmmhList.Add(pmmhCurr);
                    }
                }
            }
            return(pmmhList);
        }
Пример #3
0
        //Calculate All possible Products Masses based on ModMass and linkPos
        public static ProductMassesMightHave XlCalculateTotalProductMassesForSingle(PsmCross psmCross, List <ProductType> lp, bool Charge_2_3_PrimeFragment)
        {
            int length = psmCross.compactPeptide.NTerminalMasses.Length;
            var pmmh   = psmCross.ProductMassesMightHaveDuplicatesAndNaNs(lp);

            var pmmhCurr = new ProductMassesMightHave();

            List <double> x = new List <double>();
            List <string> y = new List <string>();

            for (int i = 0; i < pmmh.ProductMz.Length; i++)
            {
                var cr = pmmh.ProductName[i][0];
                //get the position of amino acid
                var nm = Int32.Parse(System.Text.RegularExpressions.Regex.Match(pmmh.ProductName[i], @"\d+").Value);
                if ((cr == 'b' || cr == 'c') && nm <= length + 1)
                {
                    x.Add(pmmh.ProductMz[i]);
                    y.Add(pmmh.ProductName[i]);
                    if (Charge_2_3_PrimeFragment && cr == 'b')
                    {
                        x.Add(pmmh.ProductMz[i] / 2);
                        y.Add("t2b" + nm.ToString());
                        x.Add(pmmh.ProductMz[i] / 3);
                        y.Add("t3b" + nm.ToString());
                    }
                    if (Charge_2_3_PrimeFragment && cr == 'c')
                    {
                        x.Add(pmmh.ProductMz[i] / 2);
                        y.Add("t2c" + nm.ToString());
                        x.Add(pmmh.ProductMz[i] / 3);
                        y.Add("t3c" + nm.ToString());
                    }
                }
                if ((cr == 'y' || cr == 'z') && nm <= length + 1)
                {
                    x.Add(pmmh.ProductMz[i]);
                    y.Add(pmmh.ProductName[i]);
                    if (Charge_2_3_PrimeFragment && cr == 'y')
                    {
                        x.Add(pmmh.ProductMz[i] / 2);
                        y.Add("t2y" + nm.ToString());
                        x.Add(pmmh.ProductMz[i] / 3);
                        y.Add("t3y" + nm.ToString());
                    }
                    if (Charge_2_3_PrimeFragment && cr == 'z')
                    {
                        x.Add(pmmh.ProductMz[i] / 2);
                        y.Add("t2z" + nm.ToString());
                        x.Add(pmmh.ProductMz[i] / 3);
                        y.Add("t3z" + nm.ToString());
                    }
                }
            }
            pmmhCurr.ProductMz   = x.ToArray();
            pmmhCurr.ProductName = y.ToArray();

            Array.Sort(pmmhCurr.ProductMz, pmmhCurr.ProductName);


            return(pmmhCurr);
        }