Skip to content

Commit

Permalink
enable reading of lipid mods from protein xml with test (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
trishorts authored Jan 31, 2025
1 parent 9835b78 commit 7cdd05d
Show file tree
Hide file tree
Showing 4 changed files with 1,791 additions and 0 deletions.
24 changes: 24 additions & 0 deletions mzLib/Test/DatabaseTests/TestDatabaseLoaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ public void LoadingIsReproducible(string fileName, DecoyType decoyType)
Assert.AreEqual(proteins1, proteins2);
}

[Test]
[TestCase("proteinEntryLipidMoietyBindingRegion.xml", DecoyType.Reverse)]
public void LoadingLipidAsMod(string fileName, DecoyType decoyType)
{
var psiModDeserialized = Loaders.LoadPsiMod(Path.Combine(TestContext.CurrentContext.TestDirectory, "PSI-MOD.obo2.xml"));
Dictionary<string, int> formalChargesDictionary = Loaders.GetFormalChargesDictionary(psiModDeserialized);
List<Modification> UniProtPtms = Loaders.LoadUniprot(Path.Combine(TestContext.CurrentContext.TestDirectory, "ptmlist2.txt"), formalChargesDictionary).ToList();

// Load in proteins
var dbPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "DatabaseTests", fileName);
List<Protein> proteins1 = ProteinDbLoader.LoadProteinXML(dbPath, true, decoyType, UniProtPtms, false, null, out var unknownModifications);
List<Protein> proteins2 = ProteinDbLoader.LoadProteinXML(dbPath, true, decoyType, UniProtPtms, false, null, out unknownModifications);

// 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);
var oneBasedPossibleLocalizedModifications = proteins1[0].OneBasedPossibleLocalizedModifications[36];
var firstMod = oneBasedPossibleLocalizedModifications.First();
Assert.AreEqual("LIPID", firstMod.FeatureType);
Assert.AreEqual("Anywhere.", firstMod.LocationRestriction);
Assert.AreEqual("S-palmitoyl cysteine on C", firstMod.IdWithMotif);
}

[Test]
public static void LoadModWithNl()
{
Expand Down
Loading

0 comments on commit 7cdd05d

Please sign in to comment.