Exemplo n.º 1
0
        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))); }));
        }
Exemplo n.º 2
0
        public static ComplexFragmentIonName FromLinkedIonProto(SkylineDocumentProto.Types.LinkedIon linkedIon)
        {
            ComplexFragmentIonName child;

            if (linkedIon.Orphan)
            {
                child = ORPHAN;
            }
            else
            {
                child = new ComplexFragmentIonName(DataValues.FromIonType(linkedIon.IonType), linkedIon.Ordinal);
            }

            child = child.AddLinkedIonProtos(linkedIon.Children);
            return(child);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a ComplexFragmentIonName object representing this ComplexFragmentIon
        /// </summary>
        public ComplexFragmentIonName GetName()
        {
            ComplexFragmentIonName name;

            if (IsOrphan)
            {
                name = ComplexFragmentIonName.ORPHAN;
            }
            else
            {
                name = new ComplexFragmentIonName(Transition.IonType, Transition.Ordinal);
            }

            foreach (var child in Children)
            {
                name = name.AddChild(child.Key, child.Value.GetName());
            }

            return(name);
        }
Exemplo n.º 4
0
        public ComplexFragmentIonName AddLinkedIonProtos(IEnumerable <SkylineDocumentProto.Types.LinkedIon> linkedIons)
        {
            var result = this;

            foreach (var linkedIon in linkedIons)
            {
                ComplexFragmentIonName child;
                if (linkedIon.Orphan)
                {
                    child = ORPHAN;
                }
                else
                {
                    child = new ComplexFragmentIonName(DataValues.FromIonType(linkedIon.IonType), linkedIon.Ordinal);
                }

                child  = child.AddLinkedIonProtos(linkedIon.Children);
                result = result.AddChild(new ModificationSite(linkedIon.ModificationIndex, linkedIon.ModificationName),
                                         child);
            }

            return(result);
        }
Exemplo n.º 5
0
        public ComplexFragmentIon MakeComplexFragmentIon(SrmSettings settings, IsotopeLabelType labelType, ComplexFragmentIonName complexFragmentIonName)
        {
            var        transitionGroup = GetTransitionGroup(labelType, Adduct.SINGLY_PROTONATED);
            Transition transition;

            if (complexFragmentIonName.IonType == IonType.precursor || complexFragmentIonName.IonType == IonType.custom)
            {
                transition = new Transition(transitionGroup, IonType.precursor, Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED);
            }
            else
            {
                transition = new Transition(transitionGroup, complexFragmentIonName.IonType,
                                            Transition.OrdinalToOffset(complexFragmentIonName.IonType, complexFragmentIonName.Ordinal, Peptide.Length),
                                            0, Adduct.SINGLY_PROTONATED);
            }

            var result = new ComplexFragmentIon(transition, null, CrosslinkStructure, complexFragmentIonName.IsOrphan);

            if (ExplicitMods != null)
            {
                foreach (var child in complexFragmentIonName.Children)
                {
                    LinkedPeptide linkedPeptide;
                    if (!ExplicitMods.Crosslinks.TryGetValue(child.Item1, out linkedPeptide))
                    {
                        throw new InvalidOperationException(@"No crosslink at " + child.Item1);
                    }
                    result = result.AddChild(child.Item1,
                                             linkedPeptide.MakeComplexFragmentIon(settings, labelType, child.Item2));
                }
            }

            return(result);
        }
Exemplo n.º 6
0
 protected bool Equals(ComplexFragmentIonName other)
 {
     return(IonType == other.IonType && Ordinal == other.Ordinal && Children.Equals(other.Children) && IsOrphan == other.IsOrphan);
 }