コード例 #1
0
        public void results_decoy_dataframe_with_something()
        {
            Sweet.lollipop = new Lollipop();
            Sweet.lollipop.input_files.Add(ConstructorsForTesting.InputFile("fake.txt", Labeling.NeuCode, Purpose.Identification, "n", "s", "1", "1", "1")); //0
            ExperimentalProteoform e = ConstructorsForTesting.ExperimentalProteoform("E1");

            e.linked_proteoform_references = new List <Proteoform>(new List <Proteoform> {
                ConstructorsForTesting.make_a_theoretical()
            });
            e.ptm_set = e.linked_proteoform_references.Last().ptm_set;
            ProteoformFamily f = new ProteoformFamily(e);

            f.construct_family();
            Sweet.lollipop.decoy_proteoform_communities.Add("Decoy1", new ProteoformCommunity());
            Sweet.lollipop.decoy_proteoform_communities["Decoy1"].families = new List <ProteoformFamily> {
                f
            };
            var time_stamp = Sweet.time_stamp();
            var directory  = TestContext.CurrentContext.TestDirectory;

            ResultsSummaryGenerator.save_all(TestContext.CurrentContext.TestDirectory, time_stamp, Sweet.lollipop.TusherAnalysis1 as IGoAnalysis, Sweet.lollipop.TusherAnalysis1 as TusherAnalysis);
            Assert.IsTrue(File.Exists(Path.Combine(directory, "decoy_experimental_results_" + time_stamp + ".tsv")));
            var lines = File.ReadAllLines(Path.Combine(directory, "decoy_experimental_results_" + time_stamp + ".tsv"));

            Assert.AreEqual(2, lines.Length);
        }
コード例 #2
0
        private void btn_buildAllFamilies_Click(object sender, RoutedEventArgs e)
        {
            string time_stamp = Sweet.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(Sweet.lollipop.target_proteoform_community.families, Sweet.lollipop.target_proteoform_community.families, Sweet.lollipop.family_build_folder_path, "", time_stamp, (bool)ck_cb_buildAsQuantitative ? MDIParent.resultsSummary.get_go_analysis() : null, (bool)cb_redBorder.IsChecked, (bool)cb_boldLabel.IsChecked, "Smarties", cmbx_edgeLabel.SelectedItem.ToString(), cmbx_nodeLabel.SelectedItem.ToString(), cmbx_nodeLabelPositioning.SelectedItem.ToString(), cmbx_nodeLayout.SelectedItem.ToString(), Sweet.lollipop.deltaM_edge_display_rounding, (bool)ck_cb_geneCentric, cmbx_geneLabel.SelectedItem.ToString());//data binding

            MessageBox.Show(message, "Cytoscape Build");
        }
コード例 #3
0
        private void btn_save_Click(object sender, RoutedEventArgs e)
        {
            if (!Directory.Exists(Sweet.lollipop.results_folder))
            {
                return;
            }
            string timestamp = Sweet.time_stamp();

            ResultsSummaryGenerator.save_all(Sweet.lollipop.results_folder, timestamp, get_go_analysis(), get_tusher_analysis());
            MDIParent.save_all_plots(Sweet.lollipop.results_folder, timestamp);
            using (StreamWriter file = new StreamWriter(System.IO.Path.Combine(Sweet.lollipop.results_folder, "presets_" + timestamp + ".xml")))
                file.WriteLine(Sweet.save_method());
        }
コード例 #4
0
        private void btn_buildAllFamilies_Click(object sender, EventArgs e)
        {
            string time_stamp = Sweet.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(Sweet.lollipop.target_proteoform_community.families, Sweet.lollipop.target_proteoform_community.families,
                                                                    Sweet.lollipop.family_build_folder_path, "", time_stamp,
                                                                    cb_buildAsQuantitative.Checked ? (MdiParent as ProteoformSweet).resultsSummary.get_go_analysis() : null, cb_redBorder.Checked, cb_boldLabel.Checked,
                                                                    cmbx_colorScheme.SelectedItem.ToString(), cmbx_edgeLabel.SelectedItem.ToString(), cmbx_nodeLabel.SelectedItem.ToString(), cmbx_nodeLabelPositioning.SelectedItem.ToString(), cmbx_nodeLayout.SelectedItem.ToString(), Sweet.lollipop.deltaM_edge_display_rounding,
                                                                    cb_geneCentric.Checked, cmbx_geneLabel.SelectedItem.ToString());

            MessageBox.Show(message, "Cytoscape Build");
        }
コード例 #5
0
        private void btn_buildSelectedFamilies_Click(object sender, RoutedEventArgs e)
        {
            string time_stamp = Sweet.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            object[] selected = DisplayUtility.get_selected_objects(dgv_main);
            string   message  = CytoscapeScript.write_cytoscape_script(selected, Sweet.lollipop.target_proteoform_community.families,
                                                                       Sweet.lollipop.family_build_folder_path, "", time_stamp,
                                                                       (bool)cb_buildAsQuantitative.IsChecked ? (this.MDIParent as ProteoformSweet).resultsSummary.get_go_analysis() : null, (bool)cb_redBorder.IsChecked, (bool)cb_boldLabel.IsChecked,
                                                                       cmbx_colorScheme.SelectedItem.ToString(), cmbx_edgeLabel.SelectedItem.ToString(), cmbx_nodeLabel.SelectedItem.ToString(), cmbx_nodeLabelPositioning.SelectedItem.ToString(), cmbx_nodeLayout.SelectedItem.ToString(), Sweet.lollipop.deltaM_edge_display_rounding,
                                                                       (bool)cb_geneCentric.IsChecked, cmbx_geneLabel.SelectedItem.ToString(), (bool)ck_cb_scale_nodes);

            MessageBox.Show(message, "Cytoscape Build");
        }
コード例 #6
0
        public Stopwatch full_run()
        {
            forms[1].ClearListsTablesFigures(true); // clear forms following load deconvolution results

            MessageBoxResult d3 = MessageBox.Show("Use presets for this Full Run?", "Full Run", MessageBoxButton.YesNoCancel);

            if (d3 == MessageBoxResult.Yes)
            {
                bool?dr = methodFileOpen.ShowDialog();
                if (dr == true)
                {
                    string           filepath = methodFileOpen.FileName;
                    MessageBoxResult d4       = MessageBox.Show("Add files at the listed paths if they still exist?", "Full Run", MessageBoxButton.YesNoCancel);
                    if (d4 == MessageBoxResult.Cancel)
                    {
                        return(null);
                    }

                    if (!open_method(filepath, File.ReadAllLines(filepath), d4 == MessageBoxResult.Yes))
                    {
                        return(null);
                    }
                    ;
                }
                else if (dr == false)
                {
                    return(null);
                }
            }
            else if (d3 == MessageBoxResult.Cancel)
            {
                return(null);
            }

            loadResults.FillTablesAndCharts(); // updates the filelists in form

            //  Check that there are input files
            if (Sweet.lollipop.input_files.Count == 0)
            {
                MessageBox.Show("Please load in deconvolution result files in order to use load and run.", "Full Run");
                return(null);
            }

            // Check that theoretical database(s) are present

            if (Sweet.lollipop.get_files(Sweet.lollipop.input_files, Purpose.ProteinDatabase).Count() <= 0)
            {
                MessageBox.Show("Please list at least one protein database.", "Full Run");
                return(null);
            }


            // Option to choose a result folder
            if (Sweet.lollipop.results_folder == "")
            {
                MessageBoxResult d2 = MessageBox.Show("Choose a results folder for this Full Run?", "Full Run", MessageBoxButton.YesNoCancel);
                if (d2 == MessageBoxResult.Yes)
                {
                    System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
                    System.Windows.Forms.DialogResult        dr            = folderBrowser.ShowDialog();
                    if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        string temp_folder_path = folderBrowser.SelectedPath;
                        Sweet.lollipop.results_folder = temp_folder_path;
                        loadResults.InitializeParameterSet(); // updates the textbox
                    }
                    else if (dr == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return(null);
                    }
                }
                else if (d2 == MessageBoxResult.Cancel)
                {
                    return(null);
                }
            }
            else
            {
                MessageBoxResult d2 = MessageBox.Show("Would you like to save results of this Full Run to " + Sweet.lollipop.results_folder + "?", "Full Run", MessageBoxButton.YesNoCancel);
                if (d2 == MessageBoxResult.No)
                {
                    Sweet.lollipop.results_folder = "";
                }
                else if (d2 == MessageBoxResult.Cancel)
                {
                    return(null);
                }
            }

            //Run the program
            Mouse.OverrideCursor = Cursors.Wait;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            foreach (ISweetForm sweet in forms)
            {
                if (sweet.ReadyToRunTheGamut())
                {
                    sweet.RunTheGamut(true);
                }
            }

            //  Save the results
            resultsSummary.InitializeParameterSet();
            if (Sweet.lollipop.results_folder != "")
            {
                string timestamp = Sweet.time_stamp();
                ResultsSummaryGenerator.save_all(Sweet.lollipop.results_folder, timestamp, resultsSummary.get_go_analysis(), resultsSummary.get_tusher_analysis());
                save_all_plots(Sweet.lollipop.results_folder, timestamp);
                using (StreamWriter file = new StreamWriter(Path.Combine(Sweet.lollipop.results_folder, "presets_" + timestamp + ".xml")))
                    file.WriteLine(Sweet.save_method());
            }
            List <string> warning_methods = new List <string>()
            {
                "Warning:"
            };

            if (Sweet.lollipop.bottomupReader.bad_ptms.Count > 0)
            {
                warning_methods.Add("The following PTMs in the bottom-up file were not matched with any PTMs in the theoretical database: ");
                warning_methods.Add(string.Join(", ", Sweet.lollipop.bottomupReader.bad_ptms.Distinct()));
            }
            if (Sweet.lollipop.topdownReader.bad_ptms.Count > 0)
            {
                warning_methods.Add("Top-down proteoforms with the following modifications were not matched to a modification in the theoretical PTM list: ");
                warning_methods.Add(string.Join(", ", Sweet.lollipop.topdownReader.bad_ptms.Distinct()));
            }
            if (Sweet.lollipop.topdown_proteoforms_no_theoretical.Count() > 0)
            {
                warning_methods.Add("Top-down proteoforms with the following accessions were not matched to a theoretical proteoform in the theoretical database: ");
                warning_methods.Add(string.Join(", ", Sweet.lollipop.topdown_proteoforms_no_theoretical.Select(t => t.accession.Split('_')[0]).Distinct()));
            }
            if (warning_methods.Count > 1)
            {
                MessageBox.Show(String.Join("\n\n", warning_methods));
            }
            //  Program ran successfully
            stopwatch.Stop();
            Mouse.OverrideCursor = null;
            return(stopwatch);
        }
コード例 #7
0
        public void saveall()
        {
            Sweet.lollipop = new Lollipop();
            ExperimentalProteoform e = ConstructorsForTesting.ExperimentalProteoform("asdf");

            Sweet.lollipop.qVals.Add(e.quant);
            GoTermNumber g = new GoTermNumber(new GoTerm("id", "desc", Aspect.BiologicalProcess), 0, 0, 0, 0);

            g.by = -1;
            Sweet.lollipop.TusherAnalysis1.GoAnalysis.goTermNumbers.Add(g);
            Sweet.lollipop.topdown_proteoforms = new List <TopDownProteoform>()
            {
                ConstructorsForTesting.TopDownProteoform("td1", 1000, 10)
            };
            ResultsSummaryGenerator.save_all(TestContext.CurrentContext.TestDirectory, Sweet.time_stamp(), Sweet.lollipop.TusherAnalysis1 as IGoAnalysis, Sweet.lollipop.TusherAnalysis1 as TusherAnalysis);
        }