From 288b5160a6448acba1ff42d7ea937629050ae303 Mon Sep 17 00:00:00 2001 From: Leah Date: Mon, 29 Jun 2020 17:54:07 -0500 Subject: [PATCH 1/2] added flashdeconv parameters for qc --- ProteoWPFSuite/RawExperimentalComponents.xaml | 11 ++++++++- .../RawExperimentalComponents.xaml.cs | 14 ++++++++++- ProteoformSuiteInternal/Calibration.cs | 24 +++++++++++++------ ProteoformSuiteInternal/ComponentReader.cs | 9 ++++++- ProteoformSuiteInternal/Lollipop.cs | 8 ++++++- Test/Test.csproj | 4 ++++ 6 files changed, 59 insertions(+), 11 deletions(-) diff --git a/ProteoWPFSuite/RawExperimentalComponents.xaml b/ProteoWPFSuite/RawExperimentalComponents.xaml index 65944942..8d347d73 100644 --- a/ProteoWPFSuite/RawExperimentalComponents.xaml +++ b/ProteoWPFSuite/RawExperimentalComponents.xaml @@ -93,7 +93,16 @@ - + + + + + + + + diff --git a/ProteoWPFSuite/RawExperimentalComponents.xaml.cs b/ProteoWPFSuite/RawExperimentalComponents.xaml.cs index 181c49a6..46499a53 100644 --- a/ProteoWPFSuite/RawExperimentalComponents.xaml.cs +++ b/ProteoWPFSuite/RawExperimentalComponents.xaml.cs @@ -106,6 +106,8 @@ public void InitializeParameterSet() nUD_mass_tolerance.Value = (decimal)Sweet.lollipop.raw_component_mass_tolerance; CK_rb_displayIdentificationComponents = true; CK_rb_displayQuantificationComponents = false; + nud_minCC.Value = (decimal)Sweet.lollipop.minCC; + nUD_minIC.Value = (decimal)Sweet.lollipop.minIC; FillTablesAndCharts(); } @@ -210,7 +212,17 @@ private void nUD_mass_tolerance_ValueChanged(object sender, EventArgs e) Sweet.lollipop.raw_component_mass_tolerance = Convert.ToDouble(nUD_mass_tolerance.Value); } + private void nUD_minCC_ValueChanged(object sender, EventArgs e) + { + Sweet.lollipop.minCC = Convert.ToDouble(nud_minCC.Value); + } + + private void nUD_minIC_ValueChanged(object sender, EventArgs e) + { + Sweet.lollipop.minIC = Convert.ToDouble(nUD_minIC.Value); + } + #endregion Private Methods - + } } diff --git a/ProteoformSuiteInternal/Calibration.cs b/ProteoformSuiteInternal/Calibration.cs index aa7ed369..642dfcc4 100755 --- a/ProteoformSuiteInternal/Calibration.cs +++ b/ProteoformSuiteInternal/Calibration.cs @@ -620,6 +620,8 @@ public static void calibrate_td_hits_file(InputFile file) double corrected_RT; // key is filename, hit scan #, hit reported mass, value is corrected mass string[] row = old[i].Split('\t'); + bool add_row_to_new_document = true; + if (Sweet.lollipop.retention_time_calibration) { if (Sweet.lollipop.td_hit_RT_correction.TryGetValue( @@ -628,7 +630,10 @@ public static void calibrate_td_hits_file(InputFile file) Convert.ToDouble(row[index_precursor_mass])), out corrected_RT)) { row[index_retention_time] = corrected_RT.ToString(); - new_file.Add(String.Join("\t", row)); + } + else + { + add_row_to_new_document = false; } } @@ -640,10 +645,16 @@ public static void calibrate_td_hits_file(InputFile file) Convert.ToDouble(row[index_precursor_mass])), out corrected_mass)) { row[index_precursor_mass] = corrected_mass.ToString(); - new_file.Add(String.Join("\t", row)); - + } + else + { + add_row_to_new_document = false; } } + if(add_row_to_new_document) + { + new_file.Add(String.Join("\t", row)); + } } File.WriteAllLines(new_absolute_path, new_file); } @@ -715,13 +726,13 @@ public static void calibrate_components_in_xlsx(InputFile file) if (Sweet.lollipop.component_mz_correction.TryGetValue(new Tuple(file.filename, Math.Round(intensity, 0), Math.Round(mass, 2)), out value)) { row[2] = value.ToString(); - new_file.Add(string.Join("\t", row)); } if (Sweet.lollipop.component_RT_correction.TryGetValue(new Tuple(file.filename, Math.Round(intensity, 0), Math.Round(mass, 2)), out value)) { row[8] = (value*60).ToString(); - new_file.Add(string.Join("\t", row)); } + new_file.Add(string.Join("\t", row)); + } else if (row.Length == 3 && Double.TryParse(row[0], out mass) && Double.TryParse(row[1], out intensity)) @@ -730,13 +741,12 @@ public static void calibrate_components_in_xlsx(InputFile file) if (Sweet.lollipop.component_mz_correction.TryGetValue(new Tuple(file.filename, Math.Round(intensity, 0), Math.Round(mass, 2)), out value)) { row[0] = value.ToString(); - new_file.Add(string.Join("\t", row)); } if (Sweet.lollipop.component_RT_correction.TryGetValue(new Tuple(file.filename, Math.Round(intensity, 0), Math.Round(mass, 2)), out value)) { row[2] = value.ToString(); - new_file.Add(string.Join("\t", row)); } + new_file.Add(string.Join("\t", row)); } } File.WriteAllLines(new_absolute_path, new_file); diff --git a/ProteoformSuiteInternal/ComponentReader.cs b/ProteoformSuiteInternal/ComponentReader.cs index edca3440..2ca49cda 100644 --- a/ProteoformSuiteInternal/ComponentReader.cs +++ b/ProteoformSuiteInternal/ComponentReader.cs @@ -124,7 +124,7 @@ public List read_components_from_tsv(InputFile file, bool remove_miss add_component(c); } } - else if(row.Length == 16) + else if (row.Length == 16) { List cellStrings = new List(); cellStrings.Add(row[0]); //id @@ -153,6 +153,13 @@ public List read_components_from_tsv(InputFile file, bool remove_miss if (acceptable_component(c)) { + double IC = Convert.ToDouble(row[14]); + double CC = Convert.ToDouble(row[15]); + if (IC < Sweet.lollipop.minIC || CC < Sweet.lollipop.minCC) + { + continue; + } + add_component(c); } } diff --git a/ProteoformSuiteInternal/Lollipop.cs b/ProteoformSuiteInternal/Lollipop.cs index fb623f30..fc85e5ff 100644 --- a/ProteoformSuiteInternal/Lollipop.cs +++ b/ProteoformSuiteInternal/Lollipop.cs @@ -144,6 +144,8 @@ public void enter_input_files(string[] files, IEnumerable acceptable_ext public List raw_quantification_components = new List(); public bool neucode_labeled = false; public double raw_component_mass_tolerance = 5; + public double minIC = 0.7; + public double minCC = 0.7; #endregion RAW EXPERIMENTAL COMPONENTS Public Fields @@ -193,7 +195,11 @@ public string flash_deconv(int maxcharge, int mincharge, string directory) if(f.extension == ".raw") { - return "Error: please convert .raw files to .mzML"; + //var myMsDataFile = ThermoRawFileReaderData.LoadAllStaticData(f.complete_path); + //MzmlMethods.CreateAndWriteMyMzmlWithCalibratedSpectra(myMsDataFile, + //f.directory + "\\" + f.filename + "PS.mzML", false); + //filelocation = f.directory + "\\" + f.filename + "PS"; + return "Error: please convert .raw files to .mzML"; } Process proc = new Process(); diff --git a/Test/Test.csproj b/Test/Test.csproj index 3532c99c..1380b7de 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -11,6 +11,10 @@ false + + x86 + + From 874792de530b9a2710b7d289ff52ebc986dcf9fe Mon Sep 17 00:00:00 2001 From: Leah Date: Mon, 29 Jun 2020 18:05:28 -0500 Subject: [PATCH 2/2] unit test --- Test/TestFLASHDeconv.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/TestFLASHDeconv.cs b/Test/TestFLASHDeconv.cs index c3c1e5a7..0dedef77 100644 --- a/Test/TestFLASHDeconv.cs +++ b/Test/TestFLASHDeconv.cs @@ -29,7 +29,7 @@ public void testFLASHDeconv() List deconv_components = new List(); Sweet.lollipop.process_raw_components(Sweet.lollipop.input_files.Where(f => f.purpose == Purpose.Identification).ToList(), deconv_components, Purpose.Identification, false); - Assert.AreEqual(54, deconv_components.Count); + Assert.AreEqual(52, deconv_components.Count); Assert.AreEqual(6999.01, Math.Round(deconv_components.OrderBy(c => c.id).First().reported_monoisotopic_mass, 2)); Assert.AreEqual(6999.01, Math.Round(deconv_components.OrderBy(c => c.id).First().weighted_monoisotopic_mass, 2)); Assert.AreEqual(15184400000, Math.Round(deconv_components.OrderBy(c => c.id).First().intensity_reported, 2));