Beispiel #1
0
        //id: ProteinAccession, ProtienPos, GlycanId.islocalized, minQValue, maxProb

        public GlycoProteinParsimony(string proteinAccess, int proteinPos, char aminoAcid, bool isLocalized, double minQValue, LocalizationLevel bestLocalizeLevel, double maxProb)
        {
            ProteinAccession = proteinAccess;

            ProteinPos = proteinPos;

            AminoAcid = aminoAcid;

            IsLocalized = isLocalized;

            MinQValue = minQValue;

            BestLocalizeLevel = bestLocalizeLevel;

            MaxProbability = maxProb;
        }
        public MetaDrawFilterSettings(bool showDecoys = false, bool showContaminants = true, double qValueFilter = 0.01, LocalizationLevel localizationLevelStart = LocalizationLevel.Level1, LocalizationLevel localizationLevelEnd = LocalizationLevel.Level3)
        {
            InitializeComponent();
            base.Closing += this.OnClosing;

            foreach (string level in System.Enum.GetNames(typeof(LocalizationLevel)))
            {
                CmbGlycanLocalizationLevelStart.Items.Add(level);
                CmbGlycanLocalizationLevelEnd.Items.Add(level);
            }

            QValueFilter           = qValueFilter;
            ShowContaminants       = showContaminants;
            ShowDecoys             = showDecoys;
            LocalizationLevelStart = localizationLevelStart;
            LocalizationLevelEnd   = localizationLevelEnd;

            CmbGlycanLocalizationLevelStart.SelectedItem = localizationLevelStart.ToString();
            CmbGlycanLocalizationLevelEnd.SelectedItem   = localizationLevelEnd.ToString();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            ShowDecoys       = DecoysCheckBox.IsChecked.Value;
            ShowContaminants = ContaminantsCheckBox.IsChecked.Value;

            if (!string.IsNullOrWhiteSpace(qValueBox.Text))
            {
                if (double.TryParse(qValueBox.Text, out double qValueFilter))
                {
                    QValueFilter = qValueFilter;
                }
                else
                {
                    MessageBox.Show("Could not parse q-value filter");
                    return;
                }
            }
            LocalizationLevelStart = (LocalizationLevel)System.Enum.Parse(typeof(LocalizationLevel), CmbGlycanLocalizationLevelStart.SelectedItem.ToString());
            LocalizationLevelEnd   = (LocalizationLevel)System.Enum.Parse(typeof(LocalizationLevel), CmbGlycanLocalizationLevelEnd.SelectedItem.ToString());
            this.Visibility        = Visibility.Hidden;
        }
Beispiel #4
0
        //Correct Localization Level based on site specific probability. If LocalizationLevel = 1, and there are site probability lower than 0.75, Correct the level to 1b.
        public static LocalizationLevel CorrectLocalizationLevel(Dictionary <int, List <Tuple <int, double> > > siteSpeciLocalProb, LocalizationGraph localizationGraph, Route route, List <Tuple <int, int, bool> > localizedGlycan, LocalizationLevel localizationLevel)
        {
            if (siteSpeciLocalProb == null || localizationLevel != LocalizationLevel.Level1)
            {
                return(localizationLevel);
            }

            if (localizationGraph.ModPos.Length == 1 && localizationGraph.TotalScore == 0)
            {
                return(LocalizationLevel.Level1b);
            }


            for (int i = 0; i < localizedGlycan.Count; i++)
            {
                var g = localizedGlycan[i];
                if (siteSpeciLocalProb[g.Item1].Where(p => p.Item1 == g.Item2).First().Item2 < 0.75)
                {
                    return(LocalizationLevel.Level1b);
                }

                if (!route.Mods[i].Item3)
                {
                    return(LocalizationLevel.Level1b);
                }
            }


            return(localizationLevel);
        }
Beispiel #5
0
        //Output: <int, int, string> <ModBoxId, ModPosition, is localized>; Input: List<Route>
        public static List <Tuple <int, int, bool> > GetLocalizedGlycan(List <Route> OGlycanBoxLocalization, out LocalizationLevel localizationLevel)
        {
            List <Tuple <int, int, bool> > localizedGlycan = new List <Tuple <int, int, bool> >();

            //Dictionary<string, int>: modsite-id, count
            Dictionary <string, int> seenModSite = new Dictionary <string, int>();

            foreach (var ogl in OGlycanBoxLocalization)
            {
                foreach (var og in ogl.Mods)
                {
                    var k = og.Item1.ToString() + "-" + og.Item2.ToString();
                    if (seenModSite.ContainsKey(k))
                    {
                        seenModSite[k] += 1;
                    }
                    else
                    {
                        seenModSite.Add(k, 1);
                    }
                }
            }

            localizationLevel = LocalizationLevel.Level3;
            if (OGlycanBoxLocalization.Count == 1)
            {
                localizationLevel = LocalizationLevel.Level1;
            }
            else if (OGlycanBoxLocalization.Count > 1)
            {
                if (seenModSite.Values.Where(p => p == OGlycanBoxLocalization.Count).Count() > 0)
                {
                    localizationLevel = LocalizationLevel.Level2;
                }
                else
                {
                    localizationLevel = LocalizationLevel.Level3;
                }
            }

            foreach (var seenMod in seenModSite)
            {
                if (seenMod.Value == OGlycanBoxLocalization.Count)
                {
                    localizedGlycan.Add(new Tuple <int, int, bool>(int.Parse(seenMod.Key.Split('-')[0]), int.Parse(seenMod.Key.Split('-')[1]), true));
                }
                else
                {
                    localizedGlycan.Add(new Tuple <int, int, bool>(int.Parse(seenMod.Key.Split('-')[0]), int.Parse(seenMod.Key.Split('-')[1]), false));
                }
            }

            return(localizedGlycan);
        }