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); }
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); }
public void results_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.target_proteoform_community.families = new List <ProteoformFamily> { f }; string[] lines = ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.experimental_results_dataframe(Sweet.lollipop.target_proteoform_community, Sweet.lollipop.TusherAnalysis1)).Split(new string[] { Environment.NewLine }, StringSplitOptions.None); Assert.True(lines.Count() == 3); Assert.True(lines.Any(a => a.Contains("E1"))); TopDownProteoform td = ConstructorsForTesting.TopDownProteoform("TD1", 1000, 10); td.linked_proteoform_references = new List <Proteoform>(new List <Proteoform> { ConstructorsForTesting.make_a_theoretical() }); td.ptm_set = e.linked_proteoform_references.Last().ptm_set; ProteoformFamily f2 = new ProteoformFamily(td); f2.construct_family(); Sweet.lollipop.target_proteoform_community.families = new List <ProteoformFamily> { f2 }; Sweet.lollipop.topdown_proteoforms = new List <TopDownProteoform>() { td }; lines = ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.experimental_results_dataframe(Sweet.lollipop.target_proteoform_community, Sweet.lollipop.TusherAnalysis1)).Split(new string[] { Environment.NewLine }, StringSplitOptions.None); Assert.True(lines.Count() == 3); lines = ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.topdown_results_dataframe()).Split(new string[] { Environment.NewLine }, StringSplitOptions.None); Assert.True(lines.Count() == 3); Assert.True(lines.Any(a => a.Contains("TD1"))); Sweet.lollipop.target_proteoform_community.families = new List <ProteoformFamily> { f, f2 }; lines = ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.experimental_intensities_dataframe()).Split(new string[] { Environment.NewLine }, StringSplitOptions.None); Assert.AreEqual(lines.Count(), 4); Assert.True(lines.Any(a => a.Contains("E1"))); Assert.True(lines.Any(a => a.Contains("TD1"))); }
public void nodes_table_gives_meaningful_unmodified_theoreticals() { Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.unmodified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }
public void nodes_table_gives_meaningful_topdown() { TopDownProteoform t = ConstructorsForTesting.TopDownProteoform("ACC", 999.99, 50); ProteoformFamily f = new ProteoformFamily(t); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains("ACC")); Assert.True(node_table.Contains("999.99")); }
public void results_dataframe_with_something() { 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(); SaveState.lollipop.target_proteoform_community.families = new List <ProteoformFamily> { f }; string[] lines = ResultsSummaryGenerator.results_dataframe().Split(new string[] { Environment.NewLine }, StringSplitOptions.None); Assert.True(lines.Count() == 3); Assert.True(lines.Any(a => a.Contains("E1"))); }
public void nodes_table_gives_meaningful_experimentals() { ExperimentalProteoform e = ConstructorsForTesting.ExperimentalProteoform("E1"); e.agg_intensity = 999.99; e.agg_mass = 888.88; e.agg_rt = 777.77; ProteoformFamily f = new ProteoformFamily(e); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains("E1")); Assert.True(node_table.Contains("999.99")); }
public void nodes_table_gives_meaningful_modified_theoreticals2() { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); Modification m = new Modification("id", _modificationType: "modtype", _target: motif, _locationRestriction: "Anywhere.", _monoisotopicMass: 1); Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, null, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.modified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }
public void nodes_table_gives_meaningful_modified_theoreticals2() { ModificationMotif motif; ModificationMotif.TryGetMotif("K", out motif); ModificationWithMass m = new ModificationWithMass("oxidation", new Tuple <string, string>("", ""), motif, ModificationSites.K, 1, new Dictionary <string, IList <string> >(), new List <double>(), new List <double>(), ""); Proteoform p = ConstructorsForTesting.make_a_theoretical(); ProteoformFamily f = new ProteoformFamily(p); f.construct_family(); string node_table = CytoscapeScript.get_cytoscape_nodes_tsv(new List <ProteoformFamily> { f }, false, CytoscapeScript.color_scheme_names[0], Lollipop.edge_labels[0], Lollipop.node_labels[0], Lollipop.node_positioning[0], 2, f.theoretical_proteoforms, false, Lollipop.gene_name_labels[1]); Assert.True(node_table.Contains(CytoscapeScript.modified_theoretical_label)); Assert.AreNotEqual(f.theoretical_proteoforms[0].accession, CytoscapeScript.get_proteoform_shared_name(p, Lollipop.node_labels[0], 2)); }
public void get_interesting_goterm_families() { Sweet.lollipop = new Lollipop(); Sweet.lollipop.theoretical_database.aaIsotopeMassList = new AminoAcidMasses(Sweet.lollipop.carbamidomethylation, Sweet.lollipop.neucode_labeled).AA_Masses; Sweet.lollipop.significance_by_permutation = true; Sweet.lollipop.significance_by_log2FC = false; DatabaseReference d1 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); DatabaseReference d2 = new DatabaseReference("GO", "GO:2", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:2") }); DatabaseReference d3 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); GoTerm g1 = new GoTerm(d1); GoTerm g2 = new GoTerm(d2); GoTerm g3 = new GoTerm(d3); ProteinWithGoTerms p1 = new ProteinWithGoTerms("ASDF", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d1 }, new List <GoTerm> { g1 }); ProteinWithGoTerms p2 = new ProteinWithGoTerms("ASDF", "T2", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d2 }, new List <GoTerm> { g2 }); ProteinWithGoTerms p3 = new ProteinWithGoTerms("ASDF", "T3", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d3 }, new List <GoTerm> { g3 }); Dictionary <InputFile, Protein[]> dict = new Dictionary <InputFile, Protein[]> { { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p1 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p2 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p3 } }, }; ExperimentalProteoform e1 = ConstructorsForTesting.ExperimentalProteoform("E"); ExperimentalProteoform e2 = ConstructorsForTesting.ExperimentalProteoform("E"); e1.quant.intensitySum = 1; e1.quant.TusherValues1.significant = true; e1.quant.tusherlogFoldChange = 1; e2.quant.intensitySum = 1; e2.quant.TusherValues1.significant = true; e2.quant.tusherlogFoldChange = 1; TheoreticalProteoform t = ConstructorsForTesting.make_a_theoretical("T1_T1_asdf", p1, dict); TheoreticalProteoform u = ConstructorsForTesting.make_a_theoretical("T2_T1_asdf_asdf", p2, dict); TheoreticalProteoform v = ConstructorsForTesting.make_a_theoretical("T3_T1_asdf_Asdf_Asdf", p3, dict); t.ExpandedProteinList = new List <ProteinWithGoTerms> { p1 }; u.ExpandedProteinList = new List <ProteinWithGoTerms> { p2 }; v.ExpandedProteinList = new List <ProteinWithGoTerms> { p3 }; t.begin = 1; t.end = 1; u.begin = 1; u.end = 1; v.begin = 1; v.end = 1; make_relation(e1, t); //make_relation(e1, v); // we don't allow this to happen anymore... we only allow one ET conntection per E make_relation(e2, u); ProteoformFamily f = new ProteoformFamily(e1); // two theoreticals with the same GoTerms... expecting one GoTerm number but two theoretical proteins (now only one) ProteoformFamily h = new ProteoformFamily(e2); f.construct_family(); f.identify_experimentals(); h.construct_family(); h.identify_experimentals(); List <ProteoformFamily> families = new List <ProteoformFamily> { f, h }; t.family = f; v.family = f; e1.family = f; u.family = h; e2.family = h; List <ExperimentalProteoform> fake_significant = new List <ExperimentalProteoform> { e1 }; List <ProteinWithGoTerms> significant_proteins = Sweet.lollipop.getInducedOrRepressedProteins(fake_significant, Sweet.lollipop.TusherAnalysis1.GoAnalysis); List <GoTermNumber> gtn = Sweet.lollipop.TusherAnalysis1.GoAnalysis.getGoTermNumbers(significant_proteins, new List <ProteinWithGoTerms> { p1, p2, p3 }); Assert.AreEqual(1, significant_proteins.Count); Assert.AreEqual(1, gtn.Count); Assert.AreEqual("1", gtn.First().Id); Assert.AreEqual(0 - (decimal)Math.Log(2d / 3d, 2), gtn.First().log_odds_ratio); List <ProteoformFamily> fams = Sweet.lollipop.getInterestingFamilies(gtn, families); Assert.AreEqual(1, fams.Count); Assert.AreEqual(1, fams[0].theoretical_proteoforms.Count); }
public void test_goterm_analysis_with_custom_list() { Sweet.lollipop = new Lollipop(); Sweet.lollipop.theoretical_database.aaIsotopeMassList = new AminoAcidMasses(Sweet.lollipop.carbamidomethylation, Sweet.lollipop.neucode_labeled).AA_Masses; Sweet.lollipop.significance_by_permutation = true; Sweet.lollipop.significance_by_log2FC = false; DatabaseReference d1 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); DatabaseReference d2 = new DatabaseReference("GO", "GO:2", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:2") }); DatabaseReference d3 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); GoTerm g1 = new GoTerm(d1); GoTerm g2 = new GoTerm(d2); GoTerm g3 = new GoTerm(d3); ProteinWithGoTerms p1 = new ProteinWithGoTerms("ASDF", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d1 }, new List <GoTerm> { g1 }); ProteinWithGoTerms p2 = new ProteinWithGoTerms("ASDF", "T2", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d2 }, new List <GoTerm> { g2 }); ProteinWithGoTerms p3 = new ProteinWithGoTerms("ASDF", "T3", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new List <ProteolysisProduct> { new ProteolysisProduct(0, 0, "") }, "T2", "T3", true, false, new List <DatabaseReference> { d3 }, new List <GoTerm> { g3 }); Dictionary <InputFile, Protein[]> dict = new Dictionary <InputFile, Protein[]> { { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p1 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p2 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p3 } }, }; ExperimentalProteoform e1 = ConstructorsForTesting.ExperimentalProteoform("E"); ExperimentalProteoform e2 = ConstructorsForTesting.ExperimentalProteoform("E"); e1.quant.intensitySum = 1; e1.quant.TusherValues1.significant = true; e1.quant.tusherlogFoldChange = 1; e2.quant.intensitySum = 1; e2.quant.TusherValues1.significant = true; e2.quant.tusherlogFoldChange = 1; TheoreticalProteoform t = ConstructorsForTesting.make_a_theoretical("T1_T1_asdf", p1, dict); TheoreticalProteoform u = ConstructorsForTesting.make_a_theoretical("T2_T1_asdf_asdf", p2, dict); TheoreticalProteoform v = ConstructorsForTesting.make_a_theoretical("T3_T1_asdf_Asdf_Asdf", p3, dict); t.ExpandedProteinList = new List <ProteinWithGoTerms> { p1 }; u.ExpandedProteinList = new List <ProteinWithGoTerms> { p2 }; v.ExpandedProteinList = new List <ProteinWithGoTerms> { p3 }; make_relation(e1, t); make_relation(e1, v); make_relation(e2, u); ProteoformFamily f = new ProteoformFamily(e1); // two theoreticals with the same GoTerms... expecting one GoTerm number but two theoretical proteins ProteoformFamily h = new ProteoformFamily(e2); f.construct_family(); f.identify_experimentals(); h.construct_family(); h.identify_experimentals(); List <ProteoformFamily> families = new List <ProteoformFamily> { f, h }; t.family = f; v.family = f; e1.family = f; u.family = h; e2.family = h; Sweet.lollipop.TusherAnalysis1.inducedOrRepressedProteins = Sweet.lollipop.getInducedOrRepressedProteins(new List <ExperimentalProteoform> { e1 }, Sweet.lollipop.TusherAnalysis1.GoAnalysis); Sweet.lollipop.TusherAnalysis1.GoAnalysis.allTheoreticalProteins = true; Sweet.lollipop.theoretical_database.expanded_proteins = new ProteinWithGoTerms[] { p1, p2, p3 }; Sweet.lollipop.TusherAnalysis1.GoAnalysis.backgroundProteinsList = Path.Combine(TestContext.CurrentContext.TestDirectory, "test_protein_list.txt"); Sweet.lollipop.TusherAnalysis1.GoAnalysis.GO_analysis(Sweet.lollipop.TusherAnalysis1.inducedOrRepressedProteins); Assert.AreEqual(1, Sweet.lollipop.TusherAnalysis1.inducedOrRepressedProteins.Count); // only taking one ET connection by definition in forming ET relations; only one is used in identify theoreticals Assert.AreEqual(1, Sweet.lollipop.TusherAnalysis1.GoAnalysis.goTermNumbers.Count); Assert.AreEqual("1", Sweet.lollipop.TusherAnalysis1.GoAnalysis.goTermNumbers.First().Id); Assert.AreEqual(0 - (decimal)Math.Log(2d / 3d, 2), Sweet.lollipop.TusherAnalysis1.GoAnalysis.goTermNumbers.First().log_odds_ratio); List <ProteoformFamily> fams = Sweet.lollipop.getInterestingFamilies(Sweet.lollipop.TusherAnalysis1.GoAnalysis.goTermNumbers, families); Assert.AreEqual(1, fams.Count); Assert.AreEqual(2, fams[0].theoretical_proteoforms.Count); }
public void get_interesting_goterm_families() { SaveState.lollipop = new Lollipop(); DatabaseReference d1 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); DatabaseReference d2 = new DatabaseReference("GO", "GO:2", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:2") }); DatabaseReference d3 = new DatabaseReference("GO", "GO:1", new List <Tuple <string, string> > { new Tuple <string, string>("term", "P:1") }); GoTerm g1 = new GoTerm(d1); GoTerm g2 = new GoTerm(d2); GoTerm g3 = new GoTerm(d3); ProteinWithGoTerms p1 = new ProteinWithGoTerms("", "T1", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new int?[] { 0 }, new int?[] { 0 }, new string[] { "" }, "T2", "T3", true, false, new List <DatabaseReference> { d1 }, new List <GoTerm> { g1 }); ProteinWithGoTerms p2 = new ProteinWithGoTerms("", "T2", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new int?[] { 0 }, new int?[] { 0 }, new string[] { "" }, "T2", "T3", true, false, new List <DatabaseReference> { d2 }, new List <GoTerm> { g2 }); ProteinWithGoTerms p3 = new ProteinWithGoTerms("", "T3", new List <Tuple <string, string> > { new Tuple <string, string>("", "") }, new Dictionary <int, List <Modification> >(), new int?[] { 0 }, new int?[] { 0 }, new string[] { "" }, "T2", "T3", true, false, new List <DatabaseReference> { d3 }, new List <GoTerm> { g3 }); Dictionary <InputFile, Protein[]> dict = new Dictionary <InputFile, Protein[]> { { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p1 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p2 } }, { new InputFile("fake.txt", Purpose.ProteinDatabase), new Protein[] { p3 } }, }; ExperimentalProteoform e1 = ConstructorsForTesting.ExperimentalProteoform("E"); ExperimentalProteoform e2 = ConstructorsForTesting.ExperimentalProteoform("E"); e1.quant.intensitySum = 1; e1.quant.FDR = 0; e1.quant.logFoldChange = 1; e2.quant.intensitySum = 1; e2.quant.FDR = 0; e2.quant.logFoldChange = 1; TheoreticalProteoform t = ConstructorsForTesting.make_a_theoretical("T1_T1_asdf", p1, dict); TheoreticalProteoform u = ConstructorsForTesting.make_a_theoretical("T2_T1_asdf_asdf", p2, dict); TheoreticalProteoform v = ConstructorsForTesting.make_a_theoretical("T3_T1_asdf_Asdf_Asdf", p3, dict); t.ExpandedProteinList = new List <ProteinWithGoTerms> { p1 }; u.ExpandedProteinList = new List <ProteinWithGoTerms> { p2 }; v.ExpandedProteinList = new List <ProteinWithGoTerms> { p3 }; make_relation(e1, t); //make_relation(e1, v); // we don't allow this to happen anymore... we only allow one ET conntection per E make_relation(e2, u); ProteoformFamily f = new ProteoformFamily(e1); // two theoreticals with the same GoTerms... expecting one GoTerm number but two theoretical proteins (now only one) ProteoformFamily h = new ProteoformFamily(e2); f.construct_family(); f.identify_experimentals(); h.construct_family(); h.identify_experimentals(); List <ProteoformFamily> families = new List <ProteoformFamily> { f, h }; t.family = f; v.family = f; e1.family = f; u.family = h; e2.family = h; List <ExperimentalProteoform> fake_significant = new List <ExperimentalProteoform> { e1 }; List <ProteinWithGoTerms> significant_proteins = SaveState.lollipop.getInducedOrRepressedProteins(fake_significant, 0, 1, 0); List <GoTermNumber> gtn = SaveState.lollipop.getGoTermNumbers(significant_proteins, new List <ProteinWithGoTerms> { p1, p2, p3 }); Assert.AreEqual(1, significant_proteins.Count); Assert.AreEqual(1, gtn.Count); Assert.AreEqual("1", gtn.First().Id); Assert.AreEqual(0 - (decimal)Math.Log(2d / 3d, 2), gtn.First().log_odds_ratio); List <ProteoformFamily> fams = SaveState.lollipop.getInterestingFamilies(gtn, families); Assert.AreEqual(1, fams.Count); Assert.AreEqual(1, fams[0].theoretical_proteoforms.Count); }