public IEnumerable <ComplexFragmentIon> PermuteFragmentIons(SrmSettings settings, int maxFragmentationCount, bool useFilter, ModificationSite modificationSite, IEnumerable <ComplexFragmentIon> startingFragmentIons) { var linkedFragmentIonList = ImmutableList.ValueOf(ListComplexFragmentIons(settings, maxFragmentationCount, useFilter)); return(startingFragmentIons.SelectMany(cfi => PermuteFragmentIon(settings, maxFragmentationCount, cfi, modificationSite, linkedFragmentIonList))); }
public ComplexFragmentIonName AddChild(ModificationSite modificationSite, ComplexFragmentIonName child) { if (IsOrphan) { if (Children.Count > 0) { throw new InvalidOperationException(); } } return(ChangeProp(ImClone(this), im => { im.Children = ToChildList(Children.Append(Tuple.Create(modificationSite, child))); })); }
private CrosslinkBuilder GetChildBuilder(ModificationSite modificationSite) { CrosslinkBuilder childBuilder; if (!_childBuilders.TryGetValue(modificationSite, out childBuilder)) { LinkedPeptide linkedPeptide; ExplicitMods.Crosslinks.TryGetValue(modificationSite, out linkedPeptide); childBuilder = new CrosslinkBuilder(Settings, linkedPeptide.Peptide, linkedPeptide.ExplicitMods, LabelType); _childBuilders.Add(modificationSite, childBuilder); } return(childBuilder); }
private IEnumerable <ComplexFragmentIon> PermuteFragmentIon(SrmSettings settings, int maxFragmentationCount, ComplexFragmentIon fragmentIon, ModificationSite modificationSite, IList <ComplexFragmentIon> linkedFragmentIons) { if (fragmentIon.IsOrphan && !fragmentIon.IsEmptyOrphan || !fragmentIon.IncludesAaIndex(modificationSite.IndexAa)) { yield return(fragmentIon); yield break; } int fragmentCountRemaining = maxFragmentationCount - fragmentIon.GetFragmentationEventCount(); foreach (var linkedFragmentIon in linkedFragmentIons) { if (linkedFragmentIon.GetFragmentationEventCount() > fragmentCountRemaining) { continue; } if (fragmentIon.IsOrphan) { if (linkedFragmentIon.IncludesAaIndex(IndexAa)) { continue; } } else { if (!linkedFragmentIon.IncludesAaIndex(IndexAa)) { continue; } } yield return(fragmentIon.AddChild(modificationSite, linkedFragmentIon)); } }
public ComplexFragmentIon AddChild(ModificationSite modificationSite, ComplexFragmentIon child) { if (IsOrphan && !IsEmptyOrphan) { throw new InvalidOperationException(string.Format(@"Cannot add {0} to {1}.", child, this)); } if (child.Transition.MassIndex != 0) { throw new InvalidOperationException(string.Format(@"{0} cannot be a child fragment ion transition.", child.Transition)); } var newLosses = TransitionLosses; if (child.TransitionLosses != null) { if (newLosses == null) { newLosses = child.TransitionLosses; } else { newLosses = new TransitionLosses(newLosses.Losses.Concat(child.TransitionLosses.Losses).ToList(), newLosses.MassType); } child = child.ChangeLosses(null); } return(ChangeProp(ImClone(this), im => { im.Children = ImmutableSortedList.FromValues(Children.Append( new KeyValuePair <ModificationSite, ComplexFragmentIon>( modificationSite, child))); im.TransitionLosses = newLosses; })); }