public cExtendedTable GetPropertyTable() { cExtendedTable ToReturn = new cExtendedTable(); ToReturn.Name = this.Name + " - Properties"; cExtendedList Properties = new cExtendedList("Properties"); ToReturn.Add(Properties); ToReturn.ListRowNames = new List<string>(); ToReturn.ListRowNames.Add("Dimension X"); Properties.Add(this.Width); ToReturn.ListRowNames.Add("Dimension Y"); Properties.Add(this.Height); ToReturn.ListRowNames.Add("Dimension Z"); Properties.Add(this.Depth); ToReturn.ListRowNames.Add("Voxel Size X"); Properties.Add(this.Resolution.X); ToReturn.ListRowNames.Add("Voxel Size Y"); Properties.Add(this.Resolution.Y); ToReturn.ListRowNames.Add("Voxel Size Z"); Properties.Add(this.Resolution.Z); ToReturn.ListRowNames.Add("Position X"); Properties.Add(this.Position.X); ToReturn.ListRowNames.Add("Position Y"); Properties.Add(this.Position.Y); ToReturn.ListRowNames.Add("Position Z"); Properties.Add(this.Position.Z); ToReturn.ListRowNames.Add("Channel Numbers"); Properties.Add(this.GetNumChannels()); for (int i = 0; i < this.GetNumChannels(); i++) { ToReturn.ListRowNames.Add(this.SingleChannelImage[i].Name + " - Wavelenght"); Properties.Add(i); } return ToReturn; }
public cExtendedTable GetLiveListValues() { cExtendedTable CET = new cExtendedTable(); CET.Name = Input.Name; //foreach (DataGridViewColumn item in GridView.SelectedColumns) for (int ColumnSelected = 0; ColumnSelected < GridView.SelectedColumns.Count; ColumnSelected++) { CET.Add(new cExtendedList()); for (int i = 0; i < GridView.Rows.Count - 1; i++) { CET[ColumnSelected].Add(double.Parse(GridView[GridView.SelectedColumns[ColumnSelected].Index, i].Value.ToString())); } //GridView[item.Index, //CET.Add(); } //GridView.SelectedColumns return CET; }
private void dToolStripMenuItemScatterPlot3D_Click(object sender, EventArgs e) { int MaxNumberOfPts = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownMinNumPointForFastDisp.Value; if (cGlobalInfo.CurrentScreening.ListPlatesActive.GetListActiveWells().Count > MaxNumberOfPts) { cExtendedTable ET = cGlobalInfo.CurrentScreening.ListPlatesActive.GetListActiveWells().GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false); cNormalize N = new cNormalize(); N.SetInputData(ET); N.NormalizationType = eNormalizationType.MIN_MAX; N.Run(); cExtendedTable NormTable = N.GetOutPut(); cViewer3D V3D = new cViewer3D(); c3DPointCloud _3DPtCloud = new c3DPointCloud(NormTable); _3DPtCloud.AutomatedPtColorMode = 1; _3DPtCloud.Create(new cPoint3D(0, 0, 0)); _3DPtCloud.SetName("_3DPtCloud"); cListGeometric3DObject GlobalList = new cListGeometric3DObject("3D Point Cloud MetaObject"); GlobalList.Add(_3DPtCloud); c3DObject_Axis Axis = new c3DObject_Axis(); cExtendedTable T = new cExtendedTable(); T.Add(new cExtendedList(ET[0].Name)); T[0].Tag = ET[0].Tag; T[0].Add(0); T[0].Add(1); T.Add(new cExtendedList(ET[1].Name)); T[1].Tag = ET[1].Tag; T[1].Add(0); T[1].Add(1); if (ET.Count > 2) { T.Add(new cExtendedList(ET[2].Name)); T[2].Tag = ET[2].Tag; T[2].Add(0); T[2].Add(1); } Axis.SetInputData(T); c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1)); Axis.Run(MyWorld); GlobalList.AddRange(Axis.GetOutPut()); // GlobalList.Add(Axis); foreach (var item in GlobalList) { MyWorld.AddGeometric3DObject(item); } // MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor; V3D.SetInputData(MyWorld); V3D.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(V3D.GetOutPut()); DTW.Title = "3D Cloud Point - " + ET[0].Count + " points"; DTW.Run(); DTW.Display(); } else { cGlobalInfo.OptionsWindow.checkBoxConnectDRCPts.Checked = false; FormFor3DDataDisplay FormToDisplayXYZ = new FormFor3DDataDisplay(ProcessModeEntireScreeningToolStripMenuItem.Checked, cGlobalInfo.CurrentScreening); for (int i = 0; i < (int)cGlobalInfo.CurrentScreening.ListDescriptors.Count; i++) { FormToDisplayXYZ.comboBoxDescriptorX.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName()); FormToDisplayXYZ.comboBoxDescriptorY.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName()); FormToDisplayXYZ.comboBoxDescriptorZ.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName()); } FormToDisplayXYZ.Show(); FormToDisplayXYZ.comboBoxDescriptorX.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " "; FormToDisplayXYZ.comboBoxDescriptorY.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " "; FormToDisplayXYZ.comboBoxDescriptorZ.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " "; } return; }
private void sigmoidFittToolStripMenuItem_Click(object sender, EventArgs e) { int NumberOfReplicate = 4; int NumberOfCurves = 30; int DRCNumberofPoints = 12; cExtendedTable FullResults = new cExtendedTable(); FullResults.ListRowNames = new List<string>(); double RealEC50 = 0.0001; int NumberOfDiffEC50 = 20; int NumberOfSlopes = 100; // for (int EC50 = 0; EC50 < NumberOfDiffEC50; EC50++) { //double TmpSlopeValue = 0.0; for (int EC50 = 0; EC50 < NumberOfDiffEC50; EC50++) //for (int SlopeTmp = 0; SlopeTmp < NumberOfSlopes; SlopeTmp++) { RealEC50 *= 2; //TmpSlopeValue += 0.1; cExtendedList ListPValues = new cExtendedList("EC50 - " + RealEC50/*TmpSlopeValue*/); cDesignerTab DT = new cDesignerTab(); DT.IsMultiline = false; cDataGeneratorTitration GT = new cDataGeneratorTitration(); GT.NumberOfPoint = DRCNumberofPoints; GT.Start = 5; GT.DilutionFactor = 2; GT.Run(); Random RND = new Random(); //cExtendedTable EXT = new cExtendedTable(); //EXT.ListRowNames = new List<string>(); //EXT.Name = "Quality fitting Report"; //EXT.Add(new cExtendedList("Noise Level")); //EXT.Add(new cExtendedList("Original EC50")); //EXT.Add(new cExtendedList("Estimated EC50")); //EXT.Add(new cExtendedList("p-Value")); for (int i = 0; i < NumberOfCurves; i++) { cExtendedTable FinalTable = new cExtendedTable(); cDataGeneratorSigmoid DGS = null; DGS = new cDataGeneratorSigmoid(); DGS.SetInputData(GT.GetOutPut()[0]); DGS.EC50 = RealEC50;// 0.01;// 1;// 0.1;// Math.Pow((double)10, -2); DGS.Bottom = 0; DGS.Top = 100; DGS.Slope = 2;// TmpSlopeValue;//1; DGS.Run(); cAddNoise AN = new cAddNoise(); AN.DistributionType = eRandDistributionType.GAUSSIAN; double NoiseLevel = (i + 1) * 5; // EXT[0].Add(NoiseLevel); // EXT[1].Add(DGS.EC50); #region loop over the replicates for (int NumReplic = 0; NumReplic < NumberOfReplicate; NumReplic++) { //AN.Mean = 0; //AN.Stdv = 10; //AN.SetInputData(DGS.GetOutPut()); //AN.Run(); cExtendedList NewL = DGS.GetOutPut()[1]; for (int k = 0; k < NewL.Count; k++) { NewL[k] += RND.NextDouble() * NoiseLevel; } cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(GT.GetOutPut()[0]); TmpTable.Add(/*AN.GetOutPut()[1]*/NewL); if (NumReplic >= 1) { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(TmpTable, FinalTable); M.Run(); FinalTable = M.GetOutPut(); } else FinalTable = new cExtendedTable(TmpTable); } #endregion //cListWell LW = new cListWell(null); //foreach (cWell item in CompleteScreening.GetCurrentDisplayPlate().ListActiveWells) //{ // if (item.GetClassIdx() == 0) // LW.Add(item); //} //cExtendedTable ET = LW.GetDescriptorValues(CompleteScreening.ListDescriptors.GetActiveDescriptors(), true); cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(FinalTable); CFG.Run(); // compute ANOVA cANOVA S = new cANOVA(); cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1); S.SignificanceThreshold = 1E-11; S.SetInputData(NewTable); S.Run(); //cLinearRegression LR = new cLinearRegression(); //LR.SetInputData(FinalTable); //LR.Run(); cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(FinalTable); if (SF.Run().IsSucceed == false) continue; // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1]; cExtendedTable Sigmoid = SF.GetFittedRawValues(GT.GetOutPut()[0]); FinalTable[0] = Sigmoid[1]; cDesignerSplitter DS = new cDesignerSplitter(); ////cViewerTableAsRichText VT = new cViewerTableAsRichText(); cViewerTable VT = new cViewerTable(); cExtendedTable TableResults = SF.GetOutPut(); TableResults[0].Add(S.GetOutPut()[0][0]); ListPValues.Add(S.GetOutPut()[0][0]); TableResults[0].Add(S.GetOutPut()[0][1]); TableResults.ListRowNames.Add("p-Value"); TableResults.ListRowNames.Add("Null hyp. rejected?"); VT.SetInputData(TableResults); VT.DigitNumber = -1; VT.Run(); cViewerGraph1D VS1 = new cViewerGraph1D(); VS1.SetInputData(new cExtendedTable(Sigmoid[1])); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0];//DGS.GetOutPut()[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = true; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = "Readout"; VS1.Chart.XAxisFormatDigitNumber = -1; VS1.Chart.IsZoomableX = true; //Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]); //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/); //VS1.Chart.ListVerticalLines.Add(VLForEC50); //VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[FinalTable.Count]; //EXT[2].Add(SF.GetOutPut()[0][2]); //EXT[3].Add(S.GetOutPut()[0][0]); //for (int IdxCurve = 0; IdxCurve < FinalTable.Count; IdxCurve++) //{ // cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign(); // TmpSerieInfo.color = Color.FromArgb(100, GlobalInfo.ListCellularPhenotypes[IdxCurve % GlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay); // TmpSerieInfo.markerStyle = MarkerStyle.Circle; // VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo; //} VS1.Run(); DS.SetInputData(VS1.GetOutPut()); DS.SetInputData(VT.GetOutPut()); DS.Orientation = Orientation.Horizontal; DS.Title = "Noise Stdev " + NoiseLevel; DS.Run(); DT.SetInputData(DS.GetOutPut()); // EXT.ListRowNames.Add(DS.Title); } DT.Run(); //cDisplayToWindow DTW = new cDisplayToWindow(); //DTW.SetInputData(DT.GetOutPut()); //DTW.Run(); //DTW.Display(); //cDisplayExtendedTable DET = new cDisplayExtendedTable(); //DET.SetInputData(EXT); //DET.DigitNumber = -1; //DET.Run(); FullResults.Add(ListPValues); } } cDisplayExtendedTable DET = new cDisplayExtendedTable(); DET.SetInputData(FullResults); DET.DigitNumber = -1; DET.Run(); }
private void histogramsToolStripMenuItem_Click(object sender, EventArgs e) { cGUI_ListClasses GUIClasses = new cGUI_ListClasses(); GUIClasses.IsCheckBoxes = false; GUIClasses.ClassType = eClassType.PHENOTYPE; if (!GUIClasses.Run().IsSucceed) return; cGUI_ListClasses GUIClassesWells = new cGUI_ListClasses(); GUIClassesWells.IsCheckBoxes = true; GUIClassesWells.ClassType = eClassType.WELL; if (!GUIClassesWells.Run().IsSucceed) return; List<cWellClassType> ListClass = new List<cWellClassType>(); for (int i = 0; i < GUIClassesWells.GetOutPut()[0].Count; i++) { if (GUIClassesWells.GetOutPut()[0][i] == 1) ListClass.Add(cGlobalInfo.ListWellClasses[i]); } cGUI_ListPlates GUIListPlates = new cGUI_ListPlates(); GUIListPlates.IsCheckBoxes = true; if (!GUIListPlates.Run().IsSucceed) return; List<cDescriptorType> LCDT = new List<cDescriptorType>(); LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor()); cDesignerTab DT = new cDesignerTab(); DT.IsMultiline = false; foreach (var TmpPlate in GUIListPlates.GetOutPut()) { cListWells CurrentPlateListWells = TmpPlate.ListWells.Filter(ListClass); cExtendedTable FinalTable = new cExtendedTable(); FinalTable.Name = TmpPlate.GetName() + " - " + CurrentPlateListWells.Count + " wells"; for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++) { if (GUIClasses.GetOutPut()[0][i] == 1) { FinalTable.Add(new cExtendedList()); FinalTable[0].Name = cGlobalInfo.ListCellularPhenotypes[i].Name; FinalTable[0].Tag = cGlobalInfo.ListCellularPhenotypes[i]; } } foreach (cWell TmpWell in CurrentPlateListWells) { TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName); for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++) { if (GUIClasses.GetOutPut()[0][i] == 1) { List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>(); ListCellularPhenotypesToBeSelected.Add(cGlobalInfo.ListCellularPhenotypes[i]); cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell, LCDT, ListCellularPhenotypesToBeSelected); if (TmpET.Count > 0) FinalTable[0].AddRange(TmpET[0]); break; } } TmpWell.AssociatedPlate.DBConnection.CloseConnection(); } cViewerHistogram VH = new cViewerHistogram(); //cViewerStackedHistogram VSH = new cViewerStackedHistogram(); VH.SetInputData(FinalTable); //VH.Chart.BinNumber = -1; //VSH.Chart.Is //VH.ListProperties.FindByName("Bin Number").SetNewValue((int)100); //VH.ListProperties.FindByName("Bin Number").IsGUIforValue = true; // VSH.Chart.BinNumber = LCDT[0].GetBinNumber(); VH.Chart.IsShadow = false; VH.Chart.IsBorder = true; VH.Chart.IsXGrid = true; VH.Chart.IsHistoNormalized = true; VH.Chart.IsBar = true; VH.Chart.IsYGrid = true; VH.Chart.LabelAxisX = LCDT[0].GetName(); VH.Title = TmpPlate.GetName(); VH.Run(); VH.Chart.Width = 0; VH.Chart.Height = 0; cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VH.GetOutPut()); cHistogramBuilder HB = new cHistogramBuilder(); HB.SetInputData(FinalTable); HB.BinNumber = -1; HB.IsNormalized = true; HB.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(HB.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); //DS.SetInputData(HB.Get DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(DT.GetOutPut()); DTW.Title = "Single cell based Histograms"; DTW.Run(); DTW.Display(); }
private void statisticsToolStripMenuItem1_Click_1(object sender, EventArgs e) { string NameFunction = ""; if (_StatCVItem.Checked) NameFunction = "Coeff. of Variation"; else if (_StatMeanItem.Checked) NameFunction = "Mean"; else if (_StatSumItem.Checked) NameFunction = "Sum"; else if (_StatJarqueBeraItem.Checked) NameFunction = "Jarque-Bera"; cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses(); GUI_ListClasses.IsCheckBoxes = true; GUI_ListClasses.IsSelectAll = true; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedTable ListClassSelected = new cExtendedTable(GUI_ListClasses.GetOutPut());// GetOutPut(); int IdxClass = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClass = IdxC; } #region single plate and plate by plate cDesignerTab DT = new cDesignerTab(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); } else ListPlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 3)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedList ListValues = new cExtendedList(); List<cDescriptorType> ListDescs = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForValues = new cExtendedTable(); TableForValues.Add(NewTable1[RealIdx]); RealIdx++; if (_StatJarqueBeraItem.Checked) { cNormalityJarqueBera JB = new cNormalityJarqueBera(); JB.SetInputData(TableForValues); JB.Run(); ListValues.Add(JB.GetOutPut()[0][0]); } else { cStatistics CS = new cStatistics(); CS.UnselectAll(); if (_StatCVItem.Checked) CS.IsCV = true; else if (_StatMeanItem.Checked) CS.IsMean = true; else if (_StatSumItem.Checked) CS.IsSum = true; CS.SetInputData(TableForValues); CS.Run(); ListValues.Add(CS.GetOutPut()[0][0]); } ListDescs.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListValues)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescs); ET.Name = TmpPlate.GetName() + "\n" + NameFunction + " - " + cGlobalInfo.ListWellClasses[IdxClass].Name + " (" + NewTable1[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = NameFunction; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Title = TmpPlate.GetName(); VG1.Run(); DT.SetInputData(VG1.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) CDW.Title = NameFunction + " - " + ListPlatesToProcess[0].GetName(); else CDW.Title = NameFunction + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } #endregion #region entire screening else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); cExtendedList ListZ = new cExtendedList(); List<cPlate> ListPlatesForZFactor = new List<cPlate>(); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 3)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } if (_StatJarqueBeraItem.Checked) { cNormalityJarqueBera JB = new cNormalityJarqueBera(); JB.SetInputData(NewTable1); JB.Run(); ListZ.Add(JB.GetOutPut()[0][0]); } else { cStatistics CS = new cStatistics(); CS.UnselectAll(); if (_StatCVItem.Checked) CS.IsCV = true; else if (_StatMeanItem.Checked) CS.IsMean = true; else if (_StatSumItem.Checked) CS.IsSum = true; CS.SetInputData(NewTable1); CS.Run(); ListZ.Add(CS.GetOutPut()[0][0]); } ListPlatesForZFactor.Add(TmpPlate); } #endregion cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListPlatesForZFactor); ET.Name = NameFunction + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();// +" - " +cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " +cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(ET); VG1.Chart.LabelAxisY = NameFunction; VG1.Chart.LabelAxisX = "Plate"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(); VG1.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(VG1.GetOutPut()); CDW.Title = NameFunction + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } }
private void zScoreToolStripMenuItem_Click(object sender, EventArgs e) { #region obsolete //List<double> Pos = new List<double>(); //List<double> Neg = new List<double>(); //List<cSimpleSignature> ZFactorList = new List<cSimpleSignature>(); //int NumDesc = CompleteScreening.ListDescriptors.Count; //cWell TempWell; //// loop on all the desciptors //for (int Desc = 0; Desc < NumDesc; Desc++) //{ // Pos.Clear(); // Neg.Clear(); // if (CompleteScreening.ListDescriptors[Desc].IsActive() == false) continue; // for (int row = 0; row < CompleteScreening.Rows; row++) // for (int col = 0; col < CompleteScreening.Columns; col++) // { // TempWell = CompleteScreening.GetCurrentDisplayPlate().GetWell(col, row, true); // if (TempWell == null) continue; // else // { // if (TempWell.GetClassIdx() == 0) // Pos.Add(TempWell.ListDescriptors[Desc].GetValue()); // if (TempWell.GetClassIdx() == 1) // Neg.Add(TempWell.ListDescriptors[Desc].GetValue()); // } // } // if (Pos.Count < 3) // { // MessageBox.Show("No or not enough positive controls !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; // } // if (Neg.Count < 3) // { // MessageBox.Show("No or not enough negative controls !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; // } // double ZScore = 1 - 3 * (std(Pos.ToArray()) + std(Neg.ToArray())) / (Math.Abs(Mean(Pos.ToArray()) - Mean(Neg.ToArray()))); // GlobalInfo.ConsoleWriteLine(CompleteScreening.ListDescriptors[Desc].GetName() + ", Z-Score = " + ZScore); // cSimpleSignature TmpDesc = new cSimpleSignature(CompleteScreening.ListDescriptors[Desc].GetName(), ZScore); // ZFactorList.Add(TmpDesc); //} //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); //Series CurrentSeries = new Series(); //CurrentSeries.ChartType = SeriesChartType.Column; //CurrentSeries.ShadowOffset = 1; //Series SeriesLine = new Series(); //SeriesLine.Name = "SeriesLine"; //SeriesLine.ShadowOffset = 1; //SeriesLine.ChartType = SeriesChartType.Line; //int RealIdx = 0; //for (int IdxValue = 0; IdxValue < ZFactorList.Count; IdxValue++) //{ // if (double.IsNaN(ZFactorList[IdxValue].AverageValue)) continue; // if (double.IsInfinity(ZFactorList[IdxValue].AverageValue)) continue; // CurrentSeries.Points.Add(ZFactorList[IdxValue].AverageValue); // CurrentSeries.Points[RealIdx].Label = ZFactorList[IdxValue].AverageValue.ToString("N2"); // CurrentSeries.Points[RealIdx].Font = new Font("Arial", 10); // CurrentSeries.Points[RealIdx].ToolTip = ZFactorList[IdxValue].Name; // CurrentSeries.Points[RealIdx].AxisLabel = ZFactorList[IdxValue].Name; // SeriesLine.Points.Add(ZFactorList[IdxValue].AverageValue); // SeriesLine.Points[RealIdx].BorderColor = Color.Black; // SeriesLine.Points[RealIdx].MarkerStyle = MarkerStyle.Circle; // SeriesLine.Points[RealIdx].MarkerSize = 4; // RealIdx++; //} //SimpleForm NewWindow = new SimpleForm(CompleteScreening); //int thisWidth = 200 * RealIdx; //if (thisWidth > (int)GlobalInfo.OptionsWindow.numericUpDownMaximumWidth.Value) thisWidth = (int)GlobalInfo.OptionsWindow.numericUpDownMaximumWidth.Value; //NewWindow.Width = thisWidth; //NewWindow.Height = 400; //NewWindow.Text = "Z-factors"; //ChartArea CurrentChartArea = new ChartArea(); //CurrentChartArea.BorderColor = Color.Black; //CurrentChartArea.AxisX.Interval = 1; //NewWindow.chartForSimpleForm.Series.Add(CurrentSeries); //NewWindow.chartForSimpleForm.Series.Add(SeriesLine); //CurrentChartArea.AxisX.IsLabelAutoFit = true; //NewWindow.chartForSimpleForm.ChartAreas.Add(CurrentChartArea); //CurrentChartArea.Axes[1].Maximum = 2; //CurrentChartArea.Axes[1].IsMarksNextToAxis = true; //CurrentChartArea.Axes[0].MajorGrid.Enabled = false; //CurrentChartArea.Axes[1].MajorGrid.Enabled = false; //NewWindow.chartForSimpleForm.TextAntiAliasingQuality = TextAntiAliasingQuality.High; //CurrentChartArea.BackGradientStyle = GradientStyle.TopBottom; //CurrentChartArea.BackColor = CompleteScreening.GlobalInfo.OptionsWindow.panel1.BackColor; //CurrentChartArea.BackSecondaryColor = Color.White; //CurrentChartArea.AxisX.ScaleView.Zoomable = true; //CurrentChartArea.AxisY.ScaleView.Zoomable = true; //Title CurrentTitle = new Title(CompleteScreening.GetCurrentDisplayPlate().Name + " Z-factors"); //CurrentTitle.Font = new System.Drawing.Font("Arial", 11, FontStyle.Bold); //NewWindow.chartForSimpleForm.Titles.Add(CurrentTitle); //NewWindow.Show(); //NewWindow.chartForSimpleForm.Update(); //NewWindow.chartForSimpleForm.Show(); //NewWindow.AutoScroll = true; //NewWindow.Controls.AddRange(new System.Windows.Forms.Control[] { NewWindow.chartForSimpleForm }); #endregion cGUI_2ClassesSelection GUI_ListClasses = new cGUI_2ClassesSelection(); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { GUI_ListClasses.PanelRight_IsCheckBoxes = true; } if (GUI_ListClasses.Run(this.GlobalInfo).IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); int IdxClassNeg = -1; int IdxClassPos = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClassNeg = IdxC; if (ListClassSelected[1][IdxC] == 1) IdxClassPos = IdxC; } string SubTitle = "Z-Factor"; if (_QCZRobustItem.Checked) SubTitle += " (Robust)"; #region Single plate cDesignerTab DT = new cDesignerTab(); // cDesignerMultiChoices DT = new cDesignerMultiChoices(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate(); // foreach (cPlate TmpPlate in ListPlatesToProcess) // GUI_ListClasses.Get // ListClassSelected List<int> ListCheckBoxes = new List<int>(); for (int i = 0; i < ListClassSelected[1].Count; i++) { if (ListClassSelected[1][i] > 0) ListCheckBoxes.Add(i); } for (int IdxClassSelected = 0; IdxClassSelected < ListCheckBoxes.Count; IdxClassSelected++) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); int CurrentClassTobeProcessed = ListCheckBoxes[IdxClassSelected]; foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (item.GetCurrentClassIdx() == CurrentClassTobeProcessed) // if (ListClassSelected[1][ListCheckBoxes[IdxClassSelected]] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //else // continue; } cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = TmpPlate.GetName() + "\n" + SubTitle + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " + cGlobalInfo.ListWellClasses[CurrentClassTobeProcessed].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Chart.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } VG1.Title = TmpPlate.GetName(); Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " vs. " + cGlobalInfo.ListWellClasses[CurrentClassTobeProcessed].Name; DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); CDW.Title = SubTitle + " - " + TmpPlate.GetName(); CDW.Run(); CDW.Display(); } #endregion #region plate by plate DT = new cDesignerTab(); // cDesignerMultiChoices DT = new cDesignerMultiChoices(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); } foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = TmpPlate.GetName() + "\n" + SubTitle + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " + cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Chart.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } VG1.Title = TmpPlate.GetName(); Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } #endregion #region entire screening else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); cExtendedList ListZ = new cExtendedList(); List<cPlate> ListPlatesForZFactor = new List<cPlate>(); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); //cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, false); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[0]); TableForZ.Add(NewTable2[0]); cZFactor ZF = new cZFactor(); ZF.IsRobust = _QCZRobustItem.Checked; ZF.SetInputData(TableForZ); ZF.Run(); double Zfactor = ZF.GetOutPut()[0][1]; ListZ.Add(Zfactor); // update plate quality TmpPlate.ListProperties.UpdateValueByName("Quality", Math.Exp(Zfactor - 1)); cProperty Prop = TmpPlate.ListProperties.FindByName("Quality"); Prop.Info = ZF.GetInfo(); ListPlatesForZFactor.Add(TmpPlate); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListPlatesForZFactor); ET.Name = SubTitle + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + /*" (" + NewTable1[0].Count + " wells)*/ " vs. " + cGlobalInfo.ListWellClasses[IdxClassPos].Name;// +" (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(ET); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Plate"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Chart.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(); VG1.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(VG1.GetOutPut()); CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); #endregion } }
private void ToolStripMenuItem_CrossZFactor(object sender, EventArgs e) { cGUI_ListSingleClasse GUI_ListClasses = new cGUI_ListSingleClasse(); GUI_ListClasses.IsCheckBoxes = true; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut(); int ClassId = 0; //int NumActiveDesc = 0; //foreach (cDescriptorType DescType in this.GlobalInfo.CurrentScreening.ListDescriptors) //{ // if (DescType.IsActive() == false) continue; // NumActiveDesc++; //} cExtendedTable FinalListValues = new cExtendedTable(); cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(new cExtendedList("Sorted Z'")); TmpTable.ListRowNames = new List<string>(); TmpTable[0].ListTags = new List<object>(); // TmpTable.ListTags = new List<object>(); for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++) { cDescriptorType CurrentDescType = cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc]; if (CurrentDescType.IsActive() == false) continue; cExtendedTable ListSource = new cExtendedTable(); // int IdxClasse =0; foreach (var item in cGlobalInfo.ListWellClasses) { // if (ListClassSelected[0][IdxClasse] == 1) ListSource.Add(new cExtendedList(item.Name)); // if (ListClassSelected[1][IdxClasse] == 1) //ListDestination.Add(new cExtendedList(item.Name)); // IdxClasse++; } foreach (cWell TmpWell in cGlobalInfo.ListSelectedWell) { ClassId = TmpWell.GetCurrentClassIdx(); if (ClassId > -1) { if (GUI_ListClasses.GetOutPut()[ClassId] == 1) ListSource[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType)); //if (GUI_ListClasses.GetOutPut()[1][ClassId] == 1) //ListDestination[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType)); } } int InitCount = ListSource.Count; for (int i = 0; i < ListSource.Count; i++) { if (ListSource[i].Count < 2) { ListSource.RemoveAt(i); i--; } } // if (ListSource.Count == 0) return; cZFactor ZF = new cZFactor(); ZF.SetInputData(ListSource); cFeedBackMessage FM = ZF.Run(); richTextBoxConsole.AppendText(FM.Message); if (!FM.IsSucceed) return; cExtendedTable ListValues = ZF.GetOutPut(); for (int i = 0; i < ListValues.Count; i++) { for (int j = 0; j < i; j++) { TmpTable[0].Add(ListValues[i][j]); TmpTable.ListRowNames.Add(ListValues[i].Name + " vs. " + ListValues[j].Name + " - [" + CurrentDescType.GetName() + "]"); TmpTable[0].ListTags.Add(CurrentDescType); } } } cSort S = new cSort(); S.SetInputData(TmpTable); S.IsAscending = false; S.Run(); //cViewerTable VT1 = new cViewerTable(); //VT1.SetInputData(ListValues); //VT1.Run(); cViewerTable VT2 = new cViewerTable(); VT2.SetInputData(S.GetOutPut()); VT2.Run(); //cDesignerSplitter DS = new cDesignerSplitter(); //DS.Orientation = Orientation.Vertical; //DS.SetInputData(VT2.GetOutPut()); //DS.SetInputData(VT1.GetOutPut()); //DS.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.Title = "Cross Classes Z'"; DTW.SetInputData(VT2.GetOutPut()); DTW.Run(); DTW.Display(); }
private void ToolStripMenuItem_Statistics(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cStatistics S = new cStatistics(); S.SetInputData(CET); S.Run(); cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(S.GetOutPut()); CDT.Run(); }
private void ToolStripMenuItem_OperationsClustering(object sender, EventArgs e) { cClustering CC = new cClustering(); cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); if (this.Input.ListRowNames != null) { CET.ListRowNames = new List<string>(); foreach (var item in this.Input.ListRowNames) CET.ListRowNames.Add(item); } if (this.Input.ListTags != null) { CET.ListTags = new List<object>(); foreach (var item in this.Input.ListTags) CET.ListTags.Add(item); } CET.Name = "Sub["+this.Input.Name+"]"; CC.SetInputData(CET); //CC.ListProperties.FindByName("Number of Clusters").SetNewValue((int)3); //CC.ListProperties.FindByName("Number of Clusters").IsGUIforValue = true; if (!CC.Run().IsSucceed) return; cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(CC.GetOutPut()); CDT.Run(); }
private void ToolStripMenuItem_NormStandardize(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index].Normalize(eNormalizationType.STANDARDIZE)); CET.Name = "Standardize(" + this.Input.Name + ")"; cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(CET); CDT.Run(); }
private void ToolStripMenuItem_NormMinMax(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) { CET.Add(Input[item.Index].Normalize(eNormalizationType.MIN_MAX)); } CET.Name = "Min-Max(" + this.Input.Name + ")"; cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(CET); CDT.Run(); }
private void ToolStripMenuItem_NormalityTest(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cComputeAndDisplayNormalPlot CDNP = new cComputeAndDisplayNormalPlot(); CDNP.SetInputData(CET); CDNP.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(CDNP.GetOutPut()); DTW.Title = "Normality Test"; DTW.Run(); DTW.Display(); //cNormalityJarqueBera NJB = new cNormalityJarqueBera(); //NJB.SetInputData(CET); //cFeedBackMessage FM = NJB.Run(); //if(FM.IsSucceed==false) //{ // System.Windows.Forms.MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} //cDisplayExtendedTable CDT = new cDisplayExtendedTable(); //CDT.SetInputData(NJB.GetOutPut()); //CDT.Run(); }
private void ToolStripMenuItem_MINEAnalysis(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cMineAnalysis MA = new cMineAnalysis(); MA.SetInputData(CET); MA.Is_BriefReport = true; MA.Run(); cDesignerTab SubDT = new cDesignerTab(); foreach (var item in MA.GetOutPut()) { cViewerTable SubTable = new cViewerTable(); SubTable.Title = "MINE - " + item.Name; SubTable.SetInputData(item); SubTable.Run(); SubDT.SetInputData(SubTable.GetOutPut()); } SubDT.Run(); cDisplayToWindow DW = new cDisplayToWindow(); DW.SetInputData(SubDT.GetOutPut()); DW.Title = CET.Name + " - MINE analysis"; DW.Run(); DW.Display(); }
private void ToolStripMenuItem_DistEuclidean(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cDistances CD = new cDistances(); CD.DistanceType = eDistances.EUCLIDEAN; CD.SetInputData(CET); CD.Run(); cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(CD.GetOutPut()); CDT.Run(); }
private void backgroundWorkerForCSVtoDB_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; CSVsr = new CsvFileReader(PathName); CSVsr.Separator = this.Delimiter.ToCharArray()[0]; CsvRow OriginalNames = new CsvRow(); if (!CSVsr.ReadRow(OriginalNames)) { CSVsr.Close(); return; } int ColPlateName = GetColIdxFor("Plate name", CSVWindow); int ColCol = GetColIdxFor("Column", CSVWindow); int ColRow = GetColIdxFor("Row", CSVWindow); int ColWellPos = GetColIdxFor("Well position", CSVWindow); int ColPhenotypeClass = GetColIdxFor("Phenotype Class", CSVWindow); int[] ColsForDescriptors = GetColsIdxFor("Descriptor", CSVWindow); FormForProgress ProgressWindow = new FormForProgress(); ProgressWindow.Text = "CSV -> DB : processing"; ProgressWindow.Show(); CsvRow CurrentDesc = new CsvRow(); int TotalPlateNumber = 0; int TotalObjectNumber = 0; int TotalWellNumber = 0; string OriginalPlatePlateName; string CurrentPlateName; string ConvertedName; this.CompleteReportString += "Source file: " + PathName + "\n"; this.CompleteReportString += OriginalNames.Count + " features selected.\n"; this.CompleteReportString += "Time stamp: " + DateTime.Now.ToString() + " \n"; if (CSVsr.ReadRow(CurrentDesc) == false) return; do { if (ColPlateName == -1) { ConvertedName = OriginalPlatePlateName = CurrentPlateName = "Generated Plate Name"; } else { OriginalPlatePlateName = CurrentDesc[ColPlateName]; CurrentPlateName = CurrentDesc[ColPlateName]; ConvertedName = ""; foreach (var c in System.IO.Path.GetInvalidFileNameChars()) ConvertedName = OriginalPlatePlateName.Replace(c, '-'); } List<string> ListNameSignature = new List<string>(); for (int idxDesc = 0/*Mode + 1*/; idxDesc < ColsForDescriptors.Length/* + Mode + 1*/; idxDesc++) { string TmpSignature = OriginalNames[ColsForDescriptors[idxDesc]]; TmpSignature = TmpSignature.Replace('[', '_'); TmpSignature = TmpSignature.Replace(']', '_'); ListNameSignature.Add(TmpSignature); } ListNameSignature.Add("Phenotype_Class"); ListNameSignature.Add("Phenotype_Confidence"); cSQLiteDatabase SQDB = new cSQLiteDatabase(SelectedPath + "\\" + ConvertedName, ListNameSignature, true); this.CompleteReportString += "\n" + CurrentPlateName + ":\n"; TotalPlateNumber++; do { string OriginalWellPos; int[] Pos = new int[2]; if (Mode == 1) { Pos = ConvertPosition(CurrentDesc[ColWellPos]); if (Pos == null) { if (MessageBox.Show("Error in converting the current well position.\nGo to Edit->Options->Import-Export->Well Position Mode to fix this.\nDo you want continue ?", "Loading error !", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.No) { CSVsr.Close(); return; } //else // goto NEXTLOOP; } OriginalWellPos = CurrentDesc[ColWellPos]; } else { if (int.TryParse(CurrentDesc[ColCol], out Pos[0]) == false) goto NEXTLOOP; if (int.TryParse(CurrentDesc[ColRow], out Pos[1]) == false) goto NEXTLOOP; OriginalWellPos = ConvertPosition(int.Parse(CurrentDesc[ColCol]), int.Parse(CurrentDesc[ColRow]));// "("+CurrentDesc[ColCol]+","+CurrentDesc[ColRow]+")"; } string CurrentWellPos = OriginalWellPos; cWellForDatabase WellForDB = new cWellForDatabase(OriginalPlatePlateName, Pos[0], Pos[1]); cExtendedTable ListData = new cExtendedTable(); // for (int idxDesc = 0; idxDesc < ColsForDescriptors.Length; idxDesc++) // ListData[idxDesc] = new List<double>(); ProgressWindow.richTextBoxForComment.AppendText(CurrentPlateName + " : " + CurrentWellPos + "\n"); //ProgressWindow.label.Refresh(); ProgressWindow.Refresh(); do { // CurrentWellPos = CurrentDesc[ColWellPos]; cExtendedList Signature = new cExtendedList(); for (int idxDesc = 0; idxDesc < ColsForDescriptors.Length; idxDesc++) { double Value; if (double.TryParse(CurrentDesc[ColsForDescriptors[idxDesc]], NumberStyles.Any, CultureInfo.InvariantCulture/*.CreateSpecificCulture("en-US")*/, out Value)) { if (double.IsNaN(Value)) Signature.Add(0); else Signature.Add(Value); } else { Signature.Add(0); } } // if the class of the phenotype is defined in the file then use it // if not, put it at 0 double ValueClass; if ((ColPhenotypeClass != -1) && (double.TryParse(CurrentDesc[ColPhenotypeClass], out ValueClass) == true)) { double IntValue = (int)(ValueClass) % cGlobalInfo.ListCellularPhenotypes.Count; Signature.Add(IntValue); } else { Signature.Add(0); } // finally add the classification confidence column (1 by default) Signature.Add(1); ListData.Add(Signature); // WellForDB.AddSignature(Signature); // manage the end of the file if (CSVsr.ReadRow(CurrentDesc) == false) { WellForDB.AddListSignatures(ListData); cFeedBackMessage FeedBackMessage = SQDB.AddNewWell(WellForDB); SQDB.CloseConnection(); // this.CompleteReportString += FeedBackMessage.Message + "\n"; goto NEXTLOOP; } if (ColPlateName == -1) CurrentPlateName = "Generated Plate Name"; else CurrentPlateName = CurrentDesc[ColPlateName]; if (Mode == 1) CurrentWellPos = CurrentDesc[ColWellPos]; else { int ResCol; int ResRow; if ((!int.TryParse(CurrentDesc[ColCol], out ResCol)) || (!int.TryParse(CurrentDesc[ColRow], out ResRow))) goto NEXTLOOP; CurrentWellPos = ConvertPosition(ResCol, ResRow); } TotalObjectNumber++; // NEXTSIGNATURE: ; } while (CurrentWellPos == OriginalWellPos); TotalWellNumber++; WellForDB.AddListSignatures(ListData); SQDB.AddNewWell(WellForDB); ReportTable.ListRowNames.Add(CurrentPlateName + " : " + CurrentWellPos); ReportTable[0].Add(ListData.Count); ReportTable[0].ListTags.Add(CurrentPlateName + " : " + CurrentWellPos + "\n" + ListData.Count + " objects"); this.CompleteReportString += "\t" + CurrentWellPos + " : " + ListData.Count + " objects\n"; NEXTSIGNATURE: ; } while (OriginalPlatePlateName == CurrentPlateName); SQDB.CloseConnection(); } while (true); NEXTLOOP: ; ProgressWindow.Close(); this.CompleteReportString += "\n-----------------------------\n"; this.CompleteReportString += TotalPlateNumber + " plates\n"; this.CompleteReportString += TotalWellNumber + " wells\n"; this.CompleteReportString += TotalObjectNumber + " objects\n"; this.CompleteReportString += "\nDataBase location:\n" + SelectedPath; // worker.ReportProgress(10); }
public void PerformScreeningClustering(List<cPlate> ListPlatesToProcess, bool IsOneByOne) { this.Cursor = Cursors.WaitCursor; cMachineLearning MachineLearning = new cMachineLearning(this.GlobalInfo); cParamAlgo ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo(); if (ParamAlgoForClustering == null) { this.Cursor = Cursors.Default; return; } //DataTable dt = new DataTable(); cExtendedTable dt = new cExtendedTable(); for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++) { if (cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].IsActive()) dt.Add(new cExtendedList(cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].GetName())); } if (IsOneByOne) { foreach (cPlate itemPlate in ListPlatesToProcess) { cListWells ListWell = new cListWells(null); foreach (var item in itemPlate.ListActiveWells) ListWell.Add(item); dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false); MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt); if (MachineLearning.SelectedClusterer != null) { double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering, null, MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments(); MachineLearning.Classes = new cExtendedList(); MachineLearning.Classes.AddRange(Assign); } if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count) { MessageBox.Show("The number of clusters is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Cursor = Cursors.Default; return; } if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0)) { MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Cursor = Cursors.Default; return; } // ----- update well classes ------ int IdxWell = 0; foreach (cWell item in itemPlate.ListActiveWells) item.SetClass((int)MachineLearning.Classes[IdxWell++]); } } else { cListWells ListWell = new cListWells(null); foreach (cPlate itemPlate in ListPlatesToProcess) { foreach (cWell item in itemPlate.ListActiveWells) { //cExtendedList ListValues = item.GetAverageValuesList(false); //dt.Rows.Add(); //int RealIdx = 0; //for (int IdxDesc = 0; IdxDesc < CompleteScreening.ListDescriptors.Count; IdxDesc++) //{ // if (CompleteScreening.ListDescriptors[IdxDesc].IsActive()) // dt.Rows[dt.Rows.Count - 1][RealIdx++] = ListValues[IdxDesc]; ListWell.Add(item); //} } } dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false); MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt); if (MachineLearning.SelectedClusterer != null) { double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering, null, MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments(); MachineLearning.Classes = new cExtendedList(); MachineLearning.Classes.AddRange(Assign); } if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count) { MessageBox.Show("The number of cluster is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Cursor = Cursors.Default; return; } if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0)) { MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Cursor = Cursors.Default; return; } int IdxWell = 0; // ----- update well classes ------ foreach (cPlate itemPlate in ListPlatesToProcess) { foreach (cWell item in itemPlate.ListActiveWells) item.SetClass((int)MachineLearning.Classes[IdxWell++]); } } cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false); this.Cursor = Cursors.Default; }
private void ToolStripMenuItem_Tests2SamplesTTest(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cTwoSampleUnpooledTTest S = new cTwoSampleUnpooledTTest(); S.SetInputData(CET); S.FTestTails = eFTestTails.BOTH; S.Run(); cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.DigitNumber = -1; CDT.SetInputData(S.GetOutPut()); CDT.Run(); }
private void ToolStripMenuItem_ZFactor(object sender, EventArgs e) { cGUI_2ClassesSelection GUI_ListClasses = new cGUI_2ClassesSelection(); if (GUI_ListClasses.Run(this.GlobalInfo).IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); int IdxClassNeg = -1; int IdxClassPos = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClassNeg = IdxC; if (ListClassSelected[1][IdxC] == 1) IdxClassPos = IdxC; } string SubTitle = "Z-Factor"; cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in cGlobalInfo.ListSelectedWell) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = SubTitle + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " + cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.ColumnIndexForSorting = 0; S.Run(); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Chart.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); //VG1.Title = TmpPlate.Name; Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DS.GetOutPut());//VG1.GetOutPut()); CDW.Title = "List Wells - Z Factor"; CDW.Run(); CDW.Display(); }
public cFeedBackMessage Run(cScreening CompleteScreening) { if (this.Input == null) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "No input data defined."; return FeedBackMessage; } bool IsCurrentDescOnly = false; if (this.ListPlates == null) ListPlates = CompleteScreening.ListPlatesActive; cDisplayToWindow CDW1 = new cDisplayToWindow(); cDesignerTab DT = new cDesignerTab(); foreach (cDescriptorType CurrentDesc in CompleteScreening.ListDescriptors.GetActiveDescriptors()) { cListExtendedTable CompleteListOfData = new cListExtendedTable(); cExtendedTable FullTableAverage = new cExtendedTable(); FullTableAverage.ListRowNames = new List<string>(); string TableName = CurrentDesc.GetName() + " evolution\n" + Input[0].Sum() + " classes - "; for (int i = 0; i < Input[0].Count; i++) { if ((Input[0][i] == 1) && (Input[0].ListTags != null) && (Input[0].ListTags[i].GetType() == typeof(cWellClassType))) { cWellClassType TmpWellClass = (cWellClassType)Input[0].ListTags[i]; CompleteListOfData.Add(new cExtendedTable()); CompleteListOfData[CompleteListOfData.Count - 1].Name = TmpWellClass.Name; CompleteListOfData[CompleteListOfData.Count - 1].Tag = Input[0].ListTags[i]; FullTableAverage.Add(new cExtendedList(TmpWellClass.Name)); FullTableAverage[FullTableAverage.Count - 1].ListTags = new List<object>(); FullTableAverage[FullTableAverage.Count - 1].Name = TmpWellClass.Name; FullTableAverage[FullTableAverage.Count - 1].Tag = TmpWellClass; int IdxPlate = 0; foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive) { FullTableAverage[FullTableAverage.Count - 1].Add(0); FullTableAverage[FullTableAverage.Count - 1].ListTags.Add(TmpWellClass); CompleteListOfData[CompleteListOfData.Count - 1].Add(new cExtendedList(TmpPlate.GetName())); CompleteListOfData[CompleteListOfData.Count - 1][CompleteListOfData[CompleteListOfData.Count - 1].Count - 1].Tag = TmpPlate; CompleteListOfData[CompleteListOfData.Count - 1][CompleteListOfData[CompleteListOfData.Count - 1].Count - 1].Add(IdxPlate); IdxPlate++; } } } TableName += FullTableAverage[0].Count + " plates"; FullTableAverage.Name = TableName; foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive) FullTableAverage.ListRowNames.Add(TmpPlate.GetName()); // cDescriptorsType CurrentDesc = CompleteScreening.ListDescriptors.GetActiveDescriptor(); int RealIdx = 0; for (int i = 0; i < Input[0].Count; i++) { if (Input[0][i] == 1) { int IdxPlate = 0; foreach (cPlate TmpPlate in ListPlates/*CompleteScreening.ListPlatesActive*/) { cExtendedList CurrentListValues = new cExtendedList(); foreach (cWell item in TmpPlate.ListActiveWells) if ((item.GetCurrentClassIdx() != -1) && (item.GetCurrentClassIdx() == i)) { double Value = item.ListSignatures.GetSignature(CurrentDesc).GetValue(); CurrentListValues.Add(Value); CompleteListOfData[RealIdx][IdxPlate].Add(Value); } FullTableAverage[RealIdx][IdxPlate] = CurrentListValues.Mean(); IdxPlate++; } RealIdx++; } } cViewerGraph1D VG = new cViewerGraph1D(); VG.Chart.IsLine = true; VG.Chart.IsShadow = true; VG.Chart.IsZoomableX = true; // VG.Chart.IsYGrid = true; //VG.Chart.IsDisplayValues = true; VG.Chart.IsLegend = true; //cViewerStackedHistogram CV1 = new cViewerStackedHistogram(); // CV1.SetInputData(NewTable); VG.SetInputData(FullTableAverage); VG.SetInputData(CompleteListOfData); VG.Chart.LabelAxisX = "Plate"; VG.Chart.LabelAxisY = CurrentDesc.GetName(); VG.Run(); cExtendedControl TmpCtrl = VG.GetOutPut(); TmpCtrl.Title = CurrentDesc.GetName(); DT.SetInputData(TmpCtrl); } DT.Run(); CDW1.Title = "Descriptor Evolution"; CDW1.SetInputData(DT.GetOutPut()); CDW1.Run(); CDW1.Display(); return FeedBackMessage; }
private void lDAToolStripMenuItem_Click(object sender, EventArgs e) { cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses(); if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0]; if (ListClassSelected.Sum() < 2) { MessageBox.Show("At least two classes have to be selected to perfom a LDA.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cDisplayToWindow vD = new cDisplayToWindow(); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate(); cListWells ListWellsToProcess = new cListWells(null); cExtendedList ListClasses = new cExtendedList(); ListClasses.Name = "Classes"; foreach (cWell item in TmpPlate.ListActiveWells) if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) { ListWellsToProcess.Add(item); ListClasses.Add(item.GetCurrentClassIdx()); } cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true); NewTable.Add(ListClasses); cProjectorLDA LDA = new cProjectorLDA(); LDA.SetInputData(NewTable); cFeedBackMessage FM = LDA.Run(); if (!FM.IsSucceed) { MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cViewerTable VHM = new cViewerTable(); cExtendedTable CT = LDA.GetOutPut(); foreach (var item in CT) { cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item); foreach (cDescriptorType Desc in item.ListTags) DLC.Add(Desc); item.Tag = DLC; } VHM.SetInputData(CT); VHM.Run(); vD.SetInputData(VHM.GetOutPut()); vD.Title = "LDA - " + TmpPlate.GetName() + " : " + ListWellsToProcess.Count + " wells"; } else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { cListWells ListWellsToProcess = new cListWells(null); cExtendedList ListClasses = new cExtendedList(); ListClasses.Name = "Classes"; foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) { foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[item.GetCurrentClassIdx()] == 1) { ListWellsToProcess.Add(item); ListClasses.Add(item.GetCurrentClassIdx()); } } } } cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true); NewTable.Add(ListClasses); cProjectorLDA LDA = new cProjectorLDA(); LDA.SetInputData(NewTable); cFeedBackMessage FM = LDA.Run(); if (!FM.IsSucceed) { MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cExtendedTable CT = LDA.GetOutPut(); foreach (var item in CT) { cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item); foreach (cDescriptorType Desc in item.ListTags) DLC.Add(Desc); item.Tag = DLC; } cViewerTable VHM = new cViewerTable(); VHM.SetInputData(CT); VHM.Run(); vD.SetInputData(VHM.GetOutPut()); vD.Title = "LDA - " + ListWellsToProcess.Count + " wells."; } else if (ProcessModeplateByPlateToolStripMenuItem.Checked) { cDesignerTab CDT = new cDesignerTab(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) { cListWells ListWellsToProcess = new cListWells(null); cExtendedList ListClasses = new cExtendedList(); ListClasses.Name = "Classes"; foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[item.GetCurrentClassIdx()] == 1) { ListWellsToProcess.Add(item); ListClasses.Add(item.GetCurrentClassIdx()); } } } cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true); NewTable.Add(ListClasses); NewTable.Name = TmpPlate.GetName(); cProjectorLDA LDA = new cProjectorLDA(); LDA.SetInputData(NewTable); cFeedBackMessage FM = LDA.Run(); if (!FM.IsSucceed) { MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cExtendedTable CT = LDA.GetOutPut(); foreach (var item in CT) { cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item); foreach (cDescriptorType Desc in item.ListTags) DLC.Add(Desc); item.Tag = DLC; } cViewerTable VHM = new cViewerTable(); VHM.SetInputData(CT); VHM.Run(); CDT.SetInputData(VHM.GetOutPut()); } CDT.Run(); vD.SetInputData(CDT.GetOutPut()); } else return; vD.Run(); vD.Display(); }
void ToolStripMenuItem_DRCAnalysisMultiDesc_Click(object sender, EventArgs e) { List<cDescriptorType> ListSelectedDescs = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(); cListListWells CurrentSelectedGroups = this.BuildListListWells(); #region select folder var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your databases."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowFullPathInEditBox = true; DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; string Path = dlg1.SelectedPath; if (Directory.Exists(Path) == false) return; string FolderName = dlg1.SelectedPath; #endregion foreach (var item in ListSelectedDescs) { string TmpFolder = FolderName + "\\" + item.GetName(); Directory.CreateDirectory(TmpFolder); int IdxNode = 0; List<cDescriptorType> ListSelectedDesc = new List<cDescriptorType>(); ListSelectedDesc.Add(item); cExtendedTable TableForGeneralResuts = new cExtendedTable(); TableForGeneralResuts.Add(new cExtendedList("p-Value")); TableForGeneralResuts.Add(new cExtendedList("EC50")); TableForGeneralResuts.Add(new cExtendedList("Slope")); TableForGeneralResuts.Add(new cExtendedList("Bottom")); TableForGeneralResuts.Add(new cExtendedList("Top")); TableForGeneralResuts.Add(new cExtendedList("Window")); TableForGeneralResuts.Add(new cExtendedList("Area Under Curve")); TableForGeneralResuts.ListRowNames = new List<string>(); TableForGeneralResuts.ListTags = new List<object>(); foreach (cListWells TmpListWells in CurrentSelectedGroups) { // List<cDescriptorType> LType = new List<cDescriptorType>(); // LType.Add(ListSelectedDesc[i]); cExtendedTable CompleteTable = TmpListWells.GetAverageDescriptorValues(ListSelectedDesc, true, false); //cExtendedTable CompleteTable = GLP.GetOutPut(); cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(CompleteTable); CFG.Run(); cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(CompleteTable); if (SF.Run().IsSucceed == false) continue; // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1]; cANOVA A = new cANOVA(); cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1); A.SignificanceThreshold = 1E-11; A.SetInputData(NewTable); A.Run(); cExtendedTable Sigmoid = SF.GetFittedRawValues(CFG.GetListXValues()); CompleteTable[0] = Sigmoid[1]; CompleteTable[0].Name = ListSelectedDesc[0].GetName() + "\n" + Sigmoid[1].Name; cDesignerSplitter DS = new cDesignerSplitter(); //cViewerTableAsRichText VT = new cViewerTableAsRichText(); cViewerTable VT = new cViewerTable(); cExtendedTable TableResults = SF.GetOutPut(); if ((A.GetOutPut() != null) && (A.GetOutPut().Count > 0)) { TableResults[0].Add(A.GetOutPut()[0][0]); TableResults[0].Add(A.GetOutPut()[0][1]); TableResults.ListRowNames.Add("p-Value"); TableResults.ListRowNames.Add("Rejected?"); TableForGeneralResuts[0].Add(A.GetOutPut()[0][0]); } else { TableForGeneralResuts[0].Add(1); } TableResults.Name = TV.Nodes[IdxNode].Text; TableResults[0].Name = "Fitting Parameters"; VT.SetInputData(TableResults); VT.DigitNumber = -1; VT.Run(); cViewerGraph1D VS1 = new cViewerGraph1D(); cExtendedTable MyTable = new cExtendedTable(Sigmoid[1]); MyTable.Name = TmpListWells.Name;// TV.Nodes[IdxNode].Text; VS1.SetInputData(MyTable); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = false; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.MarkerSize = 8; VS1.Chart.IsDisplayValues = cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDRCDisplayValues.Checked; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = CompleteTable[1].Name; VS1.Chart.XAxisFormatDigitNumber = cGlobalInfo.OptionsWindow.FFAllOptions.GetDRCNumberOfDigit(); VS1.Chart.IsZoomableX = true; Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]); //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/); VS1.Chart.ListVerticalLines.Add(VLForEC50); TableForGeneralResuts.ListRowNames.Add(TV.Nodes[IdxNode].Text); TableForGeneralResuts.ListTags.Add((Chart)VS1.Chart);//ListSelectedDesc[0]); //EC50 TableForGeneralResuts[1].Add(SF.GetOutPut()[0][2]); // Slope TableForGeneralResuts[2].Add(SF.GetOutPut()[0][3]); // Bottom TableForGeneralResuts[3].Add(SF.GetOutPut()[0][0]); // Top TableForGeneralResuts[4].Add(SF.GetOutPut()[0][1]); // Window double Window = SF.GetOutPut()[0][1] / SF.GetOutPut()[0][0]; TableForGeneralResuts[5].Add(Window); TableForGeneralResuts[6].Add(SF.GetOutPut()[0][5]); VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[CompleteTable.Count]; for (int IdxCurve = 0; IdxCurve < CompleteTable.Count; IdxCurve++) { cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign(); TmpSerieInfo.color = cGlobalInfo.ListCellularPhenotypes[IdxCurve % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay; TmpSerieInfo.markerStyle = MarkerStyle.None; VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo; } VS1.Run(); //DS.SetInputData(VS1.GetOutPut()); //DS.SetInputData(VT.GetOutPut()); //DS.Orientation = Orientation.Horizontal; //DS.Title = TV.Nodes[IdxNode++].Text; //TmpListWells.ti;// ListSelectedDesc[0].GetName(); //DS.Run(); IdxNode++; // DT.SetInputData(DS.GetOutPut()); } cTableToHTML THTML = new cTableToHTML(); TableForGeneralResuts.Name = item.GetName(); THTML.SetInputData(TableForGeneralResuts); THTML.IsDisplayUIForFilePath = false; THTML.FolderName = TmpFolder; THTML.ListProperties.FindByName("Open HTML File ?").SetNewValue((bool)false); THTML.ListProperties.FindByName("Open HTML File ?").IsGUIforValue = false; THTML.Run(); } System.Diagnostics.Process.Start(FolderName); }
private void mannWithneyTestToolStripMenuItem_Click(object sender, EventArgs e) { cGUI_2ClassesSelection GUI_ListClasses = new cGUI_2ClassesSelection(); if (GUI_ListClasses.Run(this.GlobalInfo).IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); int IdxClassNeg = -1; int IdxClassPos = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClassNeg = IdxC; if (ListClassSelected[1][IdxC] == 1) IdxClassPos = IdxC; } string SubTitle = "Mann-Withney (both tails)"; #region single plate and plate by plate cDesignerTab DT = new cDesignerTab(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); } else ListPlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 5) || (NewTable2.Count == 0) || (NewTable2[0].Count < 5)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cMannWithneyTest ZF = new cMannWithneyTest(); ZF.SetInputData(TableForZ); ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = TmpPlate.GetName() + "\n" + SubTitle + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " + cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; //VG1.Chart.Max VG1.Title = TmpPlate.GetName(); Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.05); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.DigitNumber = -1; VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) CDW.Title = SubTitle + " - " + ListPlatesToProcess[0].GetName(); else CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } #endregion #region entire screening else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); cExtendedList ListZ = new cExtendedList(); List<cPlate> ListPlatesForZFactor = new List<cPlate>(); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); //cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, false); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 5) || (NewTable2.Count == 0) || (NewTable2[0].Count < 5)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[0]); TableForZ.Add(NewTable2[0]); cMannWithneyTest ZF = new cMannWithneyTest(); ZF.SetInputData(TableForZ); ZF.Run(); double Zfactor = ZF.GetOutPut()[0][1]; ListZ.Add(Zfactor); // update plate quality //TmpPlate.ListProperties.UpdateValueByName("Quality", Math.Exp(Zfactor - 1)); //cProperty Prop = TmpPlate.ListProperties.FindByName("Quality"); //Prop.Info = ZF.GetInfo(); ListPlatesForZFactor.Add(TmpPlate); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListPlatesForZFactor); ET.Name = SubTitle + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + /*" (" + NewTable1[0].Count + " wells)*/ " vs. " + cGlobalInfo.ListWellClasses[IdxClassPos].Name;// +" (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(ET); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Plate"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.05); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(); VG1.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(VG1.GetOutPut()); CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); #endregion } }
void ToolStripMenuItem_DRCAnalysis_Click(object sender, EventArgs e) { List<cDescriptorType> ListSelectedDesc = new List<cDescriptorType>();// GlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(); ListSelectedDesc.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor()); //if (GlobalInfo == null) GlobalInfo = cGlobalInfo.CurrentScreening.GlobalInfo; //if (cGlobalInfo == null) return; cDesignerMultiChoices DT = new cDesignerMultiChoices(); cExtendedTable TableForGeneralResuts = new cExtendedTable(); TableForGeneralResuts.Add(new cExtendedList("p-Value")); TableForGeneralResuts.Add(new cExtendedList("EC50")); TableForGeneralResuts.Add(new cExtendedList("Slope")); TableForGeneralResuts.Add(new cExtendedList("Bottom")); TableForGeneralResuts.Add(new cExtendedList("Top")); TableForGeneralResuts.Add(new cExtendedList("Window")); TableForGeneralResuts.Add(new cExtendedList("Area Under Curve")); TableForGeneralResuts.ListRowNames = new List<string>(); TableForGeneralResuts.ListTags = new List<object>(); cDesignerSplitter MainSplitter = new cDesignerSplitter(); int IdxNode = 0; cListListWells CurrentSelectedGroups = this.BuildListListWells(); foreach (cListWells TmpListWells in CurrentSelectedGroups) { // List<cDescriptorType> LType = new List<cDescriptorType>(); // LType.Add(ListSelectedDesc[i]); cExtendedTable CompleteTable = TmpListWells.GetAverageDescriptorValues(ListSelectedDesc, true, false); //cExtendedTable CompleteTable = GLP.GetOutPut(); cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(CompleteTable); CFG.Run(); cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(CompleteTable); if (SF.Run().IsSucceed == false) continue; // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1]; cANOVA A = new cANOVA(); cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1); A.SignificanceThreshold = 1E-11; A.SetInputData(NewTable); A.Run(); cExtendedTable Sigmoid = SF.GetFittedRawValues(CFG.GetListXValues()); CompleteTable[0] = Sigmoid[1]; CompleteTable[0].Name = ListSelectedDesc[0].GetName() + "\n" + Sigmoid[1].Name; cDesignerSplitter DS = new cDesignerSplitter(); //cViewerTableAsRichText VT = new cViewerTableAsRichText(); cViewerTable VT = new cViewerTable(); cExtendedTable TableResults = SF.GetOutPut(); if ((A.GetOutPut() != null) && (A.GetOutPut().Count > 0)) { TableResults[0].Add(A.GetOutPut()[0][0]); TableResults[0].Add(A.GetOutPut()[0][1]); TableResults.ListRowNames.Add("p-Value"); TableResults.ListRowNames.Add("Rejected?"); TableForGeneralResuts[0].Add(A.GetOutPut()[0][0]); } else { TableForGeneralResuts[0].Add(1); } TableResults.Name = TV.Nodes[IdxNode].Text; TableResults[0].Name = "Fitting Parameters"; VT.SetInputData(TableResults); VT.DigitNumber = -1; VT.Run(); cViewerGraph1D VS1 = new cViewerGraph1D(); cExtendedTable MyTable = new cExtendedTable(Sigmoid[1]); MyTable.Name = TmpListWells.Name;// TV.Nodes[IdxNode].Text; VS1.SetInputData(MyTable); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = false; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.MarkerSize = 8; VS1.Chart.IsDisplayValues = cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDRCDisplayValues.Checked; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = CompleteTable[1].Name; VS1.Chart.XAxisFormatDigitNumber = cGlobalInfo.OptionsWindow.FFAllOptions.GetDRCNumberOfDigit(); VS1.Chart.IsZoomableX = true; Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]); //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/); VS1.Chart.ListVerticalLines.Add(VLForEC50); TableForGeneralResuts.ListRowNames.Add(TV.Nodes[IdxNode].Text); TableForGeneralResuts.ListTags.Add((Chart)VS1.Chart);//ListSelectedDesc[0]); //EC50 TableForGeneralResuts[1].Add(SF.GetOutPut()[0][2]); // Slope TableForGeneralResuts[2].Add(SF.GetOutPut()[0][3]); // Bottom TableForGeneralResuts[3].Add(SF.GetOutPut()[0][0]); // Top TableForGeneralResuts[4].Add(SF.GetOutPut()[0][1]); // Window double Window = SF.GetOutPut()[0][1] / SF.GetOutPut()[0][0]; TableForGeneralResuts[5].Add(Window); TableForGeneralResuts[6].Add(SF.GetOutPut()[0][5]); VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[CompleteTable.Count]; for (int IdxCurve = 0; IdxCurve < CompleteTable.Count; IdxCurve++) { cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign(); TmpSerieInfo.color = cGlobalInfo.ListCellularPhenotypes[IdxCurve % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay; TmpSerieInfo.markerStyle = MarkerStyle.None; VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo; } VS1.Run(); DS.SetInputData(VS1.GetOutPut()); DS.SetInputData(VT.GetOutPut()); DS.Orientation = Orientation.Horizontal; DS.Title = TV.Nodes[IdxNode++].Text; //TmpListWells.ti;// ListSelectedDesc[0].GetName(); DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cExtendedControl TextEC = DT.GetOutPut(); if (TextEC == null) return; TextEC.Width = 0; TextEC.Height = 0; TextEC.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right); MainSplitter.SetInputData(TextEC); string DRCsortingMethod = cGlobalInfo.OptionsWindow.FFAllOptions.comboBoxDRCSorting.SelectedItem.ToString(); //comboBoxDRCSorting int IdxColSorting = 0; cExtendedTable RT = TableForGeneralResuts; switch (DRCsortingMethod) { case "ANOVA": IdxColSorting = 0; break; case "EC50": IdxColSorting = 1; break; case "Window": IdxColSorting = 5; break; case "AUC": IdxColSorting = 6; break; case "None": IdxColSorting = -1; break; default: break; } if (IdxColSorting != -1) { cSort S = new cSort(); S.ColumnIndexForSorting = IdxColSorting; S.SetInputData(TableForGeneralResuts); S.IsAscending = true; S.Run(); RT = S.GetOutPut(); } cViewerTable VTForEC50 = new cViewerTable(); RT.Name = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor().GetName(); VTForEC50.SetInputData(RT); VTForEC50.DigitNumber = -1; VTForEC50.Run(); MainSplitter.SetInputData(VTForEC50.GetOutPut()); MainSplitter.Orientation = Orientation.Vertical; MainSplitter.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(MainSplitter.GetOutPut()); DTW.Title = "DRC analysis [" + cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor().GetName() + "]"; DTW.Run(); DTW.Display(); }
private void aNOVAToolStripMenuItem1_Click(object sender, EventArgs e) { cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses(); GUI_ListClasses.IsCheckBoxes = true; GUI_ListClasses.IsSelectAll = true; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); string SubTitle = "ANOVA (One-Way)"; #region single plate and plate by plate cDesignerTab DT = new cDesignerTab(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); } else ListPlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); foreach (cPlate TmpPlate in ListPlatesToProcess) { cExtendedTable NewTable1 = new cExtendedTable(); List<cListWells> ListListWells = new List<cListWells>(); int NumWells = 0; for (int IdxClassWell = 0; IdxClassWell < ListClassSelected[0].Count; IdxClassWell++) { if (ListClassSelected[0][IdxClassWell] >= 1) { List<cWellClassType> LCT = new List<cWellClassType>(); LCT.Add(cGlobalInfo.ListWellClasses[IdxClassWell]); cListWells TmpList = TmpPlate.ListWells.Filter(LCT); if (TmpList.Count >= 3) { ListListWells.Add(TmpList); NumWells += TmpList.Count; } } } if (ListListWells.Count <= 1) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable CompleteReport = null; cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); foreach (var item in ListListWells) { List<cDescriptorType> LType = new List<cDescriptorType>(); LType.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); cExtendedTable TTable = item.GetAverageDescriptorValues(LType, false, false); TableForZ.Add(TTable[0]); } RealIdx++; cANOVA ZF = new cANOVA(); ZF.SetInputData(TableForZ); ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][0]); ZF.GetOutPut()[0].Name = cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].GetName(); if (CompleteReport == null) CompleteReport = new cExtendedTable(ZF.GetOutPut()); else { cMerge M = new cMerge(); M.IsHorizontal = true; M.SetInputData(CompleteReport, ZF.GetOutPut()); M.Run(); CompleteReport = M.GetOutPut(); } ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = TmpPlate.GetName() + "\n" + SubTitle + " - " + NumWells + " wells";// +" - " +cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " +cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.IsAscending = false; S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; //VG1.Chart.Max VG1.Title = TmpPlate.GetName(); // Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.05); // VLZ05.IsAllowMoving = true; // VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cTranspose T = new cTranspose(); T.SetInputData(CompleteReport); T.Run(); CompleteReport = T.GetOutPut(); CompleteReport[0].Name = "P-Value"; CompleteReport[1].Name = "Is significant ?"; cSort S1 = new cSort(); S1.SetInputData(CompleteReport); S1.ColumnIndexForSorting = 0; S1.IsAscending = true; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.DigitNumber = -1; VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) CDW.Title = SubTitle + " - " + ListPlatesToProcess[0].GetName(); else CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } #endregion #region entire screening else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); cExtendedList ListZ = new cExtendedList(); List<cPlate> ListPlatesForZFactor = new List<cPlate>(); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); //cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, false); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[0]); TableForZ.Add(NewTable2[0]); cStudent_tTest ZF = new cStudent_tTest(); ZF.SetInputData(TableForZ); ZF.Run(); double Zfactor = ZF.GetOutPut()[0][1]; ListZ.Add(Zfactor); // update plate quality //TmpPlate.ListProperties.UpdateValueByName("Quality", Math.Exp(Zfactor - 1)); //cProperty Prop = TmpPlate.ListProperties.FindByName("Quality"); //Prop.Info = ZF.GetInfo(); ListPlatesForZFactor.Add(TmpPlate); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListPlatesForZFactor); ET.Name = SubTitle + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();// +" - " +cGlobalInfo.ListWellClasses[IdxClassNeg].Name + /*" (" + NewTable1[0].Count + " wells)*/ " vs. " +cGlobalInfo.ListWellClasses[IdxClassPos].Name;// +" (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(ET); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Plate"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(); VG1.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(VG1.GetOutPut()); CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); #endregion } }
private void ToolStripMenuItem_DisplaySingleCellHistogram(object sender, EventArgs e) { cListWells ListWells = new cListWells(); List<cDescriptorType> LCDT = new List<cDescriptorType>(); LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor()); List<cWellClassType> ListForCurrentClass = new List<cWellClassType>(); ListForCurrentClass.Add(this); cGUI_ListClasses GUIClasses = new cGUI_ListClasses(); GUIClasses.IsCheckBoxes = true; GUIClasses.IsSelectAll = true; GUIClasses.ClassType = eClassType.PHENOTYPE; if (!GUIClasses.Run().IsSucceed) return; cDesignerTab DT = new cDesignerTab(); if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeEntireScreeningToolStripMenuItem.Checked) { foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) { ListWells.AddRange(CurrentPlate.ListWells.Filter(ListForCurrentClass)); } cExtendedTable FinalTable = new cExtendedTable(); FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells"; int Idx = 0; foreach (var item in cGlobalInfo.ListCellularPhenotypes) { FinalTable.Add(new cExtendedList()); FinalTable[Idx].Name = item.Name; FinalTable[Idx].Tag = item; Idx++; } foreach (cWell TmpWell in ListWells) { TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName); int IDx = 0; foreach (var item in cGlobalInfo.ListCellularPhenotypes) { if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; } List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>(); ListCellularPhenotypesToBeSelected.Add(item); cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell, LCDT, ListCellularPhenotypesToBeSelected); if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]); IDx++; } TmpWell.AssociatedPlate.DBConnection.CloseConnection(); } cViewerStackedHistogram VSH = new cViewerStackedHistogram(); VSH.SetInputData(FinalTable); VSH.Chart.BinNumber = LCDT[0].GetBinNumber(); VSH.Chart.IsShadow = false; VSH.Chart.IsBorder = false; VSH.Chart.IsXGrid = true; VSH.Chart.IsYGrid = true; VSH.Chart.LabelAxisX = LCDT[0].GetName(); VSH.Run(); VSH.Chart.Width = 0; VSH.Chart.Height = 0; VSH.GetOutPut().Title = cGlobalInfo.CurrentScreening.GetName(); DT.SetInputData(VSH.GetOutPut()); } else { cListPlates ListPlates = new cListPlates(); if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeplateByPlateToolStripMenuItem.Checked) ListPlates = cGlobalInfo.CurrentScreening.ListPlatesActive; else ListPlates.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); foreach (cPlate CurrentPlate in ListPlates) { ListWells = CurrentPlate.ListWells.Filter(ListForCurrentClass); cExtendedTable FinalTable = new cExtendedTable(); FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells - " + CurrentPlate.GetName(); int Idx = 0; foreach (var item in cGlobalInfo.ListCellularPhenotypes) { FinalTable.Add(new cExtendedList()); FinalTable[Idx].Name = item.Name; FinalTable[Idx].Tag = item; if (GUIClasses.GetOutPut()[0][Idx] == 0) { Idx++; continue; } Idx++; } foreach (cWell TmpWell in ListWells) { TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName); int IDx = 0; foreach (var item in cGlobalInfo.ListCellularPhenotypes) { if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; } List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>(); ListCellularPhenotypesToBeSelected.Add(item); cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell, LCDT, ListCellularPhenotypesToBeSelected); if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]); IDx++; } TmpWell.AssociatedPlate.DBConnection.CloseConnection(); } cViewerStackedHistogram VSH = new cViewerStackedHistogram(); VSH.SetInputData(FinalTable); VSH.Chart.BinNumber = LCDT[0].GetBinNumber(); VSH.Chart.IsShadow = false; VSH.Chart.IsBorder = false; VSH.Chart.IsXGrid = true; VSH.Chart.IsYGrid = true; VSH.Chart.LabelAxisX = LCDT[0].GetName(); VSH.Run(); VSH.Chart.Width = 0; VSH.Chart.Height = 0; VSH.GetOutPut().Title = CurrentPlate.GetName(); DT.SetInputData(VSH.GetOutPut()); } } DT.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(DT.GetOutPut()); DTW.Title = "Single Cell Histograms"; DTW.Run(); DTW.Display(); }
private void mahalanobisDistanceToolStripMenuItem_Click(object sender, EventArgs e) { FormForMahalanobisDistance MainWindow = new FormForMahalanobisDistance(); PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL); ClassSelectionPanel.Height = MainWindow.panelForSourceCloud.Height; MainWindow.panelForSourceCloud.Controls.Add(ClassSelectionPanel); PanelForClassSelection HitClassSelectionPanel = new PanelForClassSelection(false, eClassType.WELL); HitClassSelectionPanel.Height = MainWindow.panelHitClass.Height; HitClassSelectionPanel.ListRadioButtons[1].Checked = true; MainWindow.panelHitClass.Controls.Add(HitClassSelectionPanel); if (MainWindow.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; cExtendedList ListClassSelected = new cExtendedList(); for (int i = 0; i < ClassSelectionPanel.ListCheckBoxes.Count; i++) if (ClassSelectionPanel.ListCheckBoxes[i].Checked) ListClassSelected.Add(1); else ListClassSelected.Add(0); int IdxClassForOutliers = 0; for (int i = 0; i < HitClassSelectionPanel.ListRadioButtons.Count; i++) if (HitClassSelectionPanel.ListRadioButtons[i].Checked) { IdxClassForOutliers = i; break; } if (ListClassSelected.Sum() < 1) { MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // start by computing the inversed covariance matrix //if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1) //{ // MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} cCovarianceMatrix CM = new cCovarianceMatrix(); cExtendedTable NewTable = null; if (this.ProcessModeplateByPlateToolStripMenuItem.Checked) { //foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive) //{ // cListWells ListWellsToProcess = new cListWells(null); // foreach (cWell item in TmpPlate.ListActiveWells) // if ((item.GetClassIdx() != -1) && (ListClassSelected[item.GetClassIdx()] == 1)) ListWellsToProcess.Add(item); // cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true); // CM.SetInputData(NewTable); //} } else if (this.ProcessModeEntireScreeningToolStripMenuItem.Checked) { cListWells ListWellsToProcess = new cListWells(null); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) foreach (cWell item in TmpPlate.ListActiveWells) if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item); NewTable = new cExtendedTable(ListWellsToProcess, true); // cTwoSampleFTest CM = new cTwoSampleFTest(); CM.SetInputData(NewTable); } else { cListWells ListWellsToProcess = new cListWells(null); foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells) if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item); NewTable = new cExtendedTable(ListWellsToProcess, true); // cTwoSampleFTest CM = new cTwoSampleFTest(); CM.SetInputData(NewTable); } CM.Run(); cInverse cI = new cInverse(); cI.SetInputData(CM.GetOutPut()); cI.Run(); // get the cloud center cStatistics cstat = new cStatistics(); cstat.UnselectAll(); cstat.IsMean = true; cstat.SetInputData(NewTable); cstat.Run(); if (cstat.GetOutPut() == null) return; cExtendedList ListMeans = cstat.GetOutPut().GetRow(0); cDescriptorType MahalanobisType = new cDescriptorType("Mahalanobis Distance", true, 1); #region Compute the Threshold int DegreeOfFreedom = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors().Count; cExtendedTable T = new cExtendedTable(); T.Add(new cExtendedList()); T[0].Add((double)MainWindow.numericUpDownPValue.Value); cFunctions F = new cFunctions(); F.SetInputData(T); F.IsInverse = true; F.DegreeOfFreedom = DegreeOfFreedom; F.Run(); double ThresholdForMahalanobis = Math.Sqrt(F.GetOutPut()[1][0]); #endregion int IdxClassForNonOutliers = 1; foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesAvailable) { for (int Col = 0; Col < cGlobalInfo.CurrentScreening.Columns; Col++) for (int Row = 0; Row < cGlobalInfo.CurrentScreening.Rows; Row++) { cWell TmpWell = TmpPlate.GetWell(Col, Row, false); if (TmpWell == null) continue; double ValueDistance = TmpWell.GetAverageValuesList(true)[0].Dist_Mahalanobis(ListMeans, cI.GetOutPut()); if (ValueDistance > ThresholdForMahalanobis || double.IsNaN(ValueDistance) ) // that's an outlier { TmpWell.SetClass(IdxClassForOutliers); } else { TmpWell.SetClass(IdxClassForNonOutliers); } if (MainWindow.checkBoxDistAsDesc.Checked) { cListSignature LDesc = new cListSignature(); cSignature NewDesc = new cSignature(ValueDistance, MahalanobisType, cGlobalInfo.CurrentScreening); LDesc.Add(NewDesc); TmpWell.AddSignatures(LDesc); } } } if (MainWindow.checkBoxDistAsDesc.Checked) { cGlobalInfo.CurrentScreening.ListDescriptors.AddNew(MahalanobisType); } cGlobalInfo.CurrentScreening.ListDescriptors.UpDateDisplay(); cGlobalInfo.CurrentScreening.UpDatePlateListWithFullAvailablePlate(); for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++) cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax(); }
private void dataTableToolStripMenuItem_Click(object sender, EventArgs e) { cDisplayExtendedTable CDT = new cDisplayExtendedTable(); cExtendedTable ET = new cExtendedTable(); ET.Name = toolStripComboBoxLUT.Text; ET.ListRowNames = new List<string>(); byte[][] Res= cGlobalInfo.CurrentPlateLUT; vtkColorTransferFunction TF = vtkColorTransferFunction.New(); // double[] ListValues = {-100.0, -90.0, -80.0, -70.0, -60.000004, -50.0, -40.0, -30.000002, -20.0, 20.0, 30.000002, 40.0, 50.0, 60.000004, 70.0, 80.0, 90.0, 100.0}; for (int i = 0; i < Res[0].Length; i++) { TF.AddRGBPoint((double)(255.0*i)/Res[0].Length, Res[0][i] / 255.0, Res[1][i] / 255.0, Res[2][i] / 255.0); } TF.Build(); ET.Add(new cExtendedList("Red")); ET.Add(new cExtendedList("Green")); ET.Add(new cExtendedList("Blue")); for (int i = 0; i < 255; i++) { double[] Test = TF.GetColor(i); ET[0].Add((char)(Test[0]*255)); ET[1].Add((char)(Test[1]*255)); ET[2].Add((char)(Test[2]*255)); } //ET.Add(new cExtendedList("Red")); //for (int i = 0; i < Res[0].Length; i++) //{ // ET[0].Add(Res[0][i]); // ET.ListRowNames.Add(i.ToString()); //} //ET.Add(new cExtendedList("Green")); //for (int i = 0; i < Res[1].Length; i++) // ET[1].Add(Res[1][i]); //ET.Add(new cExtendedList("Blue")); //for (int i = 0; i < Res[2].Length; i++) // ET[2].Add(Res[2][i]); CDT.SetInputData(ET); CDT.Run(); }
private void drawSingleDRCToolStripMenuItem_Click(object sender, EventArgs e) { int NumberOfReplicate = 4; int DRCNumberofPoints = 20; cExtendedTable FullResults = new cExtendedTable(); FullResults.ListRowNames = new List<string>(); cExtendedList ListPValues = new cExtendedList("DRC"); cDataGeneratorTitration GT = new cDataGeneratorTitration(); GT.NumberOfPoint = DRCNumberofPoints; GT.Start = 100; GT.DilutionFactor = 3; GT.Run(); Random RND = new Random(); cExtendedTable FinalTable = new cExtendedTable(); cDataGeneratorSigmoid DGS = null; DGS = new cDataGeneratorSigmoid(); DGS.SetInputData(GT.GetOutPut()[0]); DGS.EC50 = 0.01; DGS.Bottom = 10; DGS.Top = 110; DGS.Slope = 1; DGS.Run(); // cAddNoise AN = new cAddNoise(); // AN.DistributionType = eRandDistributionType.GAUSSIAN; double NoiseLevel = 10; // EXT[0].Add(NoiseLevel); // EXT[1].Add(DGS.EC50); #region loop over the replicates for (int NumReplic = 0; NumReplic < NumberOfReplicate; NumReplic++) { cExtendedList NewL = DGS.GetOutPut()[1]; for (int k = 0; k < NewL.Count; k++) { NewL[k] += RND.NextDouble() * NoiseLevel; } cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(GT.GetOutPut()[0]); TmpTable.Add(NewL); if (NumReplic >= 1) { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(TmpTable, FinalTable); M.Run(); FinalTable = M.GetOutPut(); } else FinalTable = new cExtendedTable(TmpTable); } #endregion cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(FinalTable); SF.Run(); cGlobalInfo.ConsoleWriteLine("Slope :" + DGS.Slope + " - Evaluated:" + SF.GetOutPut()[0][3]); cGlobalInfo.ConsoleWriteLine("Top :" + DGS.Top + " - Evaluated:" + SF.GetOutPut()[0][1]); cGlobalInfo.ConsoleWriteLine("Bottom :" + DGS.Bottom + " - Evaluated:" + SF.GetOutPut()[0][0]); cGlobalInfo.ConsoleWriteLine("EC50 :" + DGS.EC50 + " - Evaluated:" + SF.GetOutPut()[0][2]); // return; cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(FinalTable); CFG.Run(); cExtendedTable Sigmoid = SF.GetFittedRawValues(GT.GetOutPut()[0]); FinalTable[0] = Sigmoid[1]; cViewerGraph1D VS1 = new cViewerGraph1D(); VS1.SetInputData(new cExtendedTable(Sigmoid[1])); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0];//DGS.GetOutPut()[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = true; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = "Readout"; VS1.Chart.XAxisFormatDigitNumber = -1; VS1.Chart.IsZoomableX = true; VS1.Chart.IsZoomableY = true; VS1.Run(); cDesignerSinglePanel CD = new cDesignerSinglePanel(); CD.SetInputData(VS1.GetOutPut()); CD.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(CD.GetOutPut());//DS.GetOutPut()); DTW.Run(); DTW.Display(); }
public cFeedBackMessage Run(c3DNewWorld _3DWorld) { if (base.Start() == false) { base.FeedBackMessage.IsSucceed = false; return base.FeedBackMessage; } //if (this.Input == null) //{ // FeedBackMessage.IsSucceed = false; // FeedBackMessage.Message = "No input data table defined."; // return FeedBackMessage; //} #region Properties Management object _firstValue = base.ListProperties.FindByName("Normalized ?"); bool IsNormalized = false; if (_firstValue == null) { base.GenerateError("-Normalized ?- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; IsNormalized = (bool)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Normalized ?- cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Draw Axis ?"); bool IsdrawAxis = true; if (_firstValue == null) { base.GenerateError("-Draw Axis ?- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; IsdrawAxis = (bool)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Draw Axis ?- cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Link Points ?"); bool IsLinked = false; if (_firstValue == null) { base.GenerateError("-Link Points ?- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; IsLinked = (bool)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Link Points ?- cast didn't work"); return base.FeedBackMessage; } #endregion cExtendedList ListLenghtsMax = new cExtendedList(); ListObjects = new cListGeometric3DObject("Scatter Plot MetaObject"); double MinX = this.Input.Min(0); double MaxX = this.Input.Max(0); double DeltaX = MaxX - MinX; ListLenghtsMax.Add(DeltaX); if (DeltaX == 0) DeltaX = 1; double MinY = this.Input.Min(1); double MaxY = this.Input.Max(1); double DeltaY = MaxY - MinY; ListLenghtsMax.Add(DeltaY); if (DeltaY == 0) DeltaY = 1; double MinZ = this.Input.Min(2); double MaxZ = this.Input.Max(2); double DeltaZ = MaxZ - MinZ; ListLenghtsMax.Add(DeltaZ); if (DeltaZ == 0) DeltaZ = 1; double MinRad = 0; double MaxRad = 0; double DeltaRad = 1; double MaxLenght = ListLenghtsMax.Min(); if (MaxLenght <= 0) MaxLenght = 1; for (int CurrentSerie = 0; CurrentSerie < this.Input.Count; CurrentSerie++) { cExtendedTable CurrentTable = this.Input[CurrentSerie]; if ((IndexColumnForSphereRadius > 0) && (IndexColumnForSphereRadius < CurrentTable.Count)) { MinRad = CurrentTable[IndexColumnForSphereRadius].Min(); MaxRad = CurrentTable[IndexColumnForSphereRadius].Max(); if (MaxRad != MinRad) DeltaRad = MaxRad - MinRad; } if (CurrentTable.Count == 0) continue; cListGeometric3DObject TmpListObjects = new cListGeometric3DObject("Scatter MetaObject"); TmpListObjects.Tag = CurrentTable.Tag; cPoint3D Pt = null; for (int IdxPt = 0; IdxPt < CurrentTable[0].Count; IdxPt++) { if(IsNormalized) Pt = new cPoint3D((CurrentTable[0][IdxPt] - MinX) / DeltaX, (CurrentTable[1][IdxPt] - MinY) / DeltaY, (CurrentTable[2][IdxPt] - MinZ) / DeltaZ); else Pt = new cPoint3D(CurrentTable[0][IdxPt], CurrentTable[1][IdxPt], CurrentTable[2][IdxPt]); double Rad = this.Radius; if ((IndexColumnForSphereRadius > 0) && (IndexColumnForSphereRadius < CurrentTable.Count)) { Rad = this.Radius * ((CurrentTable[IndexColumnForSphereRadius][IdxPt] - MinRad)) / DeltaRad; Rad /= 200; } if(IndexColumnForSphereRadius>-1) Rad = CurrentTable[IndexColumnForSphereRadius][IdxPt]; if (IsNormalized) Rad /= 300.0; else { Rad = MaxLenght / 100.0; } c3DSphere Sphere = new c3DSphere(Pt, Rad); //c3DPoint Sphere = new c3DPoint(Pt); if ((CurrentTable.ListRowNames != null) && (CurrentTable.ListRowNames.Count > IdxPt)) { if (CurrentTable.ListRowNames[IdxPt] != null) Sphere.SetName(CurrentTable.ListRowNames[IdxPt]); else Sphere.SetName("Sphere " + IdxPt); } else { Sphere.SetName("Sphere " + IdxPt); } if ((CurrentTable.ListTags != null) && (CurrentTable.ListTags[IdxPt] != null) && (CurrentTable.ListTags[IdxPt].GetType() == typeof(cWell))) { if (CurrentTable.ListTags[IdxPt].GetType() == typeof(cWell)) { Sphere.Colour = ((cWell)(CurrentTable.ListTags[IdxPt])).GetClassType().ColourForDisplay; Sphere.Tag = CurrentTable.ListTags[IdxPt]; } } else //if (this.GlobalInfo != null) { Sphere.Colour = cGlobalInfo.ListCellularPhenotypes[CurrentSerie % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay; } TmpListObjects.AddObject(Sphere); if ((ValueToBeDisplayed > 0) && (ValueToBeDisplayed < CurrentTable.Count)) { if (_3DWorld != null) TmpListObjects.Add(new c3DText(_3DWorld, CurrentTable[ValueToBeDisplayed][IdxPt].ToString("N3"), new cPoint3D(Pt.X + 0.02, Pt.Y + 0.02, Pt.Z + 0.02), Color.White, 0.01)); } } ListObjects.AddRange(TmpListObjects); #region Draw Links if (IsLinked) { cListGeometric3DObject ListLinks = new cListGeometric3DObject( "Links MetaObject"); for (int IdxPt = 1; IdxPt < CurrentTable[0].Count; IdxPt++) { cPoint3D Pt1 = null; cPoint3D Pt0 = null; if (IsNormalized) { Pt1 = new cPoint3D((CurrentTable[0][IdxPt] - MinX) / DeltaX, (CurrentTable[1][IdxPt] - MinY) / DeltaY, (CurrentTable[2][IdxPt] - MinZ) / DeltaZ); Pt0 = new cPoint3D((CurrentTable[0][IdxPt - 1] - MinX) / DeltaX, (CurrentTable[1][IdxPt - 1] - MinY) / DeltaY, (CurrentTable[2][IdxPt - 1] - MinZ) / DeltaZ); } else { Pt1 = new cPoint3D(CurrentTable[0][IdxPt], CurrentTable[1][IdxPt] , CurrentTable[2][IdxPt] ); Pt0 = new cPoint3D(CurrentTable[0][IdxPt - 1] , CurrentTable[1][IdxPt - 1] , CurrentTable[2][IdxPt - 1] ); } // new cPoint3D((CurrentTable[0][IdxPt] - MinX) / DeltaX, (CurrentTable[1][IdxPt] - MinY) / DeltaY, (CurrentTable[2][IdxPt] - MinZ) / DeltaZ); //cPoint3D Pt0 = new cPoint3D((CurrentTable[0][IdxPt - 1] - MinX) / DeltaX, (CurrentTable[1][IdxPt - 1] - MinY) / DeltaY, (CurrentTable[2][IdxPt - 1] - MinZ) / DeltaZ); c3DLine Line = new c3DLine(Pt0, Pt1); Line.SetName("Link ["+(IdxPt-1)+";"+IdxPt+"]"); ListLinks.AddObject(Line); } ListObjects.AddRange(ListLinks); } #endregion } #region Draw Axis if (IsdrawAxis && (this.Input[0].Count > 2)) { c3DObject_Axis Axis = new c3DObject_Axis(); cExtendedTable T = new cExtendedTable(); T.Add(new cExtendedList(Input[0][0].Name)); if (IsNormalized) { T[0].Tag = Input[0][0].Tag; T[0].Add(0); T[0].Add(1); T.Add(new cExtendedList(Input[0][1].Name)); T[1].Tag = Input[0][1].Tag; T[1].Add(0); T[1].Add(1); T.Add(new cExtendedList(Input[0][2].Name)); T[2].Tag = Input[0][2].Tag; T[2].Add(0); T[2].Add(1); } else { T[0].Tag = Input[0][0].Tag; T[0].Add(MinX); T[0].Add(MaxX); T.Add(new cExtendedList(Input[0][1].Name)); T[1].Tag = Input[0][1].Tag; T[1].Add(MinY); T[1].Add(MaxY); T.Add(new cExtendedList(Input[0][2].Name)); T[2].Tag = Input[0][2].Tag; T[2].Add(MinZ); T[2].Add(MaxZ); } Axis.SetInputData(T); Axis.Run(_3DWorld); ListObjects.AddRange(Axis.GetOutPut()); } #endregion // _3DWorld.AddGeometric3DObjects(this.ListObjects); return base.FeedBackMessage; }