private void PreparingMultiGlycan(Dictionary <COL.GlycoLib.enumLabelingTag, float> argLabeling) { DoLog = chkLog.Checked; //saveFileDialog1.Filter = "Excel Files (*.xslx)|*.xslx"; //saveFileDialog1.Filter = "CSV Files (*.csv)|*.csv"; DateTime time = DateTime.Now; // Use current time string TimeFormat = "yyMMdd HHmm"; // Use this format if (DoLog) { Logger.WriteLog(System.Environment.NewLine + System.Environment.NewLine + "-----------------------------------------------------------"); Logger.WriteLog("Start Process"); } saveFileDialog1.FileName = Path.GetDirectoryName(txtRawFile.Text) + "\\" + Path.GetFileNameWithoutExtension(txtRawFile.Text) + "-" + time.ToString(TimeFormat); if (txtRawFile.Text == "" || (rdoUserList.Checked && txtGlycanList.Text == "") || txtMaxLCTime.Text == "") { MessageBox.Show("Please check input values."); if (DoLog) { Logger.WriteLog("End Process- because input value not complete"); } return; } if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string glycanlist = System.Windows.Forms.Application.StartupPath + "\\Default_Combination.csv"; if (!rdoDefaultList.Checked) { glycanlist = txtGlycanList.Text; } if (DoLog) { Logger.WriteLog("Start initial program"); } List <float> AdductMasses = new List <float>(); Dictionary <float, string> AdductLabel = new Dictionary <float, string>(); if (chkAdductK.Checked) { AdductMasses.Add(MassLib.Atoms.Potassium); AdductLabel.Add(MassLib.Atoms.Potassium, "K"); } if (chkAdductNH4.Checked) { AdductMasses.Add(MassLib.Atoms.NitrogenMass + 4 * MassLib.Atoms.HydrogenMass); AdductLabel.Add(MassLib.Atoms.NitrogenMass + 4 * MassLib.Atoms.HydrogenMass, "NH4"); } if (chkAdductNa.Checked) { AdductMasses.Add(MassLib.Atoms.SodiumMass); AdductLabel.Add(MassLib.Atoms.SodiumMass, "Na"); } if (chkAdductProton.Checked) { AdductMasses.Add(MassLib.Atoms.ProtonMass); AdductLabel.Add(MassLib.Atoms.ProtonMass, "H"); } float outMass = 0.0f; if (chkAdductUser.Checked && float.TryParse(txtAdductMass.Text, out outMass)) { AdductMasses.Add(outMass); AdductLabel.Add(outMass, "User"); } // MultiNGlycanESIMultiThreads MultiESIs = new MultiNGlycanESIMultiThreads(glycanlist, txtRawFile.Text, Convert.ToInt32(cboCPU.SelectedItem), _peakParameter, _transformParameters); MultiGlycanESI ESI = null; if (argLabeling.Count != 0) { ESI = new MultiGlycanESI(txtRawFile.Text, Convert.ToInt32(txtStartScan.Text), Convert.ToInt32(txtEndScan.Text), glycanlist, Convert.ToDouble(txtPPM.Text), Convert.ToDouble(txtGlycanPPM.Text), chkPermethylated.Checked, chkReducedReducingEnd.Checked, cboSia.SelectedIndex, argLabeling, AdductLabel, AdductMasses, DoLog, rdoPositive.Checked); } else { ESI = new MultiGlycanESI(txtRawFile.Text, Convert.ToInt32(txtStartScan.Text), Convert.ToInt32(txtEndScan.Text), glycanlist, Convert.ToDouble(txtPPM.Text), Convert.ToDouble(txtGlycanPPM.Text), chkPermethylated.Checked, chkReducedReducingEnd.Checked, cboSia.SelectedIndex, DoLog, rdoPositive.Checked); } ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.None; if (rdoDRAG.Checked) { ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.DRAG; } else if (rdoMultiplePemrthylated.Checked) { ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.MultiplexPermethylated; } ESI.PositiveChargeMode = rdoPositive.Checked; ESI.MergeDifferentChargeIntoOne = chkMergeDffCharge.Checked; ESI.ExportFilePath = saveFileDialog1.FileName; ESI.MaxLCBackMin = Convert.ToSingle(txtMaxLCTime.Text); ESI.MaxLCFrontMin = Convert.ToSingle(txtMinLCTime.Text); ESI.IsotopePPM = Convert.ToSingle(txtIsotopeEnvTolerence.Text); ESI.MininumIsotopePeakCount = Convert.ToInt32(txtIsotopeEnvMinPeakCount.Text); ESI.PeakSNRatio = Convert.ToSingle(txtSN.Text); ESI.IsMatchMonoisotopicOnly = chkMonoOnly.Checked; ESI.ApplyLinearRegLC = chkApplyLinearRegLC.Checked; ESI.MinPeakHeightPrecentage = Convert.ToSingle(txtMinPeakHeight.Text); if (chkAbundance.Checked) { ESI.MinAbundance = Convert.ToDouble(txtAbundanceMin.Text); } else { ESI.MinAbundance = 0; } if (chkMinLengthOfLC.Checked) { ESI.MinLengthOfLC = Convert.ToSingle(txtScanCount.Text); } else { ESI.MinLengthOfLC = 0; } if (chkMZMatch.Checked) { ESI.IncludeMZMatch = true; } ESI.ForceProtonatedGlycan = chkForceProtonated.Checked; // ESI.AdductMass = AdductMasses; //ESI.AdductMassToLabel = AdductLabel; ESI.IndividualImgs = chkIndividualImg.Checked; ESI.QuantificationImgs = chkQuantImgs.Checked; ESI.TotalLCTime = Convert.ToSingle(txtLCTime.Text); ESI.LCTimeTolerance = Convert.ToSingle(txtLCTolerance.Text) / 100.0f; if (lstGU != null && lstGU.Count > 0) { ESI.GlycanUnits = lstGU; double[] x = lstGU.Select(ti => Convert.ToDouble(ti.EluctionTime)).ToArray(); double[] y = lstGU.Select(gu => Convert.ToDouble(gu.GU)).ToArray(); ESI.GUFitFunction = new ViliPetek.LinearAlgebra.PolyFit(x, y, 5); } if (DoLog) { Logger.WriteLog("Initial program complete"); } frmProcessing frmProcess = new frmProcessing(ESI, DoLog); frmProcess.ShowDialog(); if (DoLog) { Logger.WriteLog("Finish process"); } } }
private void PreparingMultiGlycan(Dictionary<COL.GlycoLib.enumLabelingTag,float> argLabeling) { DoLog = chkLog.Checked; //saveFileDialog1.Filter = "Excel Files (*.xslx)|*.xslx"; //saveFileDialog1.Filter = "CSV Files (*.csv)|*.csv"; DateTime time = DateTime.Now; // Use current time string TimeFormat = "yyMMdd HHmm"; // Use this format if (DoLog) { Logger.WriteLog(System.Environment.NewLine + System.Environment.NewLine + "-----------------------------------------------------------"); Logger.WriteLog("Start Process"); } saveFileDialog1.FileName = Path.GetDirectoryName(txtRawFile.Text) + "\\" + Path.GetFileNameWithoutExtension(txtRawFile.Text) + "-" + time.ToString(TimeFormat); if (txtRawFile.Text == "" || (rdoUserList.Checked && txtGlycanList.Text == "") || txtMaxLCTime.Text == "") { MessageBox.Show("Please check input values."); if (DoLog) { Logger.WriteLog("End Process- because input value not complete"); } return; } if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string glycanlist = System.Windows.Forms.Application.StartupPath + "\\Default_Combination.csv"; if (!rdoDefaultList.Checked) { glycanlist = txtGlycanList.Text; } if (DoLog) { Logger.WriteLog("Start initial program"); } List<float> AdductMasses = new List<float>(); Dictionary<float, string> AdductLabel = new Dictionary<float, string>(); if (chkAdductK.Checked) { AdductMasses.Add(MassLib.Atoms.Potassium); AdductLabel.Add(MassLib.Atoms.Potassium, "K"); } if (chkAdductNH4.Checked) { AdductMasses.Add(MassLib.Atoms.NitrogenMass + 4 * MassLib.Atoms.HydrogenMass); AdductLabel.Add(MassLib.Atoms.NitrogenMass + 4 * MassLib.Atoms.HydrogenMass, "NH4"); } if (chkAdductNa.Checked) { AdductMasses.Add(MassLib.Atoms.SodiumMass); AdductLabel.Add(MassLib.Atoms.SodiumMass, "Na"); } if (chkAdductProton.Checked) { AdductMasses.Add(MassLib.Atoms.ProtonMass); AdductLabel.Add(MassLib.Atoms.ProtonMass, "H"); } float outMass = 0.0f; if (chkAdductUser.Checked && float.TryParse(txtAdductMass.Text, out outMass)) { AdductMasses.Add(outMass); AdductLabel.Add(outMass, "User"); } // MultiNGlycanESIMultiThreads MultiESIs = new MultiNGlycanESIMultiThreads(glycanlist, txtRawFile.Text, Convert.ToInt32(cboCPU.SelectedItem), _peakParameter, _transformParameters); MultiGlycanESI ESI = null; if (argLabeling.Count != 0) { ESI = new MultiGlycanESI(txtRawFile.Text, Convert.ToInt32(txtStartScan.Text), Convert.ToInt32(txtEndScan.Text), glycanlist, Convert.ToDouble(txtPPM.Text), Convert.ToDouble(txtGlycanPPM.Text), chkPermethylated.Checked, chkReducedReducingEnd.Checked,cboSia.SelectedIndex, argLabeling, AdductLabel,AdductMasses, DoLog, rdoPositive.Checked); } else { ESI = new MultiGlycanESI(txtRawFile.Text, Convert.ToInt32(txtStartScan.Text), Convert.ToInt32(txtEndScan.Text), glycanlist, Convert.ToDouble(txtPPM.Text), Convert.ToDouble(txtGlycanPPM.Text), chkPermethylated.Checked, chkReducedReducingEnd.Checked, cboSia.SelectedIndex, DoLog, rdoPositive.Checked); } ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.None; if (rdoDRAG.Checked) { ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.DRAG; } else if (rdoMultiplePemrthylated.Checked) { ESI.LabelingMethod = GlycoLib.enumGlycanLabelingMethod.MultiplexPermethylated; } ESI.PositiveChargeMode = rdoPositive.Checked; ESI.MergeDifferentChargeIntoOne = chkMergeDffCharge.Checked; ESI.ExportFilePath = saveFileDialog1.FileName; ESI.MaxLCBackMin = Convert.ToSingle(txtMaxLCTime.Text); ESI.MaxLCFrontMin = Convert.ToSingle(txtMinLCTime.Text); ESI.IsotopePPM = Convert.ToSingle(txtIsotopeEnvTolerence.Text); ESI.MininumIsotopePeakCount = Convert.ToInt32(txtIsotopeEnvMinPeakCount.Text); ESI.PeakSNRatio = Convert.ToSingle(txtSN.Text); ESI.IsMatchMonoisotopicOnly = chkMonoOnly.Checked; ESI.ApplyLinearRegLC = chkApplyLinearRegLC.Checked; ESI.MinPeakHeightPrecentage = Convert.ToSingle(txtMinPeakHeight.Text); if (chkAbundance.Checked) { ESI.MinAbundance = Convert.ToDouble(txtAbundanceMin.Text); } else { ESI.MinAbundance = 0; } if (chkMinLengthOfLC.Checked) { ESI.MinLengthOfLC = Convert.ToSingle(txtScanCount.Text); } else { ESI.MinLengthOfLC = 0; } if (chkMZMatch.Checked) { ESI.IncludeMZMatch = true; } ESI.ForceProtonatedGlycan = chkForceProtonated.Checked; // ESI.AdductMass = AdductMasses; //ESI.AdductMassToLabel = AdductLabel; ESI.IndividualImgs = chkIndividualImg.Checked; ESI.QuantificationImgs = chkQuantImgs.Checked; ESI.TotalLCTime = Convert.ToSingle(txtLCTime.Text); ESI.LCTimeTolerance = Convert.ToSingle(txtLCTolerance.Text)/100.0f; if (DoLog) { Logger.WriteLog("Initial program complete"); } frmProcessing frmProcess = new frmProcessing(ESI, DoLog); frmProcess.ShowDialog(); if (DoLog) { Logger.WriteLog("Finish process"); } } }