Skip to content

Commit

Permalink
new header and xlink psmtsv reader unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts committed Nov 20, 2023
1 parent 81f9338 commit 382c0da
Show file tree
Hide file tree
Showing 6 changed files with 2,852 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mzLib/Omics/SpectrumMatch/SpectrumMatchFromTsvHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class SpectrumMatchFromTsvHeader
public const string Contaminant = "Contaminant";
public const string Decoy = "Decoy";
public const string Description = "Description";
public const string StartAndEndResiduesInFullSequence = "Start and End Residues In Protein";
public const string StartAndEndResiduesInFullSequence = "Start and End Residues In Full Sequence";
public const string PreviousResidue = "Previous Residue";
public const string NextResidue = "Next Residue";
public const string TheoreticalsSearched = "Theoreticals Searched";
Expand Down
2,798 changes: 2,798 additions & 0 deletions mzLib/Test/FileReadingTests/SearchResults/NewHeader.psmtsv

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions mzLib/Test/FileReadingTests/SearchResults/XLink.psmtsv

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions mzLib/Test/FileReadingTests/TestPsmFromTsv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,5 +324,32 @@ public static void TestPsmFiles(string fileLoadingType)
Assert.That(loadedFile.FileType == SupportedFileType.psmtsv);
Assert.Throws<NotImplementedException>(() => { loadedFile.WriteResults(""); });
}

[Test]
public static void ReadPsmFromTsvWithNewHeaderTerms()
{
string psmTsvPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"FileReadingTests\SearchResults\NewHeader.psmtsv");
List<PsmFromTsv> psms = SpectrumMatchTsvReader.ReadPsmTsv(psmTsvPath, out var warnings);
Assert.That(warnings.Count == 2);

IResultFile loadedFile = null;
var file = FileReader.ReadFile<PsmFromTsvFile>(psmTsvPath);
file.LoadResults();
Assert.That(file.Results.Count == psms.Count);
loadedFile = file;
}

[Test]
public static void ReadXLinkPsmFromTsv()
{
string psmTsvPath = Path.Combine(TestContext.CurrentContext.TestDirectory, @"FileReadingTests\SearchResults\XLink.psmtsv");
List<PsmFromTsv> psms = SpectrumMatchTsvReader.ReadPsmTsv(psmTsvPath, out var warnings);

IResultFile loadedFile = null;
var file = FileReader.ReadFile<PsmFromTsvFile>(psmTsvPath);
file.LoadResults();
Assert.That(file.Results.Count == psms.Count);
loadedFile = file;
}
}
}
4 changes: 0 additions & 4 deletions mzLib/Test/FileReadingTests/TestSupportedFileExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MzLibUtil;
using NUnit.Framework;
using Readers;
Expand Down
6 changes: 6 additions & 0 deletions mzLib/Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@
<None Update="DoubleProtease.tsv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="FileReadingTests\SearchResults\NewHeader.psmtsv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="FileReadingTests\SearchResults\XLink.psmtsv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ModificationTests\CommonArtifacts.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down

0 comments on commit 382c0da

Please sign in to comment.