private void generateDRCsToolStripMenuItem_Click(object sender, EventArgs e) { int nbrofdrugs = 6; int nbrofconcentrations = 10; int nbrofdesc = 3; double[, ,] DRC = new double[nbrofconcentrations, nbrofdrugs, nbrofdesc]; float[] X1 = new float[nbrofconcentrations]; X1[0] = 1000; for (int i = 1; i < X1.Length; i++) { X1[i] = X1[i - 1] / 3; } Random Bot = new Random(); Random To = new Random(); Random Ec5 = new Random(); Random Slop = new Random(); CompleteScreening = new cScreening("Current Screen", this.GlobalInfo); CompleteScreening.Columns = nbrofconcentrations; CompleteScreening.Rows = nbrofdrugs; for (int j = 0; j < nbrofdrugs; j++) { for (int k = 0; k < nbrofdesc; k++) { float Bottom = Bot.Next(10); float Top = To.Next(80, 100); float Ec50 = Ec5.Next(40, 60); float Slope = Slop.Next(1, 5); for (int i = 0; i < X1.Length; i++) { //DRC[i, j, k] = Bottom + (Top - Bottom) / (1 + Math.Pow(((Math.Pow(10, Ec50) / Math.Pow(10, X1[0]))), Slope)); DRC[i, j, k] = Bottom + (Top - Bottom) / (1 + Math.Pow((X1[i] / Ec50), -Slope)); } } } cPlate NewPlate = new cPlate("Cpds", "Plate0", CompleteScreening); CompleteScreening.AddPlate(NewPlate); CompleteScreening.ListDescriptors.Clean(); for (int k = 0; k < nbrofdesc; k++) { cDescriptorsType DescType = new cDescriptorsType("Desc" + k, true, 1, GlobalInfo); CompleteScreening.ListDescriptors.AddNew(DescType); } for (int j = 0; j < nbrofdrugs; j++) { for (int i = 0; i < nbrofconcentrations; i++) { List<cDescriptor> LDesc = new List<cDescriptor>(); for (int k = 0; k < nbrofdesc; k++) { //DRC[i, j, k] = Bottom + (Top - Bottom) / (1 + Math.Pow(((Math.Pow(10, Ec50) / Math.Pow(10, X1[0]))), Slope)); cDescriptor CurrentDesc = new cDescriptor(DRC[i, j, k], CompleteScreening.ListDescriptors[k], CompleteScreening); LDesc.Add(CurrentDesc); } cWell NewWell = new cWell(LDesc, i+1, j+1, CompleteScreening, NewPlate); NewWell.Concentration = X1[i]; NewPlate.AddWell(NewWell); } } CompleteScreening.ListDescriptors.UpDateDisplay(); CompleteScreening.UpDatePlateListWithFullAvailablePlate(); for (int idxP = 0; idxP < CompleteScreening.ListPlatesActive.Count; idxP++) CompleteScreening.ListPlatesActive[idxP].UpDataMinMax(); StartingUpDateUI(); this.toolStripcomboBoxPlateList.Items.Clear(); for (int IdxPlate = 0; IdxPlate < CompleteScreening.ListPlatesActive.Count; IdxPlate++) { string Name = CompleteScreening.ListPlatesActive.GetPlate(IdxPlate).Name; this.toolStripcomboBoxPlateList.Items.Add(Name); PlateListWindow.listBoxPlateNameToProcess.Items.Add(Name); PlateListWindow.listBoxAvaliableListPlates.Items.Add(Name); } CompleteScreening.CurrentDisplayPlateIdx = 0; CompleteScreening.SetSelectionType(comboBoxClass.SelectedIndex - 1); UpdateUIAfterLoading(); }
private void hitsDistributionMapToolStripMenuItem_Click(object sender, EventArgs e) { if (cGlobalInfo.CurrentScreening == null) return; List<cPanelForDisplayArray> ListPlates = new List<cPanelForDisplayArray>(); foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) { ListPlates.Add(new FormToDisplayPlate(CurrentPlate)); } cWindowToDisplayEntireScreening WindowToDisplayArray = new cWindowToDisplayEntireScreening(ListPlates, cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(), 6); WindowToDisplayArray.checkBoxDisplayClasses.Checked = true; WindowToDisplayArray.Text = "Generate Hits Distribution Maps"; WindowToDisplayArray.Show(); System.Windows.Forms.DialogResult ResWin = MessageBox.Show("By applying this process, the current screening will be entirely updated ! Proceed ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (ResWin == System.Windows.Forms.DialogResult.No) { WindowToDisplayArray.Close(); return; } WindowToDisplayArray.Close(); if (cGlobalInfo.CurrentScreening != null) cGlobalInfo.CurrentScreening.Close3DView(); // CompleteScreening.ListDescriptors.RemoveDesc(CompleteScreening.ListDescriptors[IntToTransfer], CompleteScreening); cScreening MergedScreening = new cScreening("Class Screen"); MergedScreening.PanelForPlate = this.panelForPlate; MergedScreening.Rows = cGlobalInfo.CurrentScreening.Rows; MergedScreening.Columns = cGlobalInfo.CurrentScreening.Columns; MergedScreening.ListPlatesAvailable = new cListPlates(); // create the descriptor MergedScreening.ListDescriptors.Clean(); List<cDescriptorType> ListDescType = new List<cDescriptorType>(); List<int[][]> Values = new List<int[][]>(); for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++) { cDescriptorType DescClass = new cDescriptorType("Class_" + i, true, 1); ListDescType.Add(DescClass); MergedScreening.ListDescriptors.AddNew(DescClass); int[][] TMpVal = new int[MergedScreening.Columns][]; for (int ii = 0; ii < MergedScreening.Columns; ii++) TMpVal[ii] = new int[MergedScreening.Rows]; Values.Add(TMpVal); } MergedScreening.ListDescriptors.CurrentSelectedDescriptorIdx = 0; foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) { foreach (cWell TmpWell in CurrentPlate.ListActiveWells) { int Class = TmpWell.GetCurrentClassIdx(); if (Class >= 0) Values[Class][TmpWell.GetPosX() - 1][TmpWell.GetPosY() - 1]++; } } cPlate NewPlate = new cPlate(cGlobalInfo.CurrentScreening.GetName(), MergedScreening); for (int X = 0; X < cGlobalInfo.CurrentScreening.Columns; X++) for (int Y = 0; Y < cGlobalInfo.CurrentScreening.Rows; Y++) { cListSignature LDesc = new cListSignature(); for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++) { cSignature Desc = new cSignature(Values[i][X][Y], ListDescType[i], cGlobalInfo.CurrentScreening); LDesc.Add(Desc); } cWell NewWell = new cWell(LDesc, X + 1, Y + 1, MergedScreening, NewPlate); // NewWell.SetCpdName("Well [" + (X + 1) + ":" + (Y + 1) + "]"); NewPlate.AddWell(NewWell); } // check if the plate exist already MergedScreening.AddPlate(NewPlate); MergedScreening.ListPlatesActive = new cListPlates(); cGlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.Items.Clear(); for (int i = 0; i < MergedScreening.ListPlatesAvailable.Count; i++) { MergedScreening.ListPlatesActive.Add(MergedScreening.ListPlatesAvailable[i]); cGlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.Items.Add(NewPlate.GetName()); } cGlobalInfo.CurrentScreening.ListDescriptors = MergedScreening.ListDescriptors; cGlobalInfo.CurrentScreening.ListPlatesAvailable = MergedScreening.ListPlatesAvailable; cGlobalInfo.CurrentScreening.ListPlatesActive = MergedScreening.ListPlatesActive; cGlobalInfo.CurrentScreening.UpDatePlateListWithFullAvailablePlate(); for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++) cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax(); cGlobalInfo.CurrentScreening.CurrentDisplayPlateIdx = 0; cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), true); ListPlates = new List<cPanelForDisplayArray>(); for (int DescIdx = 0; DescIdx < cGlobalInfo.CurrentScreening.ListDescriptors.Count; DescIdx++) { if (cGlobalInfo.CurrentScreening.ListDescriptors[DescIdx].IsActive()) ListPlates.Add(new FormToDisplayDescriptorPlate(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate(), cGlobalInfo.CurrentScreening, DescIdx)); } cWindowToDisplayEntireDescriptors WindowToDisplayDesc = new cWindowToDisplayEntireDescriptors(ListPlates, cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName(), cGlobalInfo.ListWellClasses.Count); WindowToDisplayDesc.checkBoxGlobalNormalization.Checked = true; WindowToDisplayDesc.Show(); }
private void convertDRCToWellToolStripMenuItem1_Click(object sender, EventArgs e) { System.Windows.Forms.DialogResult ResWin = MessageBox.Show("By applying this process, the current screening will be entirely updated ! Proceed ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (ResWin == System.Windows.Forms.DialogResult.No) return; //foreach (cDescriptorsType DescType in CompleteScreening.ListDescriptors) //{ // CompleteScreening.ListDescriptors.RemoveDescUnSafe(DescType, CompleteScreening); //} if (CompleteScreening != null) CompleteScreening.Close3DView(); // CompleteScreening.ListDescriptors.RemoveDesc(CompleteScreening.ListDescriptors[IntToTransfer], CompleteScreening); cScreening MergedScreening = new cScreening("Merged Screen", GlobalInfo); MergedScreening.PanelForPlate = this.panelForPlate; MergedScreening.Rows = CompleteScreening.Rows; MergedScreening.Columns = CompleteScreening.Columns; MergedScreening.ListPlatesAvailable = new cExtendPlateList(); // create the descriptor MergedScreening.ListDescriptors.Clean(); int Idesc = 0; List<cDescriptorsType> ListDescType = new List<cDescriptorsType>(); for (int i = 0; i < CompleteScreening.ListDescriptors.Count; i++) { if (!CompleteScreening.ListDescriptors[i].IsActive()) continue; cDescriptorsType DescEC50 = new cDescriptorsType("EC50_" + CompleteScreening.ListDescriptors[i].GetName(), true, 1, GlobalInfo); ListDescType.Add(DescEC50); MergedScreening.ListDescriptors.AddNew(DescEC50); cDescriptorsType DescTop = new cDescriptorsType("Top_" + CompleteScreening.ListDescriptors[i].GetName(), true, 1, GlobalInfo); ListDescType.Add(DescTop); MergedScreening.ListDescriptors.AddNew(DescTop); cDescriptorsType DescBottom = new cDescriptorsType("Bottom_" + CompleteScreening.ListDescriptors[i].GetName(), true, 1, GlobalInfo); ListDescType.Add(DescBottom); MergedScreening.ListDescriptors.AddNew(DescBottom); cDescriptorsType DescSlope = new cDescriptorsType("Slope_" + CompleteScreening.ListDescriptors[i].GetName(), true, 1, GlobalInfo); ListDescType.Add(DescSlope); MergedScreening.ListDescriptors.AddNew(DescSlope); Idesc++; } MergedScreening.ListDescriptors.CurrentSelectedDescriptor = 0; foreach (cPlate CurrentPlate in CompleteScreening.ListPlatesAvailable) { cPlate NewPlate = new cPlate("Cpds", CurrentPlate.Name + " Merged", MergedScreening); // check if the plate exist already MergedScreening.AddPlate(NewPlate); foreach (cDRC_Region CurrentRegion in CurrentPlate.ListDRCRegions) { List<cDescriptor> LDesc = new List<cDescriptor>(); Idesc = 0; int IDESCBase = 0; for (int i = 0; i < CompleteScreening.ListDescriptors.Count; i++) { if (!CompleteScreening.ListDescriptors[i].IsActive()) continue; cDRC CurrentDRC = CurrentRegion.GetDRC(CompleteScreening.ListDescriptors[IDESCBase++]); cDescriptor Desc_EC50 = new cDescriptor(CurrentDRC.EC50, ListDescType[Idesc++], CompleteScreening); LDesc.Add(Desc_EC50); cDescriptor Desc_Top = new cDescriptor(CurrentDRC.Top, ListDescType[Idesc++], CompleteScreening); LDesc.Add(Desc_Top); cDescriptor Desc_Bottom = new cDescriptor(CurrentDRC.Bottom, ListDescType[Idesc++], CompleteScreening); LDesc.Add(Desc_Bottom); cDescriptor Desc_Slope = new cDescriptor(CurrentDRC.Slope, ListDescType[Idesc++], CompleteScreening); LDesc.Add(Desc_Slope); } cWell NewWell = new cWell(LDesc, CurrentRegion.PosXMin + 1, CurrentRegion.PosYMin + 1, MergedScreening, NewPlate); NewWell.Name = "DRC [" + CurrentRegion.PosXMin + ":" + CurrentRegion.PosYMin + "]"; NewPlate.AddWell(NewWell); } } // PanelList[0].CurrentScreening.ListPlatesActive.Clear(); // PanelList[0].CurrentScreening.GlobalInfo.WindowHCSAnalyzer.RefreshInfoScreeningRichBox(); MergedScreening.ListPlatesActive = new cExtendPlateList(); for (int i = 0; i < MergedScreening.ListPlatesAvailable.Count; i++) { MergedScreening.ListPlatesActive.Add(MergedScreening.ListPlatesAvailable[i]); // MergedScreening.GlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.Items.Add(PanelList[0].CurrentScreening.ListPlatesActive[i].Name); } //PanelList[0].CurrentScreening.CurrentDisplayPlateIdx = 0; //PanelList[0].CurrentScreening.GlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.SelectedIndex = 0; //PanelList[0].CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(PanelList[0].CurrentScreening.ListDescriptors.CurrentSelectedDescriptor, false); CompleteScreening.ListDescriptors = MergedScreening.ListDescriptors; CompleteScreening.ListPlatesAvailable = MergedScreening.ListPlatesAvailable; CompleteScreening.ListPlatesActive = MergedScreening.ListPlatesActive; CompleteScreening.UpDatePlateListWithFullAvailablePlate(); for (int idxP = 0; idxP < CompleteScreening.ListPlatesActive.Count; idxP++) CompleteScreening.ListPlatesActive[idxP].UpDataMinMax(); CompleteScreening.GetCurrentDisplayPlate().DisplayDistribution(CompleteScreening.ListDescriptors.CurrentSelectedDescriptor, true); }