public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj is PeptideModificationCounts)
     {
         PeptideModificationCounts other = (PeptideModificationCounts)obj;
         if (other.modificationTypes.Length != modificationTypes.Length)
         {
             return(false);
         }
         for (int i = 0; i < modificationTypes.Length; i++)
         {
             if (modificationTypes[i] != other.modificationTypes[i])
             {
                 return(false);
             }
         }
         for (int i = 0; i < modificationTypes.Length; i++)
         {
             if (modificationCounts[i] != other.modificationCounts[i])
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
        public bool ValidModifications()
        {
            PeptideModificationCounts counts = modifications.ProjectToCounts();

            ushort[] c = counts.ModificationCounts;
            foreach (ushort cc in c)
            {
                if (cc > 7)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
        public void CalcPtmScore(double ms2Tol, string ms2TolUnit, int topx, string[] fixedModifications, string sequence, double[] specMasses, float[] specIntensities)
        {
            List <string> fixedMods = new List <string>();

            for (int i = 0; i < fixedModifications.Length; i++)
            {
                fixedMods.Add(fixedModifications[i]);
            }
            ushort[] ltypes = labelModifications.ProjectToCounts().ModificationTypes;
            foreach (ushort ltype in ltypes)
            {
                fixedMods.Add(Tables.modificationList[ltype].Title);
            }
            PeptideModificationCounts c = trueModifications.ProjectToCounts();

            ushort[] ttypes  = c.ModificationTypes;
            string[] varMods = new string[ttypes.Length];
            int[]    tcounts = new int[ttypes.Length];
            for (int i = 0; i < ttypes.Length; i++)
            {
                varMods[i] = Tables.modificationList[ttypes[i]].Title;
                tcounts[i] = c.GetModificationCount(ttypes[i]);
            }
            PeptideModificationState modstr;

            ptmScore = Pscore.CalcPtmScore(ms2Tol, ms2TolUnit, topx, sequence, Tables.ToModifications(fixedMods.ToArray()),
                                           Tables.ToModifications(varMods), tcounts, specMasses, specIntensities,
                                           mz, charge, out ptmScoreFinished, out modstr, out ptmScoreCounts,
                                           out deltaPtmScore, out description, out intensities, out massDiffs,
                                           out modProbabilities,
                                           out modScoreDiffs, false);
            ptmScoreFinished = !ptmScoreFinished;
            changed          = false;
            if (!modstr.Equals(trueModifications))
            {
                changed           = true;
                trueModifications = modstr;
            }
        }