Beispiel #1
0
        //If XlSites is of same types
        private PsmCross XlSitesSame(Ms2ScanWithSpecificMass theScan, PsmCross psmCrossAlpha, PsmCross psmCrossBeta,
                                     CrosslinkerTypeClass crosslinker, int ind, int inx)
        {
            PsmCross psmCross   = null;
            var      xlPosAlpha = PsmCross.XlPosCal(psmCrossAlpha.compactPeptide, crosslinker.CrosslinkerModSites);
            var      xlPosBeta  = PsmCross.XlPosCal(psmCrossBeta.compactPeptide, crosslinker.CrosslinkerModSites);

            if (xlPosAlpha.Count() >= 1 && xlPosBeta.Count() >= 1)
            {
                PsmCross.XlLocalization(theScan, psmCrossAlpha, psmCrossBeta.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.TotalMass, crosslinker, ProductTypes, commonParameters.ProductMassTolerance, Charge_2_3, Charge_2_3_PrimeFragment, xlPosAlpha);
                PsmCross.XlLocalization(theScan, psmCrossBeta, psmCrossAlpha.compactPeptide.MonoisotopicMassIncludingFixedMods + crosslinker.TotalMass, crosslinker, ProductTypes, commonParameters.ProductMassTolerance, Charge_2_3, Charge_2_3_PrimeFragment, xlPosBeta);

                if (psmCrossAlpha.XLBestScore < psmCrossBeta.XLBestScore)
                {
                    var swap = psmCrossAlpha;
                    psmCrossAlpha = psmCrossBeta;
                    psmCrossBeta  = swap;
                }
                psmCrossAlpha.XlRank             = new int[] { ind, inx };
                psmCrossAlpha.XLTotalScore       = psmCrossAlpha.XLBestScore + psmCrossBeta.XLBestScore;
                psmCrossAlpha.XLQvalueTotalScore = Math.Sqrt(psmCrossAlpha.XLBestScore) * psmCrossBeta.XLBestScore;
                psmCrossAlpha.BetaPsmCross       = psmCrossBeta;
                if (crosslinker.Cleavable)
                {
                    psmCrossAlpha.ParentIonMaxIntensityRanks.AddRange(psmCrossBeta.ParentIonMaxIntensityRanks);
                    psmCrossAlpha.ParentIonExistNum += psmCrossBeta.ParentIonExistNum;
                }
                psmCrossAlpha.CrossType = PsmCrossType.Cross;

                psmCross = psmCrossAlpha;
            }
            return(psmCross);
        }
Beispiel #2
0
 public TwoPassCrosslinkSearchEngine(List <PsmCross> globalPsmsCross, Ms2ScanWithSpecificMass[] listOfSortedms2Scans, List <CompactPeptide> peptideIndex, List <int>[] fragmentIndex, List <ProductType> lp, int currentPartition, CommonParameters commonParameters, bool addCompIons, Tolerance XLPrecusorMsTl, CrosslinkerTypeClass crosslinker, bool CrosslinkSearchTop, int CrosslinkSearchTopNum, bool quench_H2O, bool quench_NH2, bool quench_Tris, bool charge_2_3, bool charge_2_3_PrimeFragment, List <string> nestedIds) : base(commonParameters, nestedIds)
 {
     this.GlobalPsmsCross      = globalPsmsCross;
     this.ListOfSortedms2Scans = listOfSortedms2Scans;
     this.PeptideIndex         = peptideIndex;
     this.FragmentIndex        = fragmentIndex;
     this.ProductTypes         = lp;
     this.CurrentPartition     = currentPartition + 1;
     this.AddComplementaryIons = addCompIons;
     //Here use LowTheoreticalDiffAcceptor in practice doesn't work in 12/2/2017
     this.MassDiffAcceptor  = new OpenSearchMode();
     this.DissociationTypes = DetermineDissociationType(lp);
     this.XLPrecusorMsTl    = XLPrecusorMsTl;
     XLPrecusorSearchMode   = new SinglePpmAroundZeroSearchMode(XLPrecusorMsTl.Value);
     //if (XLBetaPrecusorMsTl.ToString().Contains("Absolute"))
     //{
     //    XLPrecusorSearchMode = new SingleAbsoluteAroundZeroSearchMode(XLPrecusorMsTl.Value);
     //}
     this.Crosslinker              = crosslinker;
     this.CrosslinkSearchTop       = CrosslinkSearchTop;
     this.CrosslinkSearchTopNum    = CrosslinkSearchTopNum;
     this.QuenchH2O                = quench_H2O;
     this.QuenchNH2                = quench_NH2;
     this.QuenchTris               = quench_Tris;
     this.Charge_2_3               = charge_2_3;
     this.Charge_2_3_PrimeFragment = charge_2_3_PrimeFragment;
 }
Beispiel #3
0
        //Calculate if crosslink amino acid exist and return its position based on compactPeptide
        public static List <int> XlPosCal(CompactPeptide compactPeptide, CrosslinkerTypeClass crosslinker)
        {
            Tolerance  tolerance = new PpmTolerance(1);
            List <int> xlpos     = new List <int>();

            if (tolerance.Within(compactPeptide.NTerminalMasses[0], Residue.GetResidue(crosslinker.CrosslinkerModSite).MonoisotopicMass))
            {
                xlpos.Add(0);
            }
            for (int i = 1; i < compactPeptide.NTerminalMasses.Length; i++)
            {
                if (tolerance.Within(compactPeptide.NTerminalMasses[i] - compactPeptide.NTerminalMasses[i - 1], Residue.GetResidue(crosslinker.CrosslinkerModSite).MonoisotopicMass))
                {
                    xlpos.Add(i);
                }
            }
            if (tolerance.Within(compactPeptide.CTerminalMasses[0], Residue.GetResidue(crosslinker.CrosslinkerModSite).MonoisotopicMass))
            {
                xlpos.Add(compactPeptide.NTerminalMasses.Length);
            }
            return(xlpos);
        }
Beispiel #4
0
        //Calculate score based on All possible Products Masses for inter- or intra- crosslinks and deadend.
        public static void XlLocalizationForLoopCrosslink(Ms2ScanWithSpecificMass theScan, PsmCross psmCross, double modMass, CrosslinkerTypeClass crosslinker, List <ProductType> lp, Tolerance fragmentTolerance, List <int> linkPos)
        {
            var pmmhList = PsmCross.XlCalculateTotalProductMassesForLoopCrosslink(psmCross, modMass, crosslinker, lp, linkPos);

            List <double>         scoreList = new List <double>();
            List <MatchedIonInfo> miil      = new List <MatchedIonInfo>();

            foreach (var pmm in pmmhList)
            {
                var    matchedIonMassesListPositiveIsMatch = new MatchedIonInfo(pmm.ProductMz.Length);
                double pmmScore = PsmCross.XlMatchIons(theScan.TheScan, fragmentTolerance, pmm.ProductMz, pmm.ProductName, matchedIonMassesListPositiveIsMatch);
                miil.Add(matchedIonMassesListPositiveIsMatch);
                scoreList.Add(pmmScore);
            }

            psmCross.XLBestScore    = scoreList.Max();
            psmCross.MatchedIonInfo = miil[scoreList.IndexOf(scoreList.Max())];
            psmCross.XlPos          = pmmhList[scoreList.IndexOf(scoreList.Max())].XlPos + 1;
            psmCross.XlPos2         = pmmhList[scoreList.IndexOf(scoreList.Max())].XlPos2 + 1;
        }
Beispiel #5
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);
        }
Beispiel #6
0
        //Calculate score based on All possible Products Masses for inter- or intra- crosslinks and deadend.
        public static void XlLocalization(Ms2ScanWithSpecificMass theScan, PsmCross psmCross, double modMass,
                                          CrosslinkerTypeClass crosslinker, List <ProductType> lp, Tolerance fragmentTolerance, bool Charge_2_3, bool Charge_2_3_PrimeFragment, List <int> linkPos)
        {
            var pmmhList = PsmCross.XlCalculateTotalProductMasses(psmCross, modMass, crosslinker, lp, Charge_2_3, Charge_2_3_PrimeFragment, linkPos);

            List <double>         scoreList = new List <double>();
            List <MatchedIonInfo> miil      = new List <MatchedIonInfo>();

            foreach (var pmm in pmmhList)
            {
                var    matchedIonMassesListPositiveIsMatch = new MatchedIonInfo(pmm.ProductMz.Length);
                double pmmScore = PsmCross.XlMatchIons(theScan.TheScan, fragmentTolerance, pmm.ProductMz, pmm.ProductName, matchedIonMassesListPositiveIsMatch);
                miil.Add(matchedIonMassesListPositiveIsMatch);
                scoreList.Add(pmmScore);
            }

            psmCross.XLBestScore    = scoreList.Max();
            psmCross.MatchedIonInfo = miil[scoreList.IndexOf(scoreList.Max())];
            psmCross.XlPos          = pmmhList[scoreList.IndexOf(scoreList.Max())].XlPos + 1;
            if (crosslinker.Cleavable)
            {
                psmCross.ParentIonMaxIntensityRanks = new List <int>();
                if (psmCross.MatchedIonInfo.MatchedIonName.Any(p => p != null && p.Contains("PepS")))
                {
                    psmCross.ParentIonExist    += "PepS";
                    psmCross.ParentIonExistNum += 1;
                }
                if (psmCross.MatchedIonInfo.MatchedIonName.Any(p => p != null && p.Contains("PepL")))
                {
                    psmCross.ParentIonExist    += "PepL";
                    psmCross.ParentIonExistNum += 1;
                }
                //if (psmCross.MatchedIonInfo.MatchedIonName.Any(p => p != null && p.Equals("PepS2")))
                //{
                //    psmCross.ParentIonExist += "PepS2";
                //    psmCross.ParentIonExistNum += 1;
                //}
                //if (psmCross.MatchedIonInfo.MatchedIonName.Any(p => p != null && p.Equals("PepL2")))
                //{
                //    psmCross.ParentIonExist += "PepL2";
                //    psmCross.ParentIonExistNum += 1;
                //}
                for (int i = 0; i < psmCross.MatchedIonInfo.MatchedIonName.Length; i++)
                {
                    if (psmCross.MatchedIonInfo.MatchedIonName[i] != null)
                    {
                        if (psmCross.MatchedIonInfo.MatchedIonName[i].Contains("Pep"))
                        {
                            psmCross.ParentIonMaxIntensityRanks.Add(psmCross.MatchedIonInfo.MatchedIonIntensityRank[i]);
                        }
                    }
                }
            }
            if (Charge_2_3 || Charge_2_3_PrimeFragment)
            {
                int Charge2IonExist = 0;
                for (int i = 0; i < psmCross.MatchedIonInfo.MatchedIonName.Length; i++)
                {
                    if (psmCross.MatchedIonInfo.MatchedIonName[i] != null && (psmCross.MatchedIonInfo.MatchedIonName[i].Contains("t2") || psmCross.MatchedIonInfo.MatchedIonName[i].Contains("t3")))
                    {
                        Charge2IonExist++;
                    }
                }
                psmCross.Charge2IonExist = Charge2IonExist;
            }
        }
Beispiel #7
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);
        }