Esempio n. 1
0
 public void cytoscape_script_nothing_selected()
 {
     string message = CytoscapeScript.write_cytoscape_script(new List <ProteoformFamily>(), Sweet.lollipop.target_proteoform_community.families,
                                                             TestContext.CurrentContext.TestDirectory, "", "test",
                                                             null, false, false,
                                                             CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                             false, Lollipop.gene_name_labels[1]);
 }
Esempio n. 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");
        }
Esempio n. 3
0
        public void cytoscape_script_from_topdown()
        {
            Sweet.lollipop = new Lollipop();
            ProteoformCommunity community = TestProteoformFamilies.construct_community_with_td_proteoforms(-1);

            Sweet.lollipop.target_proteoform_community = community;
            TopDownProteoform td = ConstructorsForTesting.TopDownProteoform("ASDF", 1000, 50);

            td.gene_name = new GeneName(new List <Tuple <string, string> > {
                new Tuple <string, string>("genename", "genename")
            });
            ProteoformFamily fam = new ProteoformFamily(td);

            fam.construct_family();
            CytoscapeScript.write_cytoscape_script(new List <ProteoformFamily>()
            {
                fam
            }, new List <ProteoformFamily>()
            {
                fam
            },
                                                   TestContext.CurrentContext.TestDirectory, "", "test",
                                                   null, false, false,
                                                   CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                   true, Lollipop.gene_name_labels[1]);
            string[]         edge_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.edge_file_prefix + "test" + CytoscapeScript.edge_file_extension));
            HashSet <string> shared_pf_names_edges = new HashSet <string>();

            for (int i = 1; i < edge_lines.Length; i++)
            {
                if (edge_lines[i] == "")
                {
                    break;
                }
                string[] line = edge_lines[i].Split(new char[] { '\t' });
                shared_pf_names_edges.Add(line[0]);
                shared_pf_names_edges.Add(line[2]);
            }

            string[]         node_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.node_file_prefix + "test" + CytoscapeScript.node_file_extension));
            HashSet <string> shared_pf_names_nodes = new HashSet <string>();

            for (int i = 1; i < node_lines.Length; i++)
            {
                if (node_lines[i] == "")
                {
                    break;
                }
                string[] line = node_lines[i].Split(new char[] { '\t' });
                shared_pf_names_nodes.Add(line[0]);
            }

            Assert.True(shared_pf_names_nodes.All(name => shared_pf_names_edges.Contains(name)));
            Assert.True(shared_pf_names_edges.All(name => shared_pf_names_nodes.Contains(name)));
            Assert.AreEqual(2, shared_pf_names_nodes.Count);
            Assert.AreEqual(2, shared_pf_names_edges.Count);
        }
Esempio n. 4
0
        public void test_write_families_regular_display()
        {
            TheoreticalProteoform  t  = ConstructorsForTesting.make_a_theoretical();
            ExperimentalProteoform e  = ConstructorsForTesting.ExperimentalProteoform("E1");
            ProteoformRelation     et = new ProteoformRelation(e, t, ProteoformComparison.ExperimentalTheoretical, 0, TestContext.CurrentContext.TestDirectory);

            et.peak = new DeltaMassPeak(et, new HashSet <ProteoformRelation> {
                et
            });
            et.peak.Accepted = true;
            e.relationships.Add(et);
            t.relationships.Add(et);
            e.agg_intensity = 999.99;
            e.quant.TusherValues1.numeratorIntensitySum   = 444.44m;
            e.quant.TusherValues1.denominatorIntensitySum = 333.33m;
            e.quant.intensitySum = 777.77m;
            List <ProteoformFamily> f = new List <ProteoformFamily> {
                new ProteoformFamily(e)
            };

            f.First().construct_family();
            string message = CytoscapeScript.write_cytoscape_script(f, f,
                                                                    TestContext.CurrentContext.TestDirectory, "", "test",
                                                                    null, false, false,
                                                                    CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                                    false, Lollipop.gene_name_labels[1]);

            Assert.True(File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.script_file_prefix + "test" + CytoscapeScript.script_file_extension)));
            Assert.True(File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.style_file_prefix + "test" + CytoscapeScript.style_file_extension)));
            Assert.True(File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.node_file_prefix + "test" + CytoscapeScript.node_file_extension)));
            Assert.True(File.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.edge_file_prefix + "test" + CytoscapeScript.edge_file_extension)));

            //Check that the style xml is all there
            List <string> vizProperties = new List <string>();

            using (XmlReader xml = XmlReader.Create(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.style_file_prefix + "test" + CytoscapeScript.style_file_extension)))
            {
                while (xml.Read())
                {
                    switch (xml.NodeType)
                    {
                    case XmlNodeType.Element:
                        if (xml.Name == "visualProperty")
                        {
                            vizProperties.Add(xml.GetAttribute("name"));
                        }
                        break;
                    }
                }
            }
            Assert.AreEqual(CytoscapeScript.default_styles.Keys.Where(s => s.StartsWith("NETWORK")).Count(), vizProperties.Where(s => s.StartsWith("NETWORK")).Count());
            Assert.AreEqual(CytoscapeScript.default_styles.Keys.Where(s => s.StartsWith("NODE")).Count(), vizProperties.Where(s => s.StartsWith("NODE")).Count());
            Assert.AreEqual(CytoscapeScript.default_styles.Keys.Where(s => s.StartsWith("EDGE")).Count(), vizProperties.Where(s => s.StartsWith("EDGE")).Count());
            Assert.AreEqual(CytoscapeScript.default_styles.Keys.Where(s => !s.StartsWith("NETWORK") && !s.StartsWith("NODE") && !s.StartsWith("EDGE")).Count(), vizProperties.Where(s => !s.StartsWith("NETWORK") && !s.StartsWith("NODE") && !s.StartsWith("EDGE")).Count());
            Assert.AreEqual(CytoscapeScript.default_styles.Keys.Count, vizProperties.Count);
            Assert.True(message.StartsWith("Finished"));
        }
Esempio n. 5
0
        private void btn_buildAllQuantifiedFamilies_Click(object sender, EventArgs e)
        {
            string time_stamp = SaveState.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(SaveState.lollipop.target_proteoform_community.families, SaveState.lollipop.target_proteoform_community.families,
                                                                    SaveState.lollipop.family_build_folder_path, "", time_stamp, true, cb_redBorder.Checked, cb_boldLabel.Checked,
                                                                    cmbx_colorScheme.SelectedItem.ToString(), cmbx_nodeLabel.SelectedItem.ToString(), cmbx_edgeLabel.SelectedItem.ToString(), cmbx_nodeLabelPositioning.SelectedItem.ToString(), cmbx_nodeLayout.SelectedItem.ToString(), SaveState.lollipop.deltaM_edge_display_rounding,
                                                                    cb_geneCentric.Checked, cmbx_geneLabel.SelectedItem.ToString());

            MessageBox.Show(message, "Cytoscape Build");
        }
Esempio n. 6
0
        private void btn_buildFamiliesWithSignificantChange_Click(object sender, EventArgs e)
        {
            List <ProteoformFamily> families = SaveState.lollipop.getInterestingFamilies(SaveState.lollipop.satisfactoryProteoforms, SaveState.lollipop.minProteoformFoldChange, SaveState.lollipop.minProteoformFDR, SaveState.lollipop.minProteoformIntensity).Distinct().ToList();
            string time_stamp = SaveState.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(families, SaveState.lollipop.target_proteoform_community.families,
                                                                    SaveState.lollipop.family_build_folder_path, "", time_stamp, true, 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(), SaveState.lollipop.deltaM_edge_display_rounding,
                                                                    cb_geneCentric.Checked, cmbx_geneLabel.SelectedItem.ToString());

            MessageBox.Show(message, "Cytoscape Build");
        }
Esempio n. 7
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");
        }
Esempio n. 8
0
        private void btn_buildFromSelectedGoTerms_Click(object sender, EventArgs e)
        {
            List <GoTermNumber>     selected_gos      = (DisplayUtility.get_selected_objects(dgv_goAnalysis).Select(o => (GoTermNumber)o)).ToList();
            List <ProteoformFamily> selected_families = SaveState.lollipop.getInterestingFamilies(selected_gos, SaveState.lollipop.target_proteoform_community.families).Distinct().ToList();
            string time_stamp = SaveState.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(selected_families, SaveState.lollipop.target_proteoform_community.families,
                                                                    SaveState.lollipop.family_build_folder_path, "", time_stamp, true, 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(), SaveState.lollipop.deltaM_edge_display_rounding,
                                                                    cb_geneCentric.Checked, cmbx_geneLabel.SelectedItem.ToString());

            MessageBox.Show(message, "Cytoscape Build");
        }
Esempio n. 9
0
        private void btn_buildFamiliesAllGO_Click(object sender, EventArgs e)
        {
            Aspect a = (Aspect)cmbx_goAspect.SelectedItem;
            List <ProteoformFamily> go_families = SaveState.lollipop.getInterestingFamilies(SaveState.lollipop.goTermNumbers.Where(n => n.Aspect == a).Distinct().ToList(), SaveState.lollipop.target_proteoform_community.families);
            string time_stamp = SaveState.time_stamp();

            tb_recentTimeStamp.Text = time_stamp;
            string message = CytoscapeScript.write_cytoscape_script(go_families, SaveState.lollipop.target_proteoform_community.families,
                                                                    SaveState.lollipop.family_build_folder_path, "", time_stamp, true, 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(), SaveState.lollipop.deltaM_edge_display_rounding,
                                                                    cb_geneCentric.Checked, cmbx_geneLabel.SelectedItem.ToString());

            MessageBox.Show(message, "Cytoscape Build");
        }
        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");
        }
Esempio n. 11
0
        public void test_write_families_no_experimentals_which_shouldnt_happen()
        {
            List <ProteoformFamily> f = new List <ProteoformFamily> {
                new ProteoformFamily(ConstructorsForTesting.make_a_theoretical())
            };

            f.First().construct_family();
            string message = CytoscapeScript.write_cytoscape_script(f, f,
                                                                    TestContext.CurrentContext.TestDirectory, "", "test",
                                                                    null, false, false,
                                                                    CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                                    false, Lollipop.gene_name_labels[1]);

            Assert.True(message.Contains("Error"));
        }
Esempio n. 12
0
        public void cytoscape_script_from_subset_of_families()
        {
            Sweet.lollipop = new Lollipop();
            ProteoformCommunity community = TestProteoformFamilies.construct_two_families_with_potentially_colliding_theoreticals();

            Sweet.lollipop.target_proteoform_community = community;
            CytoscapeScript.write_cytoscape_script(new List <ProteoformFamily> {
                community.families[0]
            }, community.families,
                                                   TestContext.CurrentContext.TestDirectory, "", "test",
                                                   null, false, false,
                                                   CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                   false, Lollipop.gene_name_labels[1]);
            string[]         edge_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.edge_file_prefix + "test" + CytoscapeScript.edge_file_extension));
            HashSet <string> shared_pf_names_edges = new HashSet <string>();

            for (int i = 1; i < edge_lines.Length; i++)
            {
                if (edge_lines[i] == "")
                {
                    break;
                }
                string[] line = edge_lines[i].Split(new char[] { '\t' });
                shared_pf_names_edges.Add(line[0]);
                shared_pf_names_edges.Add(line[2]);
            }

            string[]         node_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.node_file_prefix + "test" + CytoscapeScript.node_file_extension));
            HashSet <string> shared_pf_names_nodes = new HashSet <string>();

            for (int i = 1; i < node_lines.Length; i++)
            {
                if (node_lines[i] == "")
                {
                    break;
                }
                string[] line = node_lines[i].Split(new char[] { '\t' });
                shared_pf_names_nodes.Add(line[0]);
            }

            Assert.True(shared_pf_names_nodes.All(name => shared_pf_names_edges.Contains(name)));
            Assert.True(shared_pf_names_edges.All(name => shared_pf_names_nodes.Contains(name)));
            Assert.AreEqual(community.families.First().proteoforms.Count, shared_pf_names_nodes.Count);
        }
        public void cytoscape_script_from_theoreticals()
        {
            Sweet.lollipop = new Lollipop();
            Sweet.lollipop.gene_centric_families = false;
            ProteoformCommunity community = TestProteoformFamilies.construct_two_families_with_potentially_colliding_theoreticals(false);

            Sweet.lollipop.target_proteoform_community = community;
            CytoscapeScript.write_cytoscape_script(community.families.SelectMany(f => f.theoretical_proteoforms.Where(t => t.ExpandedProteinList.Select(p => p.FullName).Contains(TestProteoformFamilies.p1_fullName))).ToArray(), community.families,
                                                   TestContext.CurrentContext.TestDirectory, "", "test",
                                                   null, false, false,
                                                   CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                   false, Lollipop.gene_name_labels[1]);
            string[]         edge_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.edge_file_prefix + "test" + CytoscapeScript.edge_file_extension));
            HashSet <string> shared_pf_names_edges = new HashSet <string>();

            for (int i = 1; i < edge_lines.Length; i++)
            {
                if (edge_lines[i] == "")
                {
                    break;
                }
                string[] line = edge_lines[i].Split(new char[] { '\t' });
                shared_pf_names_edges.Add(line[0]);
                shared_pf_names_edges.Add(line[2]);
            }

            string[]         node_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.node_file_prefix + "test" + CytoscapeScript.node_file_extension));
            HashSet <string> shared_pf_names_nodes = new HashSet <string>();

            for (int i = 1; i < node_lines.Length; i++)
            {
                if (node_lines[i] == "")
                {
                    break;
                }
                string[] line = node_lines[i].Split(new char[] { '\t' });
                shared_pf_names_nodes.Add(line[0]);
            }

            Assert.True(shared_pf_names_nodes.All(name => shared_pf_names_edges.Contains(name)));
            Assert.True(shared_pf_names_edges.All(name => shared_pf_names_nodes.Contains(name)));
            Assert.AreEqual(5, shared_pf_names_nodes.Count); //only the first family
        }
        public void cytoscape_script_from_gotermnumber()
        {
            ProteoformCommunity community = TestProteoformFamilies.construct_two_families_with_potentially_colliding_theoreticals();

            SaveState.lollipop.target_proteoform_community = community;
            CytoscapeScript.write_cytoscape_script(new GoTermNumber[] { new GoTermNumber(TestProteoformFamilies.p1_goterm, 0, 0, 0, 0) }, community.families,
                                                   TestContext.CurrentContext.TestDirectory, "", "test",
                                                   false, false, false,
                                                   CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                   false, Lollipop.gene_name_labels[1]);
            string[]         edge_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.edge_file_prefix + "test" + CytoscapeScript.edge_file_extension));
            HashSet <string> shared_pf_names_edges = new HashSet <string>();

            for (int i = 1; i < edge_lines.Length; i++)
            {
                if (edge_lines[i] == "")
                {
                    break;
                }
                string[] line = edge_lines[i].Split(new char[] { '\t' });
                shared_pf_names_edges.Add(line[0]);
                shared_pf_names_edges.Add(line[2]);
            }

            string[]         node_lines            = File.ReadAllLines(Path.Combine(TestContext.CurrentContext.TestDirectory, CytoscapeScript.node_file_prefix + "test" + CytoscapeScript.node_file_extension));
            HashSet <string> shared_pf_names_nodes = new HashSet <string>();

            for (int i = 1; i < node_lines.Length; i++)
            {
                if (node_lines[i] == "")
                {
                    break;
                }
                string[] line = node_lines[i].Split(new char[] { '\t' });
                shared_pf_names_nodes.Add(line[0]);
            }

            Assert.True(shared_pf_names_nodes.All(name => shared_pf_names_edges.Contains(name)));
            Assert.True(shared_pf_names_edges.All(name => shared_pf_names_nodes.Contains(name)));
            Assert.AreEqual(9, shared_pf_names_nodes.Count); //both families this time because they all have the same stuff...
        }
Esempio n. 15
0
        public void cytoscape_improper_build_folder()
        {
            TheoreticalProteoform  t  = ConstructorsForTesting.make_a_theoretical();
            ExperimentalProteoform e  = ConstructorsForTesting.ExperimentalProteoform("E1");
            ProteoformRelation     et = new ProteoformRelation(e, t, ProteoformComparison.ExperimentalTheoretical, 0, TestContext.CurrentContext.TestDirectory);

            e.agg_intensity = 999.99;
            e.quant.TusherValues1.numeratorIntensitySum   = 444.44m;
            e.quant.TusherValues1.denominatorIntensitySum = 333.33m;
            e.quant.intensitySum = 777.77m;
            List <ProteoformFamily> f = new List <ProteoformFamily> {
                new ProteoformFamily(e)
            };

            f.First().construct_family();
            string message = CytoscapeScript.write_cytoscape_script(f, f,
                                                                    "", "", "test",
                                                                    null, false, false,
                                                                    CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], CytoscapeScript.node_label_positions[0], Lollipop.node_positioning[0], 2,
                                                                    false, Lollipop.gene_name_labels[1]);

            Assert.False(message.StartsWith("Finished"));
        }