Skip to content

Commit

Permalink
WIFF2 file extension in OpenDataSourceDialog and import test (#318)
Browse files Browse the repository at this point in the history
- added support for WIFF2 file extension to OpenDataSourceDialog
* added import results test for a WIFF2 file in SmallWiffTest
* fixed smartBuildTrigger.py to trigger Container builds for Skyline
- fixed missing userSettings configGroup
* disabled offscreen testing on TeamCity so some troublesome tests will run there, e.g. Shimadzu TOF and WIFF2
* moved WIFF2 test disabling logic to ExtensionTestContext.CanImportAbWiff2
* changed ExtensionTestContext.CanImportShimadzuRaw to be conditioned on Program.SkylineOffscreen
  • Loading branch information
chambm committed Nov 12, 2018
1 parent e207696 commit c8b5b36
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 20 deletions.
3 changes: 3 additions & 0 deletions pwiz_tools/SeeMS/app.config
@@ -1,6 +1,9 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="seems.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
<seems.Properties.Settings>
Expand Down
2 changes: 1 addition & 1 deletion pwiz_tools/Skyline/Jamfile.jam
Expand Up @@ -32,7 +32,7 @@ if [ modules.peek : NT ] && --i-agree-to-the-vendor-licenses in [ modules.peek :
.teamcity-test-decoration = "" ;
if --teamcity-test-decoration in [ modules.peek : ARGV ]
{
.teamcity-test-decoration = "teamcitytestdecoration=1" ;
.teamcity-test-decoration = "offscreen=0 teamcitytestdecoration=1" ;
}

rule build-properties ( targets + : sources * : properties * )
Expand Down
14 changes: 6 additions & 8 deletions pwiz_tools/Skyline/TestData/PwizFileInfoTest.cs
Expand Up @@ -17,11 +17,9 @@
* limitations under the License.
*/

using System.Globalization;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using pwiz.ProteowizardWrapper;
using pwiz.Skyline;
using pwiz.SkylineTestUtil;

namespace pwiz.SkylineTestData
Expand Down Expand Up @@ -54,12 +52,12 @@ public void TestInstrumentInfo()
{
VerifyInstrumentInfo(testFilesDir.GetTestPath("051309_digestion.wiff"),
"4000 QTRAP", "electrospray ionization", "quadrupole/quadrupole/axial ejection linear ion trap", "electron multiplier");
if (System.DateTime.Now.Year > 2018 /* start failing after the new year */ ||
(System.Environment.Is64BitProcess && !Program.SkylineOffscreen && /* wiff2 access leaks thread and event handles, so avoid it during nightly tests when offscreen */
(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator != "," || /* wiff2 access fails under french language settings */
CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator != "\xA0")) /* no break space */ )
VerifyInstrumentInfo(testFilesDir.GetTestPath("OnyxTOFMS.wiff2"),
"TripleTOF 5600", "electrospray ionization", "quadrupole/quadrupole/time-of-flight", "electron multiplier");
}

if (ExtensionTestContext.CanImportAbWiff2)
{
VerifyInstrumentInfo(testFilesDir.GetTestPath("OnyxTOFMS.wiff2"),
"TripleTOF 5600", "electrospray ionization", "quadrupole/quadrupole/time-of-flight", "electron multiplier");
}

// MzWiff generated mzXML files
Expand Down
Binary file modified pwiz_tools/Skyline/TestData/Results/SmallWiff.zip
Binary file not shown.
64 changes: 55 additions & 9 deletions pwiz_tools/Skyline/TestData/Results/SmallWiffTest.cs
Expand Up @@ -42,27 +42,73 @@ public class SmallWiffTest : AbstractUnitTest
{
private const string ZIP_FILE = @"TestData\Results\SmallWiff.zip";

// TODO: Next time SmallWiff.zip is updated, remove the suffix shenanigans below and rename the mzML files in the zip
[TestMethod]
public void FileTypeTest()
{
var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

string extWiff = ExtensionTestContext.ExtAbWiff;
string suffix = ExtensionTestContext.CanImportAbWiff ? "" : "-test";

// Do file type checks
using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("051309_digestion" + suffix + extWiff)))
// wiff1
{
Assert.IsTrue(msData.IsABFile);
string extWiff = ExtensionTestContext.ExtAbWiff;
string suffix = ExtensionTestContext.CanImportAbWiff ? "" : "-test";

// Do file type checks
using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("051309_digestion" + suffix + extWiff)))
{
Assert.IsTrue(msData.IsABFile);
}

using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("051309_digestion-s3.mzXML")))
{
Assert.IsTrue(msData.IsABFile);
Assert.IsTrue(msData.IsMzWiffXml);
}
}

using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("051309_digestion-s3.mzXML")))
// wiff2
{
Assert.IsTrue(msData.IsABFile);
Assert.IsTrue(msData.IsMzWiffXml);
string extWiff2 = ExtensionTestContext.ExtAbWiff2;
string suffix = ExtensionTestContext.CanImportAbWiff2 ? "" : "-sample";

// Do file type checks
using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("OnyxTOFMS" + suffix + extWiff2)))
{
Assert.IsTrue(msData.IsABFile);
}
}
}

[TestMethod]
public void Wiff2ResultsTest()
{
TestFilesDir testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

string docPath = testFilesDir.GetTestPath("OnyxTOFMS.sky");
SrmDocument doc = ResultsUtil.DeserializeDocument(docPath);
AssertEx.IsDocumentState(doc, 0, 1, 1, 4);

using (var docContainer = new ResultsTestDocumentContainer(doc, docPath))
{
const string replicateName = "Wiff2Test";
string extRaw = ExtensionTestContext.ExtAbWiff2;
string suffix = ExtensionTestContext.CanImportAbWiff2 ? "" : "-sample";
var chromSets = new[]
{
new ChromatogramSet(replicateName, new[]
{ new MsDataFilePath(testFilesDir.GetTestPath("OnyxTOFMS" + suffix + extRaw)), }),
};
var docResults = doc.ChangeMeasuredResults(new MeasuredResults(chromSets));
Assert.IsTrue(docContainer.SetDocument(docResults, doc, true));
docContainer.AssertComplete();
docResults = docContainer.Document;
AssertResult.IsDocumentResultsState(docResults, replicateName,
doc.MoleculeCount, doc.MoleculeTransitionGroupCount, 0, doc.MoleculeTransitionCount, 0);
}

testFilesDir.Dispose();
}

[TestMethod]
public void MsDataFileUriEncodingTest()
{
Expand Down
20 changes: 19 additions & 1 deletion pwiz_tools/Skyline/TestUtil/ExtensionTestContext.cs
Expand Up @@ -17,6 +17,7 @@
* limitations under the License.
*/
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -146,6 +147,23 @@ public static bool CanImportAbWiff
}
}

public static string ExtAbWiff2
{
get { return CanImportAbWiff2 ? DataSourceUtil.EXT_WIFF2 : ExtMzml; }
}

public static bool CanImportAbWiff2
{
get
{
// return false to import mzML
return (DateTime.Now.Year > 2018 /* start failing after the new year */ ||
(Environment.Is64BitProcess && !Program.SkylineOffscreen && /* wiff2 access leaks thread and event handles, so avoid it during nightly tests when offscreen */
(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator != "," || /* wiff2 access fails under french language settings */
CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator != "\xA0")) /* no break space */ ) ;
}
}

public static string ExtAgilentRaw
{
get { return CanImportAgilentRaw ? DataSourceUtil.EXT_AGILENT_BRUKER_RAW : ExtMzml; }
Expand All @@ -156,7 +174,7 @@ public static bool CanImportShimadzuRaw
get
{
// return false to import mzML
return false; // TODO: Currently leaks to process heap
return !Program.SkylineOffscreen; // currently leaks to process heap, so avoid it during nightly tests when offscreen
}
}

Expand Down
2 changes: 2 additions & 0 deletions pwiz_tools/Skyline/Util/DataSourceUtil.cs
Expand Up @@ -33,6 +33,7 @@ public static class DataSourceUtil
// ReSharper disable NonLocalizedString
public const string EXT_THERMO_RAW = ".raw";
public const string EXT_WIFF = ".wiff";
public const string EXT_WIFF2 = ".wiff2";
public const string EXT_SHIMADZU_RAW = ".lcd";
public const string EXT_MZXML = ".mzxml";
public const string EXT_MZDATA = ".mzdata";
Expand Down Expand Up @@ -113,6 +114,7 @@ public static string GetSourceType(FileInfo fileInfo)
{
case EXT_THERMO_RAW: return TYPE_THERMO_RAW;
case EXT_WIFF: return TYPE_WIFF;
case EXT_WIFF2: return TYPE_WIFF;
case EXT_SHIMADZU_RAW: return TYPE_SHIMADZU;
//case ".mgf": return "Mascot Generic";
//case ".dta": return "Sequest DTA";
Expand Down
2 changes: 1 addition & 1 deletion scripts/misc/smartBuildTrigger.py
Expand Up @@ -119,7 +119,7 @@ def merge(a, *b):
("scripts/.*", targets['All']),
("pwiz_tools/BiblioSpec/.*", merge(targets['Core'], targets['Skyline'], targets['Container'])),
("pwiz_tools/Bumbershoot/.*", targets['Bumbershoot']),
("pwiz_tools/Skyline/.*", targets['Skyline'], targets['Container']),
("pwiz_tools/Skyline/.*", merge(targets['Skyline'], targets['Container'])),
("pwiz_tools/Topograph/.*", targets['Skyline']),
("pwiz_tools/Shared/.*", merge(targets['Skyline'], targets['BumbershootRelease'], targets['Container'])),
("pwiz_tools/.*", targets['All']),
Expand Down

0 comments on commit c8b5b36

Please sign in to comment.