protected override MetaMorpheusEngineResults RunSpecific()
        {
            CrosslinkAnalysisResults myAnalysisResults = new CrosslinkAnalysisResults(this);

            Status("Running analysis engine!");
            //At this point have Spectrum-Sequence matching, without knowing which protein, and without know if target/decoy

            //myAnalysisResults.AddText("Starting compactPeptideToProteinPeptideMatching count: " + compactPeptideToProteinPeptideMatching.Count);
            Status("Adding observed peptides to dictionary...");
            foreach (var psmpair in NewPsms)
            {
                if (psmpair != null)
                {
                    var cp = psmpair.compactPeptide;
                    if (!CompactPeptideToProteinPeptideMatching.ContainsKey(cp))
                    {
                        CompactPeptideToProteinPeptideMatching.Add(cp, new HashSet <PeptideWithSetModifications>());
                    }

                    if (psmpair.BetaPsmCross != null)
                    {
                        var cp1 = psmpair.BetaPsmCross.compactPeptide;
                        if (!CompactPeptideToProteinPeptideMatching.ContainsKey(cp1))
                        {
                            CompactPeptideToProteinPeptideMatching.Add(cp1, new HashSet <PeptideWithSetModifications>());
                        }
                    }
                }
            }

            int proteinsSeen = 0;
            int old_progress = 0;

            Status("Adding possible sources to peptide dictionary...");
            Parallel.ForEach(Partitioner.Create(0, ProteinList.Count), new ParallelOptions {
                MaxDegreeOfParallelism = commonParameters.MaxThreadsToUsePerFile
            }, (fff, loopState) =>
            {
                for (int i = fff.Item1; i < fff.Item2; i++)
                {
                    // Stop loop if canceled
                    if (GlobalVariables.StopLoops)
                    {
                        loopState.Stop();
                        return;
                    }

                    foreach (var peptideWithSetModifications in ProteinList[i].Digest(commonParameters.DigestionParams, FixedModifications, VariableModifications))
                    {
                        var compactPeptide = peptideWithSetModifications.CompactPeptide(TerminusType);
                        if (CompactPeptideToProteinPeptideMatching.TryGetValue(compactPeptide, out HashSet <PeptideWithSetModifications> peptidesWithSetMods))
                        {
                            lock (peptidesWithSetMods)
                                peptidesWithSetMods.Add(peptideWithSetModifications);
                        }
                    }
                    proteinsSeen    += fff.Item2 - fff.Item1;
                    var new_progress = (int)((double)proteinsSeen / (ProteinList.Count) * 100);
                    if (new_progress > old_progress)
                    {
                        ReportProgress(new ProgressEventArgs(new_progress, "In adding possible" +
                                                             " sources to peptide dictionary loop", nestedIds));
                        old_progress = new_progress;
                    }
                }
            });

            Status("Computing info about actual peptides with modifications...");
            for (int myScanWithMassIndex = 0; myScanWithMassIndex < NewPsms.Count; myScanWithMassIndex++)
            {
                if (NewPsms[myScanWithMassIndex] != null)
                {
                    NewPsms[myScanWithMassIndex].MatchToProteinLinkedPeptides(CompactPeptideToProteinPeptideMatching);
                    if (NewPsms[myScanWithMassIndex].BetaPsmCross != null)
                    {
                        NewPsms[myScanWithMassIndex].BetaPsmCross.MatchToProteinLinkedPeptides(CompactPeptideToProteinPeptideMatching);
                    }
                }
            }

            return(myAnalysisResults);
        }
        protected override MetaMorpheusEngineResults RunSpecific()
        {
            MassDiffAcceptor XLsearchMode = new OpenSearchMode();

            CrosslinkAnalysisResults myAnalysisResults = new CrosslinkAnalysisResults(this);

            Status("Running analysis engine!");
            //At this point have Spectrum-Sequence matching, without knowing which protein, and without know if target/decoy

            #region Match Seqeunces to PeptideWithSetModifications

            //myAnalysisResults.AddText("Starting compactPeptideToProteinPeptideMatching count: " + compactPeptideToProteinPeptideMatching.Count);
            Status("Adding observed peptides to dictionary...");
            foreach (var psmpair in newPsms)
            {
                if (psmpair != null)
                {
                    var cp = psmpair.compactPeptide;
                    if (!compactPeptideToProteinPeptideMatching.ContainsKey(cp))
                    {
                        compactPeptideToProteinPeptideMatching.Add(cp, new HashSet <PeptideWithSetModifications>());
                    }

                    if (psmpair.BetaPsmCross != null)
                    {
                        var cp1 = psmpair.BetaPsmCross.compactPeptide;
                        if (!compactPeptideToProteinPeptideMatching.ContainsKey(cp1))
                        {
                            compactPeptideToProteinPeptideMatching.Add(cp1, new HashSet <PeptideWithSetModifications>());
                        }
                    }
                }
            }
            //myAnalysisResults.AddText("Ending compactPeptideToProteinPeptideMatching count: " + compactPeptideToProteinPeptideMatching.Count);
            int totalProteins = proteinList.Count;
            int proteinsSeen  = 0;
            int old_progress  = 0;
            var obj           = new object();
            Status("Adding possible sources to peptide dictionary...");
            Parallel.ForEach(Partitioner.Create(0, totalProteins), fff =>
            {
                Dictionary <CompactPeptideBase, HashSet <PeptideWithSetModifications> > local = compactPeptideToProteinPeptideMatching.ToDictionary(b => b.Key, b => new HashSet <PeptideWithSetModifications>());
                for (int i = fff.Item1; i < fff.Item2; i++)
                {
                    foreach (var peptideWithSetModifications in proteinList[i].Digest(CommonParameters.DigestionParams, fixedModifications, variableModifications))
                    {
                        if (local.TryGetValue(new CompactPeptide(peptideWithSetModifications, terminusType), out HashSet <PeptideWithSetModifications> v))
                        {
                            v.Add(peptideWithSetModifications);
                        }
                    }
                }

                lock (obj)
                {
                    foreach (var ye in local)
                    {
                        if (compactPeptideToProteinPeptideMatching.TryGetValue(ye.Key, out HashSet <PeptideWithSetModifications> v))
                        {
                            foreach (var huh in ye.Value)
                            {
                                v.Add(huh);
                            }
                        }
                    }
                    proteinsSeen    += fff.Item2 - fff.Item1;
                    var new_progress = (int)((double)proteinsSeen / (totalProteins) * 100);
                    if (new_progress > old_progress)
                    {
                        ReportProgress(new ProgressEventArgs(new_progress, "In adding possible" +
                                                             " sources to peptide dictionary loop", nestedIds));
                        old_progress = new_progress;
                    }
                }
            });

            #endregion Match Seqeunces to PeptideWithSetModifications

            Status("Computing info about actual peptides with modifications...");
            for (int myScanWithMassIndex = 0; myScanWithMassIndex < newPsms.Count; myScanWithMassIndex++)
            {
                var huh = newPsms[myScanWithMassIndex];
                if (huh != null)
                {
                    huh.MatchToProteinLinkedPeptides(compactPeptideToProteinPeptideMatching);
                }
                if (huh != null)
                {
                    var huh1 = newPsms[myScanWithMassIndex].BetaPsmCross;
                    if (huh1 != null)
                    {
                        huh1.MatchToProteinLinkedPeptides(compactPeptideToProteinPeptideMatching);
                    }
                }
            }

            return(myAnalysisResults);
        }