public SrmDocument RemoveBelowCutoffs(SrmDocument document)
        {
            var intersection = new HashSet <int>();

            foreach (var data in Data)
            {
                if (_progressMonitor != null && _progressMonitor.IsCanceled())
                {
                    throw new OperationCanceledException();
                }

                if (_progressMonitor != null)
                {
                    _progressMonitor.ProcessMolecule(null);
                }

                var filterByCutoff = data.ToArray();

                var toRemove = IndicesBelowCutoff(_adjustedPValCutoff, _foldChangeCutoff, _msLevel, null,
                                                  filterByCutoff);

                if (intersection.Count == 0)
                {
                    intersection.UnionWith(toRemove);
                }
                else
                {
                    intersection.IntersectWith(toRemove);
                }
            }

            return((SrmDocument)document.RemoveAll(intersection));
        }
Example #2
0
        public SrmDocument RemoveAboveCVCutoff(SrmDocument document)
        {
            var filterByCutoff = Data;

            if (!double.IsNaN(_settings.CVCutoff))
            {
                var cutoff = _settings.CVCutoff / 100.0;

                filterByCutoff = Data.Where(d => d.CV < cutoff).ToList();
            }

            var ids = new HashSet <int>(filterByCutoff
                                        .SelectMany(d => d.PeptideAnnotationPairs)
                                        .Select(pair => pair.TransitionGroup.Id.GlobalIndex));
            var setRemove = IndicesToRemove(document, ids);

            return((SrmDocument)document.RemoveAll(setRemove, null, (int)SrmDocument.Level.Molecules));
        }
 public SrmDocument RemoveDecoys(SrmDocument document)
 {
     // Remove the existing decoys
     return (SrmDocument) document.RemoveAll(document.MoleculeGroups.Where(nodePeptideGroup => nodePeptideGroup.IsDecoy)
                                                 .Select(nodePeptideGroup => nodePeptideGroup.Id.GlobalIndex).ToArray());
 }