Ejemplo n.º 1
0
        public static void GetLibIrtProviders(Library lib, IrtStandard standard, IProgressMonitor monitor,
                                              out IRetentionTimeProvider[] irtProviders, out List <IrtStandard> autoStandards, out DbIrtPeptide[] cirtPeptides)
        {
            monitor?.UpdateProgress(new ProgressStatus().ChangePercentComplete(-1));

            irtProviders = lib.RetentionTimeProvidersIrt.ToArray();
            if (!irtProviders.Any())
            {
                irtProviders = lib.RetentionTimeProviders.ToArray();
            }

            var isAuto = ReferenceEquals(standard, IrtStandard.AUTO);

            autoStandards = isAuto
                ? IrtStandard.BestMatch(irtProviders.SelectMany(provider => provider.PeptideRetentionTimes).Select(rt => rt.PeptideSequence))
                : null;

            if (ReferenceEquals(standard, IrtStandard.CIRT_SHORT) || isAuto && autoStandards.Count == 0)
            {
                var libPeptides = new TargetMap <bool>(irtProviders
                                                       .SelectMany(provider => provider.PeptideRetentionTimes)
                                                       .Select(rt => new KeyValuePair <Target, bool>(rt.PeptideSequence, true)));
                cirtPeptides = IrtStandard.CIRT.Peptides.Where(pep => libPeptides.ContainsKey(pep.ModifiedTarget)).ToArray();
            }
            else
            {
                cirtPeptides = new DbIrtPeptide[0];
            }
        }
Ejemplo n.º 2
0
        public void CheckDecoys(SrmDocument document, out int decoysNoSource, out int decoysWrongTransitionCount, out double proportionDecoysMatch)
        {
            var targets   = document.Peptides.Where(pep => !pep.IsDecoy).ToArray();
            var targetMap = new TargetMap <HashSet <int> >(targets.Select(target =>
                                                                          new KeyValuePair <Target, HashSet <int> >(target.ModifiedTarget, new HashSet <int>())));

            foreach (var target in targets)
            {
                foreach (var nodeTranGroup in target.TransitionGroups)
                {
                    targetMap[target.ModifiedTarget].Add(nodeTranGroup.TransitionCount);
                }
            }

            decoysNoSource             = 0;
            decoysWrongTransitionCount = 0;

            var decoys = Peptides.Where(pep => pep.IsDecoy).ToArray();

            foreach (var decoy in decoys)
            {
                if (!targetMap.TryGetValue(decoy.SourceModifiedTarget, out var transitionCounts))
                {
                    decoysNoSource++;
                }
                else if (decoy.TransitionGroups.All(nodeTranGroup => !transitionCounts.Contains(nodeTranGroup.TransitionCount)))
                {
                    decoysWrongTransitionCount++;
                }
            }
            proportionDecoysMatch = 1 - (double)(decoysNoSource + decoysWrongTransitionCount) / decoys.Length;
        }