Skip to content

Commit 7cdd05d

Browse files
authored
enable reading of lipid mods from protein xml with test (#828)
1 parent 9835b78 commit 7cdd05d

File tree

4 files changed

+1791
-0
lines changed

4 files changed

+1791
-0
lines changed

mzLib/Test/DatabaseTests/TestDatabaseLoaders.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,30 @@ public void LoadingIsReproducible(string fileName, DecoyType decoyType)
114114
Assert.AreEqual(proteins1, proteins2);
115115
}
116116

117+
[Test]
118+
[TestCase("proteinEntryLipidMoietyBindingRegion.xml", DecoyType.Reverse)]
119+
public void LoadingLipidAsMod(string fileName, DecoyType decoyType)
120+
{
121+
var psiModDeserialized = Loaders.LoadPsiMod(Path.Combine(TestContext.CurrentContext.TestDirectory, "PSI-MOD.obo2.xml"));
122+
Dictionary<string, int> formalChargesDictionary = Loaders.GetFormalChargesDictionary(psiModDeserialized);
123+
List<Modification> UniProtPtms = Loaders.LoadUniprot(Path.Combine(TestContext.CurrentContext.TestDirectory, "ptmlist2.txt"), formalChargesDictionary).ToList();
124+
125+
// Load in proteins
126+
var dbPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "DatabaseTests", fileName);
127+
List<Protein> proteins1 = ProteinDbLoader.LoadProteinXML(dbPath, true, decoyType, UniProtPtms, false, null, out var unknownModifications);
128+
List<Protein> proteins2 = ProteinDbLoader.LoadProteinXML(dbPath, true, decoyType, UniProtPtms, false, null, out unknownModifications);
129+
130+
// check are equivalent lists of proteins
131+
Assert.AreEqual(proteins1.Count, proteins2.Count);
132+
// Because decoys are sorted before they are returned, the order should be identical
133+
Assert.AreEqual(proteins1, proteins2);
134+
var oneBasedPossibleLocalizedModifications = proteins1[0].OneBasedPossibleLocalizedModifications[36];
135+
var firstMod = oneBasedPossibleLocalizedModifications.First();
136+
Assert.AreEqual("LIPID", firstMod.FeatureType);
137+
Assert.AreEqual("Anywhere.", firstMod.LocationRestriction);
138+
Assert.AreEqual("S-palmitoyl cysteine on C", firstMod.IdWithMotif);
139+
}
140+
117141
[Test]
118142
public static void LoadModWithNl()
119143
{

0 commit comments

Comments
 (0)