Skip to content

Commit

Permalink
added flashdeconv parameters for qc
Browse files Browse the repository at this point in the history
  • Loading branch information
Leah committed Jun 29, 2020
1 parent 22e48f9 commit 288b516
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 11 deletions.
11 changes: 10 additions & 1 deletion ProteoWPFSuite/RawExperimentalComponents.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@
<winform:NumericUpDown x:Name="nUD_mass_tolerance" Value="0" DecimalPlaces="0" Increment="1" Maximum="100" Minimum="0" ValueChanged="nUD_mass_tolerance_ValueChanged"></winform:NumericUpDown>
</WindowsFormsHost>
<Label Grid.Column="1" Grid.Row="0" Margin="5 10 5 0">Mass Tolerance for Merging Artifacts (ppm)</Label>

<WindowsFormsHost Margin="5 0 5 0" Grid.Column="0" Grid.Row="1">
<winform:NumericUpDown x:Name="nud_minCC" Value="0.70" DecimalPlaces="2" Increment=".01" Maximum="1" Minimum=".70" ValueChanged="nUD_minCC_ValueChanged"></winform:NumericUpDown>
</WindowsFormsHost>
<Label Grid.Column="1" Grid.Row="1" Margin="5 10 5 0">Cosine threshold between per-charge-intensities and fitted gaussian distribution</Label>
<WindowsFormsHost Margin="5 0 5 0" Grid.Column="0" Grid.Row="2">
<winform:NumericUpDown x:Name="nUD_minIC" Value="0.70" DecimalPlaces="2" Increment=".01" Maximum="1" Minimum="0.70" ValueChanged="nUD_minIC_ValueChanged"></winform:NumericUpDown>
</WindowsFormsHost>
<Label Grid.Column="1" Grid.Row="2" Margin="5 10 5 0">
Cosine threshold between averagine and observed isotope pattern
</Label>
</Grid>
<GridSplitter Grid.Row="1" Background="LightGray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ResizeDirection="Rows" />
<Grid Grid.Row="2">
Expand Down
14 changes: 13 additions & 1 deletion ProteoWPFSuite/RawExperimentalComponents.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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

}
}
24 changes: 17 additions & 7 deletions ProteoformSuiteInternal/Calibration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}
}

Expand All @@ -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);
}
Expand Down Expand Up @@ -715,13 +726,13 @@ public static void calibrate_components_in_xlsx(InputFile file)
if (Sweet.lollipop.component_mz_correction.TryGetValue(new Tuple<string, double, double>(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<string, double, double>(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))
Expand All @@ -730,13 +741,12 @@ public static void calibrate_components_in_xlsx(InputFile file)
if (Sweet.lollipop.component_mz_correction.TryGetValue(new Tuple<string, double, double>(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<string, double, double>(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);
Expand Down
9 changes: 8 additions & 1 deletion ProteoformSuiteInternal/ComponentReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public List<Component> read_components_from_tsv(InputFile file, bool remove_miss
add_component(c);
}
}
else if(row.Length == 16)
else if (row.Length == 16)
{
List<string> cellStrings = new List<string>();
cellStrings.Add(row[0]); //id
Expand Down Expand Up @@ -153,6 +153,13 @@ public List<Component> 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);
}
}
Expand Down
8 changes: 7 additions & 1 deletion ProteoformSuiteInternal/Lollipop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public void enter_input_files(string[] files, IEnumerable<string> acceptable_ext
public List<Component> raw_quantification_components = new List<Component>();
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

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="mzLib" Version="1.0.472" />
<PackageReference Include="nunit" Version="3.12.0" />
Expand Down

0 comments on commit 288b516

Please sign in to comment.