public void results_summary_doesnt_crash_without_initializing()
 {
     Sweet.lollipop = new Lollipop();
     Assert.True(ResultsSummaryGenerator.generate_full_report().Length > 0);
     Assert.True(ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.experimental_results_dataframe(Sweet.lollipop.target_proteoform_community, new TusherAnalysis1())).Length > 0);
     Assert.True(ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.topdown_results_dataframe()).Length > 0);
     Assert.True(ResultsSummaryGenerator.datatable_tostring(ResultsSummaryGenerator.experimental_intensities_dataframe()).Length > 0);
 }
        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 experimental_intensitites_dataframe()
        {
            Sweet.lollipop = new Lollipop();
            int id_file_index = Lollipop.file_types.ToList().IndexOf(Lollipop.file_types.Where(f => f.Contains(Purpose.Identification)).First());

            Sweet.lollipop.enter_input_files(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "05-26-17_B7A_yeast_td_fract5_rep1.xlsx") }, Lollipop.acceptable_extensions[id_file_index], Lollipop.file_types[id_file_index], Sweet.lollipop.input_files, false);
            Sweet.lollipop.enter_input_files(new string[] { Path.Combine(TestContext.CurrentContext.TestDirectory, "05-26-17_B7A_yeast_td_fract5_rep1_3columns.tsv") }, Lollipop.acceptable_extensions[id_file_index], Lollipop.file_types[id_file_index], Sweet.lollipop.input_files, false);
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).First().fraction                 = "5";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).First().biological_replicate     = "1";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).First().technical_replicate      = "1";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).First().lt_condition             = "1";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList()[1].fraction             = "5";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList()[1].biological_replicate = "1";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList()[1].technical_replicate  = "1";
            Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList()[1].lt_condition         = "1";
            Sweet.lollipop.process_raw_components(Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList(), Sweet.lollipop.raw_experimental_components, Purpose.Identification, false);
            Sweet.lollipop.aggregate_proteoforms(true, null, Sweet.lollipop.raw_experimental_components, null, 1);
            Sweet.lollipop.construct_target_and_decoy_families();
            var dt = ResultsSummaryGenerator.experimental_intensities_dataframe();

            Assert.AreEqual(111, dt.Rows.Count);
            Assert.AreEqual(10, dt.Columns.Count);
        }