Esempio n. 1
0
        public ProductMassesMightHave ProductMassesMightHaveDuplicatesAndNaNs(List <ProductType> productTypes)
        {
            int  massLen       = 0;
            bool containsAdot  = productTypes.Contains(ProductType.Adot);
            bool containsB     = productTypes.Contains(ProductType.B);
            bool containsBnoB1 = productTypes.Contains(ProductType.BnoB1ions);
            bool containsC     = productTypes.Contains(ProductType.C);
            bool containsX     = productTypes.Contains(ProductType.X);
            bool containsY     = productTypes.Contains(ProductType.Y);
            bool containsZdot  = productTypes.Contains(ProductType.Zdot);

            if (containsAdot)
            {
                throw new NotImplementedException();
            }
            if (containsBnoB1)
            {
                massLen += compactPeptide.NTerminalMasses.Length - 1;
            }
            if (containsB)
            {
                massLen += compactPeptide.NTerminalMasses.Length;
            }
            if (containsC)
            {
                massLen += compactPeptide.NTerminalMasses.Length;
            }
            if (containsX)
            {
                throw new NotImplementedException();
            }
            if (containsY)
            {
                massLen += compactPeptide.CTerminalMasses.Length;
            }
            if (containsZdot)
            {
                massLen += compactPeptide.CTerminalMasses.Length;
            }

            ProductMassesMightHave productMassMightHave = new ProductMassesMightHave(massLen);
            int i  = 0;
            int ib = 0;
            int ic = 0;

            for (int j = 0; j < compactPeptide.NTerminalMasses.Length; j++)
            {
                var hm = compactPeptide.NTerminalMasses[j];
                if (containsBnoB1)
                {
                    if (j > 0)
                    {
                        productMassMightHave.ProductMz[i]   = hm;
                        productMassMightHave.ProductName[i] = "b" + (ib + 2).ToString();
                        i++;
                        ib++;
                    }
                }
                if (containsB)
                {
                    productMassMightHave.ProductMz[i]   = hm;
                    productMassMightHave.ProductName[i] = "b" + (ib + 1).ToString();
                    i++;
                    ib++;
                }
                if (containsC)
                {
                    productMassMightHave.ProductMz[i]   = hm + nitrogenAtomMonoisotopicMass + 3 * hydrogenAtomMonoisotopicMass;
                    productMassMightHave.ProductName[i] = "c" + (ic + 1).ToString();
                    i++;
                    ic++;
                }
            }
            int iy = compactPeptide.CTerminalMasses.Length - 1;
            int iz = compactPeptide.CTerminalMasses.Length - 1;

            for (int j = 0; j < compactPeptide.CTerminalMasses.Length; j++)
            {
                var hm = compactPeptide.CTerminalMasses[j];
                if (containsY)
                {
                    productMassMightHave.ProductMz[i]   = hm + waterMonoisotopicMass;
                    productMassMightHave.ProductName[i] = "y" + (compactPeptide.CTerminalMasses.Length - iy).ToString();
                    i++;
                    iy--;
                }
                if (containsZdot)
                {
                    productMassMightHave.ProductMz[i]   = hm + oxygenAtomMonoisotopicMass - nitrogenAtomMonoisotopicMass;
                    productMassMightHave.ProductName[i] = "z" + (compactPeptide.CTerminalMasses.Length - iz).ToString();
                    i++;
                    iz--;
                }
            }
            return(productMassMightHave);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }