Esempio n. 1
0
        public static Modification[] GetModifiedVersions(char aa, SilacType type, SilacLabel[] labels1, SilacLabel[] labels2)
        {
            AminoAcid a = AminoAcid.FromLetter(aa);

            switch (type)
            {
            case SilacType.Singlets:
                return(new Modification[1]);

            case SilacType.Doublets:
                Modification[] result = new Modification[2];
                if (a.HasFittingLabel(labels1))
                {
                    SilacLabel sl = a.GetFittingLabel(labels1);
                    result[1] = Tables.modifications[AminoAcid.GetMascotModificationStringForLabel(sl)];
                }
                return(result);

            case SilacType.Triplets:
                result = new Modification[3];
                if (a.HasFittingLabel(labels1))
                {
                    SilacLabel sl = a.GetFittingLabel(labels1);
                    result[1] = Tables.modifications[AminoAcid.GetMascotModificationStringForLabel(sl)];
                }
                if (a.HasFittingLabel(labels2))
                {
                    SilacLabel sl = a.GetFittingLabel(labels2);
                    result[2] = Tables.modifications[AminoAcid.GetMascotModificationStringForLabel(sl)];
                }
                return(result);
            }
            throw new Exception("Never get here.");
        }
 public static void WriteSearchEngineParams(string msmName, SilacLabel[] labels, bool addLabels, bool variableMods,
                                            SearchEngineParams msh, string titleSuffix)
 {
     if (addLabels)
     {
         for (int i = 0; i < labels.Length; i++)
         {
             if (variableMods)
             {
                 msh.AddVariabeModification(AminoAcid.GetMascotModificationStringForLabel(labels[i]));
             }
             else
             {
                 msh.AddFixedModification(AminoAcid.GetMascotModificationStringForLabel(labels[i]));
             }
         }
     }
     msh.Title += titleSuffix;
     msh.Write(msmName.Substring(0, msmName.Length - 4) + ".par");
 }
Esempio n. 3
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);
 }