Ejemplo n.º 1
0
        public static double[] GetYSeries(string sequence, PeptideModificationState fixedMods,
                                          PeptideModificationState varMods)
        {
            double m = MolUtil.YIonMassOffset;

            if (fixedMods.GetCTermModification() != ushort.MaxValue)
            {
                Modification mod = Tables.modificationList[fixedMods.GetCTermModification()];
                m += mod.DeltaMass;
            }
            if (varMods.GetCTermModification() != ushort.MaxValue)
            {
                Modification mod = Tables.modificationList[varMods.GetCTermModification()];
                m += mod.DeltaMass;
            }
            int n = sequence.Length - 1;

            double[] masses = new double[n];
            for (int i = 0; i < masses.Length; i++)
            {
                m += AminoAcid.aaMonoMasses[sequence[n - i]];
                if (fixedMods.GetModificationAt(n - i) != ushort.MaxValue)
                {
                    Modification mod = Tables.modificationList[fixedMods.GetModificationAt(n - i)];
                    m += mod.DeltaMass;
                }
                if (varMods.GetModificationAt(n - i) != ushort.MaxValue)
                {
                    Modification mod = Tables.modificationList[varMods.GetModificationAt(n - i)];
                    m += mod.DeltaMass;
                }
                masses[i] = m;
            }
            return(masses);
        }
Ejemplo n.º 2
0
        public static double[] GetPhosphoXSeries(string sequence, PeptideModificationState fixedMods,
                                                 PeptideModificationState varMods,
                                                 out MsmsPeakAnnotation[] descriptions, bool includeNeutralLoss)
        {
            List <double>             masses = new List <double>();
            List <MsmsPeakAnnotation> descr  = new List <MsmsPeakAnnotation>();

            double[] y = GetYSeries(sequence, fixedMods, varMods);
            for (int i = 0; i < y.Length; i++)
            {
                int index = sequence.Length - 1 - i;
                if (varMods.GetModificationAt(index) != ushort.MaxValue)
                {
                    if (Tables.modificationList[varMods.GetModificationAt(index)].IsPhosphorylation)
                    {
                        double x = y[i] + MolUtil.MassO + MolUtil.MassC;
                        masses.Add(x);
                        descr.Add(new MsmsPeakAnnotation(MsmsSeriesType.X, i + 1, 1, false));
                        if (sequence[index] != 'Y' && includeNeutralLoss)
                        {
                            double xn = x - 97.976896;
                            masses.Add(xn);
                            descr.Add(new MsmsPeakAnnotation(MsmsSeriesType.X, i + 1, 1, true));
                        }
                    }
                }
            }
            descriptions = descr.ToArray();
            return(masses.ToArray());
        }
Ejemplo n.º 3
0
        public static double[] GetNeutralLossBSeries(string sequence, PeptideModificationState fixedMods,
                                                     PeptideModificationState varMods)
        {
            double[] result           = new double[sequence.Length - 1];
            int      neutralLossIndex = -1;

            for (int i = 0; i < sequence.Length - 1; i++)
            {
                if (varMods.GetModificationAt(i) != ushort.MaxValue)
                {
                    if (Tables.modificationList[varMods.GetModificationAt(i)].HasNeutralLoss)
                    {
                        if (Tables.modificationList[varMods.GetModificationAt(i)].IsPhosphorylation && sequence[i] == 'Y')
                        {
                            continue;
                        }
                        neutralLossIndex = i;
                        break;
                    }
                }
            }

            if (neutralLossIndex != -1)
            {
                double[]     b    = GetBSeries(sequence, fixedMods, varMods);
                Modification mod  = Tables.modificationList[varMods.GetModificationAt(neutralLossIndex)];
                double       loss = mod.GetNeutralLoss()[0];
                for (int i = neutralLossIndex; i < sequence.Length - 1; i++)
                {
                    result[i] = b[i] - loss;
                }
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static double[] GetNeutralLossXSeries(string sequence, PeptideModificationState fixedMods,
                                                     PeptideModificationState varMods)
        {
            double[] result           = new double[sequence.Length - 1];
            int      neutralLossIndex = -1;

            for (int i = result.Length - 1; i >= 0; i--)
            {
                if (varMods.GetModificationAt(i) != ushort.MaxValue)
                {
                    if (Tables.modificationList[varMods.GetModificationAt(i)].HasNeutralLoss)
                    {
                        neutralLossIndex = i;
                        break;
                    }
                }
            }
            if (neutralLossIndex != -1)
            {
                double[]     x    = GetXSeries(sequence, fixedMods, varMods);
                Modification mod  = Tables.modificationList[varMods.GetModificationAt(neutralLossIndex)];
                double       loss = mod.GetNeutralLoss()[0];
                for (int i = neutralLossIndex; i >= 0; i--)
                {
                    result[i] = x[i] - loss;
                }
            }
            return(result);
        }
 public override bool Equals(object anObject)
 {
     if (this == anObject)
     {
         return(true);
     }
     if (anObject is PeptideModificationState)
     {
         PeptideModificationState other = (PeptideModificationState)anObject;
         if (other.GetNTermModification() != GetNTermModification())
         {
             return(false);
         }
         if (other.GetCTermModification() != GetCTermModification())
         {
             return(false);
         }
         if (other.Length != Length)
         {
             return(false);
         }
         for (int i = 0; i < Length; i++)
         {
             if (other.GetModificationAt(i) != GetModificationAt(i))
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
 private static int CalcSilacIndex(char aa, PeptideModificationState labelMods, string sequence, SilacType type,
                                   SilacLabel[] labels1, SilacLabel[] labels2)
 {
     for (int i = 0; i < sequence.Length; i++)
     {
         if (sequence[i] != aa)
         {
             continue;
         }
         ushort m = labelMods.GetModificationAt(i);
         if (type == SilacType.Doublets)
         {
             if (m != ushort.MaxValue)
             {
                 return(1);
             }
             return(0);
         }
         if (type == SilacType.Triplets)
         {
             int ind1 = -1;
             for (int j = 0; j < labels1.Length; j++)
             {
                 if (AminoAcid.GetAminoAcidFromLabel(labels1[j]).Letter == aa)
                 {
                     ind1 = j;
                 }
             }
             int ind2 = -1;
             for (int j = 0; j < labels2.Length; j++)
             {
                 if (AminoAcid.GetAminoAcidFromLabel(labels2[j]).Letter == aa)
                 {
                     ind2 = j;
                 }
             }
             if (ind1 == -1 && ind2 == -1)
             {
                 return(-1);
             }
             if (ind1 == -1)
             {
                 if (m != ushort.MaxValue)
                 {
                     return(2);
                 }
                 return(-1);
             }
             if (ind2 == -1)
             {
                 if (m != ushort.MaxValue)
                 {
                     return(1);
                 }
                 return(-1);
             }
             SilacLabel l1 = labels1[ind1];
             SilacLabel l2 = labels2[ind2];
             if (l1 == l2)
             {
                 if (m == ushort.MaxValue)
                 {
                     return(0);
                 }
                 return(-1);
             }
             if (m == ushort.MaxValue)
             {
                 return(0);
             }
             if (Tables.modifications[AminoAcid.GetMascotModificationStringForLabel(l1)].Index == m)
             {
                 return(1);
             }
             if (Tables.modifications[AminoAcid.GetMascotModificationStringForLabel(l2)].Index == m)
             {
                 return(2);
             }
             throw new Exception("Never get here.");
         }
         throw new Exception("Should never happen.");
     }
     return(-1);
 }
Ejemplo n.º 7
0
        private int GetSilacIndex(char aa, SilacType type, SilacLabel[] labels1, SilacLabel[] labels2)
        {
            if (type == SilacType.Singlets)
            {
                return(0);
            }
            int    index = -1;
            string seq   = sequence;

            for (int i = 0; i < seq.Length; i++)
            {
                if (seq[i] == aa)
                {
                    index = i;
                    break;
                }
            }
            if (index == -1)
            {
                return(-1);
            }
            Modification[] mods = T07SearchEngineEnhancement.GetModifiedVersions(aa, type, labels1, labels2);
            ushort         mod  = modifications.GetModificationAt(index);

            if (mod == ushort.MaxValue)
            {
                for (int i = 1; i < mods.Length; i++)
                {
                    if (mods[i] == null)
                    {
                        return(-1);
                    }
                }
                return(0);
            }
            if (type == SilacType.Doublets)
            {
                if (mods[1] == null)
                {
                    return(-1);
                }
                if (mods[1].Index == mod)
                {
                    return(1);
                }
                return(-1);
            }
            if (mods[1] == mods[2])
            {
                return(-1);
            }
            if (mods[1] != null && mods[1].Index == mod)
            {
                return(1);
            }
            if (mods[2] != null && mods[2].Index == mod)
            {
                return(2);
            }
            return(-1);
        }