Skip to content

Commit

Permalink
no calibration psms unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts committed Oct 14, 2024
1 parent ad0b465 commit dc7b5af
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions MetaMorpheus/Test/CalibrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,41 @@ public static void ExperimentalDesignCalibrationTest(string nonCalibratedFile)
Directory.Delete(unitTestFolder, true);
}

[Test]
public static void CalibrationTestNoPsms()
{
// set up directories
string unitTestFolder = Path.Combine(TestContext.CurrentContext.TestDirectory, @"ExperimentalDesignCalibrationTest");
string outputFolder = Path.Combine(unitTestFolder, @"TaskOutput");
Directory.CreateDirectory(unitTestFolder);
Directory.CreateDirectory(outputFolder);

// set up original spectra file (input to calibration)
string nonCalibratedFilePath = Path.Combine(unitTestFolder, "filename1.mzML");
File.Copy(Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestData\SmallCalibratible_Yeast.mzML"), nonCalibratedFilePath, true);

// protein db for a non-matching organism
string myDatabase = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestData\gapdh.fa");

// set up original experimental design (input to calibration)
SpectraFileInfo fileInfo = new(nonCalibratedFilePath, "condition", 0, 0, 0);
_ = ExperimentalDesign.WriteExperimentalDesignToFile(new List<SpectraFileInfo> { fileInfo });

// run calibration
CalibrationTask calibrationTask = new();
calibrationTask.RunTask(outputFolder, new List<DbForTask> { new DbForTask(myDatabase, false) }, new List<string> { nonCalibratedFilePath }, "test");

// test new experimental design written by calibration
var newExpDesignPath = Path.Combine(outputFolder, @"ExperimentalDesign.tsv");
string expectedCalibratedFileName = Path.GetFileNameWithoutExtension(nonCalibratedFilePath) + "-calib.mzML";
var expectedCalibratedFilePath = Path.Combine(outputFolder, expectedCalibratedFileName);
var newExperDesign = ExperimentalDesign.ReadExperimentalDesign(newExpDesignPath, new List<string> { expectedCalibratedFilePath }, out var errors);

Assert.That(errors.Any());

// clean up
Directory.Delete(unitTestFolder, true);
}

[Test]
public static void CalibrationTestLowRes()
Expand Down

0 comments on commit dc7b5af

Please sign in to comment.