Ejemplo n.º 1
0
        private void AppendLog(string logs)
        {
            if (TextBoxLog.Text.Length > 20000)
            {
                TextBoxLog.Text = TextBoxLog.Text.Substring(10000);
            }

            TextBoxLog.AppendText(Environment.NewLine + logs);
        }
Ejemplo n.º 2
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new ViewModel(msg =>
     {
         TextBoxLog.AppendText(msg + Environment.NewLine);
         TextBoxLog.ScrollToEnd();
     });
 }
Ejemplo n.º 3
0
 public void AddTextLog(string text)
 {
     this.Invoke(new MethodInvoker(delegate()
     {
         TextBoxLog.AppendText(string.Format("\r\n{0}", text));
         this.Refresh();
         this.Update();
     }));
 }
Ejemplo n.º 4
0
        private void AppendLogText(string message)
        {
            if (CheckAndInvokeIfRequired(() => AppendLogText(message)))
            {
                return;
            }

            var logMessage = $"{DateTime.Now} - {message}";

            Debug.WriteLine(logMessage);
            TextBoxLog.AppendText($"{logMessage}\r\n");
        }
Ejemplo n.º 5
0
 public void LogMessage(string message, Color color, Font font)
 {
     if (this.TextBoxLog.InvokeRequired)
     {
         LogMessageCallback CB = new LogMessageCallback(LogMessage);
         this.Invoke(CB, new object[] { message, color, font });
     }
     else
     {
         TextBoxLog.AppendText(message, color, font);
         TextBoxLog.ScrollToCaret();
     }
 }
        public void PlotSEPro()
        {
            LoadNRecords();
            List <string> identifiedProt = new List <string>();

            if ((bool)CheckBoxUnique.IsChecked)
            {
                identifiedProt = (from p in pckg.MyProteins.MyProteinList
                                  where p.PeptideResults.Exists(x => x.MyMapableProteins.Count == 1)
                                  //where p.PeptideResults.Exists(b => b.NoMyMapableProteins == 1)
                                  select p.Locus).ToList();
            }
            else
            {
                identifiedProt = pckg.MyProteins.MyProteinList.Select(a => a.Locus).ToList();
            }


            //clean possible np tags
            //for (int i = 0; i < identifiedProt.Count; i++)
            //{
            //    identifiedProt[i] = Regex.Replace(identifiedProt[i], "nxp:NX_", "");
            //    identifiedProt[i] = Regex.Replace(identifiedProt[i], "-[0-9]+", "");
            //}

            LabelProteins.Content = identifiedProt.Count;

            List <NextProtRecord> identifiedRecords = (from rec in nRecords
                                                       where identifiedProt.Contains(rec.ID)
                                                       select rec).ToList();

            //Get all the proteins that did not map------------------------

            List <string> unmapped = (from p in pckg.MyProteins.MyProteinList
                                      where !identifiedRecords.Exists(a => a.ID.Contains(p.Locus))
                                      select p.Locus).ToList();

            TextBoxLog.AppendText("Unmapped IDs\n");
            TextBoxLog.AppendText(string.Join(", ", unmapped));

            //--------------------------------------------------------------



            Plot(identifiedRecords);


            var result = from r in identifiedRecords
                         from p in pckg.MyProteins.MyProteinList
                         where r.ID.Contains(p.Locus)
                         select new
            {
                ID = p.Locus,
                NoUniquePeptides = p.PeptideResults.Count(c => c.NoMyMapableProteins == 1),
                SequenceCount    = p.SequenceCount,
                Chr         = r.Chr,
                Antibody    = r.AntiBody,
                Proteomics  = r.Proteomics,
                Description = p.Description
            };

            //var result = from p in pckg.MyProteins.MyProteinList
            //                where identifiedRecords.Exists(b => p.Locus.Contains(b.ID))
            //                select new
            //                {
            //                    ID = p.Locus,
            //                    NoUniquePeptides = p.PeptideResults.Count(c => c.NoMyMapableProteins == 1),
            //                    SequenceCount = p.SequenceCount,
            //                    SpecCount = p.SpectrumCount,
            //                    Chr = identifiedIDs.Find(d => p.Locus.Contains(d.Item1)).Item2,
            //                    Antibody = identifiedIDs.Find(d => p.Locus.Contains(d.Item1)).Item3,
            //                    Proteomics = identifiedIDs.Find(d => p.Locus.Contains(d.Item1)).Item4,
            //                    Description = p.Description
            //                };

            DataGridInterestingProteins.ItemsSource = result;
        }
Ejemplo n.º 7
0
        private void Alg_Iteration(object sender, AlgorithmEventArgs e)
        {
            string log = $"Iteration: {e.IterationNumber}, Sum of errors: {e.SumOfErrors}, Sum of squared errors: {e.SumOfSquaredErrors}";

            TextBoxLog.AppendText(log + Environment.NewLine);
        }