Exemple #1
0
        public static void mass_shifts_from_presets()
        {
            Regex findshift             = new Regex(@"( by )(.+)");
            Regex findshiftrelationtype = new Regex(@"(shift )(\S+)");

            foreach (string mass_shift in loaded_actions.Where(x => x.StartsWith("shift ")))
            {
                string relationshiptype         = findshiftrelationtype.Match(mass_shift).Groups[2].ToString();
                ProteoformComparison?comparison = ExtensionMethods.EnumUntil.GetValues <ProteoformComparison>().FirstOrDefault(x => relationshiptype == x.ToString());
                bool converted = Double.TryParse(findmass.Match(mass_shift).Groups[2].ToString(), out double mass);
                if (comparison == null || !converted)
                {
                    continue;
                }
                string        shift = findshift.Match(mass_shift).Groups[2].ToString();
                DeltaMassPeak peak  = null;
                if (comparison == ProteoformComparison.ExperimentalTheoretical)
                {
                    peak = lollipop.et_peaks.FirstOrDefault(p => Math.Round(p.DeltaMass, 2) == Math.Round(mass, 2));
                }
                if (peak != null)
                {
                    peak.mass_shifter = shift;
                }
            }
        }
Exemple #2
0
        public static void update_peaks_from_presets(ProteoformComparison comparison_to_update)
        {
            Regex findacceptrelationtype = new Regex(@"(accept )(\S+)");

            foreach (string peak_change in loaded_actions.Where(x => x.StartsWith("accept ") || x.StartsWith("unaccept ")))
            {
                string relationshiptype         = findacceptrelationtype.Match(peak_change).Groups[2].ToString();
                ProteoformComparison?comparison = ExtensionMethods.EnumUntil.GetValues <ProteoformComparison>().FirstOrDefault(x => relationshiptype == x.ToString());
                bool converted = Double.TryParse(findmass.Match(peak_change).Groups[2].ToString(), out double mass);
                if (comparison == null || comparison != comparison_to_update || !converted)
                {
                    continue;
                }
                DeltaMassPeak peak = null;
                if (comparison == ProteoformComparison.ExperimentalTheoretical)
                {
                    peak = lollipop.et_peaks.FirstOrDefault(p => Math.Round(p.DeltaMass, 2) == Math.Round(mass, 2));
                }
                else if (comparison == ProteoformComparison.ExperimentalExperimental)
                {
                    peak = lollipop.ee_peaks.FirstOrDefault(p => Math.Round(p.DeltaMass, 2) == Math.Round(mass, 2));
                }
                if (peak != null)
                {
                    lollipop.change_peak_acceptance(peak, peak_change.StartsWith("accept "), true);
                }
            }
        }
Exemple #3
0
 public static void shift_peak_action(DeltaMassPeak peak)
 {
     save_actions.Add("shift " + peak.RelationType.ToString() + " peak with delta-mass " + peak.DeltaMass.ToString() + " by " + peak.mass_shifter);
 }