Example #1
0
        private async void PlotSelected(object sender, SelectionChangedEventArgs e)
        {
            var listview = sender as ListView;
            var plotName = listview.SelectedItem as string;

            if (filteredListOfPsms.Count == 0)
            {
                MessageBox.Show("There are no PSMs to analyze.\n\nLoad the current file or choose a new file.");
                return;
            }
            if (selectSourceFileListBox.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a source file.");
                return;
            }

            // get psms from selected source files
            ObservableCollection <PsmFromTsv> psms = new ObservableCollection <PsmFromTsv>();
            Dictionary <string, ObservableCollection <PsmFromTsv> > psmsBSF = new Dictionary <string, ObservableCollection <PsmFromTsv> >();

            foreach (string fileName in selectSourceFileListBox.SelectedItems)
            {
                psmsBSF.Add(fileName, psmsBySourceFile[fileName]);
                foreach (PsmFromTsv psm in psmsBySourceFile[fileName])
                {
                    psms.Add(psm);
                }
            }
            PlotModelStat plot = await Task.Run(() => new PlotModelStat(plotName, psms, psmsBSF));

            plotViewStat.DataContext = plot;
            PlotViewStat_SizeChanged(plotViewStat, null);
        }
Example #2
0
        private void CreatePlotPdf_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = plotsListBox.SelectedItem;

            if (selectedItem == null)
            {
                MessageBox.Show("Select a plot type to export!");
                return;
            }

            if (!filteredListOfPsms.Any())
            {
                MessageBox.Show("No PSMs are loaded!");
                return;
            }

            var plotName = selectedItem as string;

            PlotModelStat plot          = new PlotModelStat(plotName, filteredListOfPsms);
            var           fileDirectory = Directory.GetParent(tsvResultsFilePath).ToString();
            var           fileName      = String.Concat(plotName, ".pdf");

            using (Stream writePDF = File.Create(Path.Combine(fileDirectory, fileName)))
            {
                PdfExporter.Export(plot.Model, writePDF, 1000, 700);
            }
            MessageBox.Show("PDF Created at " + Path.Combine(fileDirectory, fileName) + "!");
        }
Example #3
0
        private async void PlotSelected(object sender, SelectionChangedEventArgs e)
        {
            var listview = sender as ListView;
            var plotName = listview.SelectedItem as string;

            if (filteredListOfPsms.Count == 0)
            {
                MessageBox.Show("There are no PSMs to analyze.\n\nLoad the current file or choose a new file.");
                return;
            }
            PlotModelStat plot = await Task.Run(() => new PlotModelStat(plotName, filteredListOfPsms));

            plotViewStat.DataContext = plot;
        }