Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Sol committed Jan 6, 2025
1 parent fa8745b commit 0fdd2eb
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions mzLib/Test/DatabaseTests/TestDatabaseLoaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,6 @@ public void LoadingIsReproducible(string fileName, DecoyType decoyType)
Assert.AreEqual(proteins1, proteins2);
}

[Test]
public void WritingIsReproducible()
{
// Load in proteins
var dbPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "DatabaseTests", "cRAP_databaseGPTMD.xml");
List<Protein> proteins1 = null;
List<Protein> proteins2 = null;

proteins1 = ProteinDbLoader.LoadProteinXML(dbPath, true, DecoyType.Reverse, null, false, null, out var unknownModifications);
proteins2 = ProteinDbLoader.LoadProteinXML(dbPath, true, DecoyType.Reverse, null, false, null, out unknownModifications);

ProteinDbWriter.WriteXmlDatabase(new Dictionary<string, HashSet<Tuple<int, Modification>>>(), proteins1, Path.Combine(TestContext.CurrentContext.TestDirectory, "DatabaseTests", "cRAP_databaseGPTMD2.xml"));

// check are equivalent lists of proteins
Assert.AreEqual(proteins1.Count, proteins2.Count);
// Because decoys are sorted before they are returned, the order should be identical
Assert.AreEqual(proteins1, proteins2);
}

[Test]
public static void LoadModWithNl()
{
Expand Down Expand Up @@ -561,6 +542,7 @@ public void MultiMod_ProteinDbWriter()
true, DecoyType.None, new List<Modification>(), false, new List<string>(),
out Dictionary<string, Modification> um);

// Create a second protein with the same modifications, but listed in a different order.
sampleModList.Reverse();
Protein modShuffledProtein = new Protein(
"MCMCMCSSSSSSSS",
Expand Down Expand Up @@ -588,9 +570,11 @@ public void MultiMod_ProteinDbWriter()
List<Protein> newShuffledProteins = ProteinDbLoader.LoadProteinXML(shuffledProteinFileName,
true, DecoyType.None, new List<Modification>(), false, new List<string>(), out um);

// We've read in proteins from both databases. Assert that they are equal
Assert.AreEqual(newShuffledProteins.First().Accession, newProteins.First().Accession);
Assert.AreEqual(newShuffledProteins.First(), newProteins.First());

// Now, ensure that the modification dictionaries for each are equivalent (contain the same mods) and equal (contain the same mods in the same order)
for(int i = 1; i<4; i++)
{
int oneBasedResidue = i * 2;
Expand Down

0 comments on commit 0fdd2eb

Please sign in to comment.