Skip to content

Commit

Permalink
Add a new field that tracks the abundance of a peak as a double
Browse files Browse the repository at this point in the history
When converting the intensity of a peak to a 32-bit integer, now preventing 32-bit overflow errors by reporting 2147483648 instead
  • Loading branch information
alchemistmatt committed Jul 14, 2015
1 parent b2df3a2 commit fa5c4a1
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 12 deletions.
1 change: 1 addition & 0 deletions HornTransform/IsotopeFitRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Engine
IsotopeFitRecord::IsotopeFitRecord()
{
mint_abundance = 0 ;
mdbl_abundance = 0;
mshort_cs = -1 ;
mdbl_mz = 0 ;
mdbl_fit = 1 ;
Expand Down
4 changes: 3 additions & 1 deletion HornTransform/IsotopeFitRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ namespace Engine
int mint_scan_num ;
//! charge state
short mshort_cs ;
//! intensity of feature.
//! intensity of feature; maximum value that can be represented is 2147483648
int mint_abundance ;
//! intensity of feature (as a double)
double mdbl_abundance;
//! m/z value of most abundant peak in the feature.
double mdbl_mz ;
//! fit value .
Expand Down
13 changes: 12 additions & 1 deletion HornTransform/MassTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,18 @@ namespace Engine
if (mbln_debug)
std::cerr<<"\tBack with fit = "<<record.mdbl_fit<<std::endl ;

record.mint_abundance = (int) pk.mdbl_intensity ;
// Abundance has always been reported as a 32-bit integer
// Added field mdbl_abundance in 2015 to allow tracking it as a double
// For backwards compatibility, if the peak intensity is too large for a 32-bit integer, mint_abundance will be 2147483648

if (pk.mdbl_intensity < 2147483648)
record.mint_abundance = (int)pk.mdbl_intensity;
else
record.mint_abundance = 2147483648;

// Applications using this DLL should use mdbl_abundance instead of mint_abundance
record.mdbl_abundance = pk.mdbl_intensity;

record.mshort_cs = chargeState ;

PeakProcessing::Peak mono_peak ;
Expand Down
Binary file removed Library/xerces-c_2_7.dll
Binary file not shown.
Binary file removed Library/xerces-c_2_7D.dll
Binary file not shown.
Binary file added Library/xerces-c_2_8.dll
Binary file not shown.
Binary file added Library/xerces-c_2_8D.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Readme_DeconTools_and_DeconEngine_Versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ C# DeconTools (with ThrashV2)
Port of DeconEngine to C#
See file DeconTools.Backend\ProcessingTasks\Deconvoluters\HornDeconvolutor\ThrashDeconvolutorV2.cs
Used by DeconConsole if parameter file has:
<UseThrashV1>true</UseThrashV1>
<DeconvolutionType>ThrashV2</DeconvolutionType>

8 changes: 2 additions & 6 deletions UnitTests/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@
<Compile Include="Reader_Tests\MZXMLReaderTests.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="xerces-c_2_7.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="xerces-c_2_7D.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="xerces-c_2_8.dll" />
<Content Include="xerces-c_2_8D.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file removed UnitTests/UnitTests/xerces-c_2_7.dll
Binary file not shown.
Binary file removed UnitTests/UnitTests/xerces-c_2_7D.dll
Binary file not shown.
Binary file added UnitTests/UnitTests/xerces-c_2_8.dll
Binary file not shown.
Binary file added UnitTests/UnitTests/xerces-c_2_8D.dll
Binary file not shown.
8 changes: 6 additions & 2 deletions clsHornTransformResults.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ namespace DeconToolsV2
int mint_scan_num ;
//! charge state
short mshort_cs ;
//! intensity of feature.
int mint_abundance ;
//! intensity of feature; maximum value that can be represented is 2147483648
int mint_abundance;
//! intensity of feature (as a double)
double mdbl_abundance;
//! m/z value of most abundant peak in the feature.
double mdbl_mz ;
//! fit value .
Expand Down Expand Up @@ -64,6 +66,7 @@ namespace DeconToolsV2
result->mint_scan_num = this->mint_scan_num ;
result->mshort_cs = this->mshort_cs ;
result->mint_abundance = this->mint_abundance ;
result->mdbl_abundance = this->mdbl_abundance;
result->mdbl_mz = this->mdbl_mz ;
result->mdbl_fit = this->mdbl_fit ;
result->mint_fit_count_basis = this->mint_fit_count_basis ;
Expand All @@ -90,6 +93,7 @@ namespace DeconToolsV2
mint_scan_num = fitRecord.mint_scan_num ;
mshort_cs = fitRecord.mshort_cs ;
mint_abundance = fitRecord.mint_abundance ;
mdbl_abundance = fitRecord.mdbl_abundance;
mdbl_mz = fitRecord.mdbl_mz ;
mdbl_fit = fitRecord.mdbl_fit ;
mint_fit_count_basis = fitRecord.mint_fit_count_basis ;
Expand Down
3 changes: 2 additions & 1 deletion clsProcRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ namespace DeconToolsV2
// Disable timing (MEM 2013)
// transform_time += (clock() - current_time) ;

// AM: if summing over a window, reinsert the original intensity // [gord] why?
// AM (anoop?): if summing over a window, reinsert the original intensity // [gord] why?
if(found_transform && transformRecord.mshort_cs <= transform_parameters->get_MaxCharge()
&& transform_parameters->get_SumSpectraAcrossScanRange())
{
Expand All @@ -493,6 +493,7 @@ namespace DeconToolsV2
if (originalPeak.mdbl_intensity > 0)
{
transformRecord.mint_abundance = (int)originalPeak.mdbl_intensity ;
transformRecord.mdbl_abundance = originalPeak.mdbl_intensity;
transformRecord.mdbl_fwhm = originalPeak.mdbl_FWHM ; // [gord] this might be the source of why FWHM is sometimes 0
}
else
Expand Down

0 comments on commit fa5c4a1

Please sign in to comment.