Ejemplo n.º 1
0
 public HalfLifeRowDataForm(Workspace workspace)
     : base(workspace)
 {
     InitializeComponent();
     var viewContext = new TopographViewContext(workspace, typeof(HalfLifeCalculator.ProcessedRowData), new HalfLifeCalculator.ProcessedRowData[0]);
     bindingSource1.SetViewContext(viewContext);
 }
Ejemplo n.º 2
0
 public ResultsPerGroupForm(Workspace workspace)
     : base(workspace)
 {
     InitializeComponent();
     foreach (var evviesFilter in Enum.GetValues(typeof(EvviesFilterEnum)))
     {
         comboEvviesFilter.Items.Add(evviesFilter);
     }
     comboEvviesFilter.SelectedIndex = 0;
     bindingSource1.SetViewContext(_viewContext = new TopographViewContext(Workspace, typeof(DisplayRow), new DisplayRow[0], new[]{GetDefaultViewSpec(cbxByProtein.Checked)}));
     HalfLifeSettings = Settings.Default.HalfLifeSettings;
 }
Ejemplo n.º 3
0
 private void btnRequery_Click(object sender, EventArgs e)
 {
     var halfLifeCalculator = new HalfLifeCalculator(Workspace, HalfLifeSettings)
                                  {
                                      ByFile = cbxGroupByFile.Checked,
                                  };
     using (var longWaitDialog = new LongWaitDialog(TopLevelControl, "Calculating Half Lives"))
     {
         var longOperationBroker = new LongOperationBroker(halfLifeCalculator.Run, longWaitDialog);
         if (!longOperationBroker.LaunchJob())
         {
             return;
         }
     }
     bool byCohort = cbxGroupByCohort.Checked;
     bool byTimePoint = cbxGroupByTimePoint.Checked;
     bool bySample = cbxGroupBySample.Checked;
     bool byFile = cbxGroupByFile.Checked;
     var displayRows = new List<DisplayRow>();
     foreach (var resultRow in halfLifeCalculator.ResultRows)
     {
         var displayRow = new DisplayRow(halfLifeCalculator, resultRow);
         var rowDatasByCohort = new Dictionary<GroupKey, List<HalfLifeCalculator.ProcessedRowData>>();
         foreach (var halfLife in resultRow.HalfLives)
         {
             if (resultRow.HalfLives.Count > 1 && string.IsNullOrEmpty(halfLife.Key) != byCohort)
             {
                 continue;
             }
             foreach (var rowData in halfLife.Value.FilteredRowDatas)
             {
                 GroupKey cohortKey = new GroupKey(
                     byCohort ? rowData.RawRowData.MsDataFile.Cohort : null,
                     byTimePoint ? rowData.RawRowData.MsDataFile.TimePoint : null,
                     bySample ? rowData.RawRowData.MsDataFile.Sample : null,
                     byFile ? rowData.RawRowData.MsDataFile.Name : null);
                 List<HalfLifeCalculator.ProcessedRowData> list;
                 if (!rowDatasByCohort.TryGetValue(cohortKey, out list))
                 {
                     list = new List<HalfLifeCalculator.ProcessedRowData>();
                     rowDatasByCohort.Add(cohortKey, list);
                 }
                 list.Add(rowData);
             }
         }
         foreach (var cohortRowDatas in rowDatasByCohort)
         {
             displayRow.Results.Add(cohortRowDatas.Key, new GroupResult(this, displayRow, cohortRowDatas.Key, new ResultData(cohortRowDatas.Value)));
         }
         displayRows.Add(displayRow);
     }
     var viewInfo = bindingSource1.ViewInfo;
     var dataSchema = new TopographDataSchema(Workspace);
     if (viewInfo == null || "default" == viewInfo.Name)
     {
         viewInfo= new ViewInfo(ColumnDescriptor.RootColumn(dataSchema, typeof(DisplayRow)),
             GetDefaultViewSpec(halfLifeCalculator.ByProtein));
     }
     var viewContext = new TopographViewContext(Workspace, typeof (DisplayRow), displayRows,
         GetDefaultViewSpec(halfLifeCalculator.ByProtein));
     bindingSource1.SetViewContext(viewContext, viewInfo);
     bindingSource1.RowSource = displayRows;
     dataGridViewSummary.Rows.Clear();
     SetSummary("Tracer %", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values
         .Select(cohortResult=>cohortResult.GetResultData().TracerPercentByArea)));
     SetSummary("Precursor Enrichment", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values
         .Select(cohortResult=>cohortResult.GetResultData().IndPrecursorEnrichment)));
     SetSummary("Turnover", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values
         .Select(cohortResult=>cohortResult.GetResultData().IndTurnover)));
     SetSummary("Area Under Curve", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values
         .Select(cohortResult=>cohortResult.GetResultData().AreaUnderCurve)));
 }