public static string GetDisplayName(this IonType ionType)
 {
     if (ionType == IonType.B2 || ionType == IonType.Y2)
     {
         return(ionType.ToString().Substring(0, 1).ToLower());
     }
     else
     {
         return(ionType.ToString().ToLower());
     }
 }
Beispiel #2
0
        public override string ToString()
        {
            if (IsPrecursor())
            {
                return(Resources.Transition_ToString_precursor + GetChargeIndicator(Adduct) +
                       GetMassIndexText(MassIndex));
            }

            if (IsCustom())
            {
                var text = CustomIon.ToString();
                // Was there enough information to generate a string more distinctive that just "Ion"?
                if (String.IsNullOrEmpty(CustomIon.Name) &&
                    String.IsNullOrEmpty(CustomIon.NeutralFormula))
                {
                    // No, add mz and charge to whatever generic text was used to describe it
                    var mz = Adduct.MzFromNeutralMass(CustomIon.MonoisotopicMass);
                    return(string.Format(@"{0} {1:F04}{2}",
                                         text, mz, GetChargeIndicator(Adduct)));
                }
                return(text);
            }
            return(string.Format(@"{0} - {1}{2}{3}{4}",
                                 AA,
                                 IonType.ToString().ToLowerInvariant(),
                                 Ordinal,
                                 GetDecoyText(DecoyMassShift),
                                 GetChargeIndicator(Adduct)));
        }
 public void Output(List<IonTypePeak> pkl, IonType ionType)
 {
   Console.WriteLine("Assert.AreEqual({0}, pkl.Count);", pkl.Count);
   for (int i = 0; i < pkl.Count; i++)
   {
     Console.WriteLine(MyConvert.Format("AssertPeak(pkl[{0}], IonType.{1}, {2}, {3:0.0000});", i, ionType.ToString(), i + 1, pkl[i].Mz));      
   }
 }
Beispiel #4
0
        public string GetFragmentIonName(CultureInfo cultureInfo, double?tolerance = null)
        {
            if (IsCustom() && !IsPrecursor())
            {
                return(CustomIon.ToString(tolerance));
            }
            string ionName = ReferenceEquals(cultureInfo, CultureInfo.InvariantCulture)
                ? IonType.ToString() : IonType.GetLocalizedString();

            if (!IsPrecursor())
            {
                ionName += Ordinal;
            }
            return(ionName);
        }
Beispiel #5
0
 public void Output(List <IonTypePeak> pkl, IonType ionType)
 {
     Console.WriteLine("Assert.AreEqual({0}, pkl.Count);", pkl.Count);
     for (int i = 0; i < pkl.Count; i++)
     {
         Console.WriteLine(MyConvert.Format("AssertPeak(pkl[{0}], IonType.{1}, {2}, {3:0.0000});", i, ionType.ToString(), i + 1, pkl[i].Mz));
     }
 }