Skip to content

Commit deb50cf

Browse files
committed
Add tolerance
1 parent d00edbb commit deb50cf

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

ThermoRawFileParserTest/ThermoRawFileParserTest.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
<Content Include="log4net.config">
175175
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
176176
</Content>
177+
<Content Include="small2.RAW" />
177178
</ItemGroup>
178179
<ItemGroup>
179180
<Analyzer Include="..\packages\AWSSDK.CloudWatchLogs.3.3.101.14\analyzers\dotnet\cs\AWSSDK.CloudWatchLogs.CodeAnalysis.dll" />

ThermoRawFileParserTest/small2.RAW

2.24 MB
Binary file not shown.

XIC/JSONParser.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ public static XicData ParseJSON(string jsonPath)
2121

2222
foreach (JSONInputUnit xic in jsonIn)
2323
{
24+
if (xic.RtStart == 0) xic.RtStart = -1;
25+
if (xic.RtEnd == 0) xic.RtEnd = -1;
26+
if (xic.Tolerance != 0 && xic.ToleranceUnit != null && xic.Mz != 0)
27+
{
28+
double delta;
29+
switch (xic.ToleranceUnit.ToLower())
30+
{
31+
case "ppm": delta = xic.Mz * xic.Tolerance * 1e-6; break;
32+
case "amu": delta = xic.Tolerance; break;
33+
case "mmu": delta = xic.Tolerance * 1e-3; break;
34+
case "da": delta = xic.Tolerance; break;
35+
default:
36+
throw new Exception(String.Format("Cannot parse tolerance unit: {0}", xic.ToleranceUnit));
37+
}
38+
data.content.Add(new XicUnit(xic.Mz - delta, xic.Mz + delta, xic.RtStart, xic.RtEnd));
39+
}
40+
2441
if (xic.MzStart != 0 && xic.MzEnd != 0) data.content.Add(new XicUnit(xic.MzStart, xic.MzEnd, xic.RtStart, xic.RtEnd));
2542
}
2643

0 commit comments

Comments
 (0)