Skip to content

Commit c6dcfc3

Browse files
authored
Merge pull request #87 from compomics/uvdata
Version 1.3.0
2 parents 1755627 + a156701 commit c6dcfc3

File tree

10 files changed

+944
-166
lines changed

10 files changed

+944
-166
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
bin/
33
obj/
44
*.log
5-
ThermoRawFileParser.sln.DotSettings.user
5+
*.sln.DotSettings.user
66
.vs/
7-
7+
*.csproj.user

MainClass.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class MainClass
1717
private static readonly ILog Log =
1818
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
1919

20-
public const string Version = "1.2.3";
20+
public const string Version = "1.3.0";
2121

2222
public static void Main(string[] args)
2323
{
@@ -409,6 +409,11 @@ private static void RegularParametersParsing(string[] args)
409409
"Don't use zlib compression for the m/z ratios and intensities. By default zlib compression is enabled.",
410410
v => parseInput.NoZlibCompression = v != null
411411
},
412+
{
413+
"a|allDetectors",
414+
"Extract additonal detector data: UV/PDA etc",
415+
v => parseInput.AllDetectors = v != null
416+
},
412417
{
413418
"l=|logging=", "Optional logging level: 0 for silent, 1 for verbose.",
414419
v => logFormatString = v
@@ -499,7 +504,7 @@ private static void RegularParametersParsing(string[] args)
499504
{
500505
if (parseInput.RawFilePath != null)
501506
{
502-
parseInput.OutputDirectory = Path.GetDirectoryName(parseInput.RawFilePath);
507+
parseInput.OutputDirectory = Path.GetDirectoryName(Path.GetFullPath(parseInput.RawFilePath));
503508
}
504509
else if (parseInput.RawDirectoryPath != null)
505510
{

ParseInput.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public string RawFilePath
6565

6666
public bool NoZlibCompression { get; set; }
6767

68+
public bool AllDetectors { get; set; }
69+
6870
public LogFormat LogFormat { get; set; }
6971

7072
public bool IgnoreInstrumentErrors { get; set; }
@@ -98,6 +100,7 @@ public ParseInput()
98100
NoZlibCompression = false;
99101
LogFormat = LogFormat.DEFAULT;
100102
IgnoreInstrumentErrors = false;
103+
AllDetectors = false;
101104
}
102105

103106
public ParseInput(string rawFilePath, string rawDirectoryPath, string outputDirectory, OutputFormat outputFormat

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ optional subcommands are xic|query (use [subcommand] -h for more info]):
7171
-z, --noZlibCompression Don't use zlib compression for the m/z ratios and
7272
intensities. By default zlib compression is
7373
enabled.
74+
-a, --allDetectors Extract additonal detector data: UV/PDA etc
7475
-l, --logging=VALUE Optional logging level: 0 for silent, 1 for
7576
verbose.
7677
-e, --ignoreInstrumentErrors

ThermoRawFileParser.csproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.

ThermoRawFileParserTest/WriterTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System;
22
using System.IO;
3+
using System.Linq;
4+
using System.Net.PeerToPeer.Collaboration;
35
using System.Xml.Serialization;
46
using IO.Mgf;
7+
using MzLibUtil;
58
using NUnit.Framework;
69
using ThermoRawFileParser;
710
using ThermoRawFileParser.Writer.MzML;
@@ -66,6 +69,8 @@ public void TestMzml()
6669

6770
Assert.AreEqual("1", testMzMl.run.chromatogramList.count);
6871
Assert.AreEqual(1, testMzMl.run.chromatogramList.chromatogram.Length);
72+
73+
Assert.AreEqual(48, testMzMl.run.chromatogramList.chromatogram[0].defaultArrayLength);
6974
}
7075

7176
[Test]
@@ -98,5 +103,36 @@ public void TestIndexedMzML()
98103
Assert.AreEqual("chromatogram", testMzMl.indexList.index[1].name.ToString());
99104
Assert.AreEqual(1, testMzMl.indexList.index[1].offset.Length);
100105
}
106+
107+
[Test]
108+
public void TestMzML_MS2()
109+
{
110+
// Get temp path for writing the test mzML
111+
var tempFilePath = Path.GetTempPath();
112+
113+
var testRawFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Data/small2.RAW");
114+
var parseInput = new ParseInput(testRawFile, null, tempFilePath, OutputFormat.MzML);
115+
116+
RawFileParser.Parse(parseInput);
117+
118+
// Deserialize the mzML file
119+
var xmlSerializer = new XmlSerializer(typeof(mzMLType));
120+
var testMzMl = (mzMLType)xmlSerializer.Deserialize(new FileStream(
121+
Path.Combine(tempFilePath, "small2.mzML"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
122+
123+
Assert.AreEqual(95, testMzMl.run.spectrumList.spectrum.Length);
124+
125+
var precursor = testMzMl.run.spectrumList.spectrum[16].precursorList.precursor[0].selectedIonList.selectedIon[0];
126+
var selectedMz = Double.Parse(precursor.cvParam.Where(cv => cv.accession == "MS:1000744").First().value);
127+
Assert.IsTrue(selectedMz - 604.7592 < 0.001);
128+
129+
var selectedZ = int.Parse(precursor.cvParam.Where(cv => cv.accession == "MS:1000041").First().value);
130+
Assert.AreEqual(selectedZ , 2);
131+
132+
//var selectedI = Double.Parse(precursor.cvParam.Where(cv => cv.accession == "MS:1000042").First().value);
133+
//Assert.IsTrue(selectedI - 10073 < 1);
134+
135+
Assert.AreEqual(95, testMzMl.run.chromatogramList.chromatogram[0].defaultArrayLength);
136+
}
101137
}
102138
}

Writer/MgfSpectrumWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
6565
IReaction reaction = GetReaction(scanEvent, scanNumber);
6666

6767
Writer.WriteLine("BEGIN IONS");
68-
Writer.WriteLine($"TITLE={ConstructSpectrumTitle(scanNumber)}");
68+
Writer.WriteLine($"TITLE={ConstructSpectrumTitle((int)Device.MS, 1, scanNumber)}");
6969
Writer.WriteLine($"SCANS={scanNumber}");
7070
Writer.WriteLine(
7171
$"RTINSECONDS={(time * 60).ToString(CultureInfo.InvariantCulture)}");

0 commit comments

Comments
 (0)