Skip to content

Commit

Permalink
Top down biomarker III (#626)
Browse files Browse the repository at this point in the history
* correct Within calculation

* update unit tests

* first correct top-down biomarker test

* remove unused test code

* quotable protease

* unquotable

* add full length proteoform proteolysis products for biomarker search with  unit tests

* new strategy for adding proteolysis products

* more complete biomarker addition

* works for protein.xml databases

* add unit test biomarkers with xml database

* clean up

* more clean up

* fix unit test

* adjust biomarker generation for three initiator methionine behaviors (cleave, retain, variable)

* make sure decoy biomarkers for standard xml proteolysis products are generated

* deal appropriately w/ n-terminal methionine cleavage

* last litle unit test tweaks

* delete unused code

* add biomarkers during protein database load

* greater clarity for biomarker proteolysis product entries

* change digest for top-down biomarker search to resolve issues in MM

* bro. shouldn't have been that hard

* cleanup

* add unit test

* don't need to cover unit tests with unit tests

* increase unit test coverage of protein.cs

* codemaid

* biomarkers on protein with no methionine

* unit test booster

* ACs comments

* more summary statemsn

* deleted mzlib.sln scarry

* delete empty line

* c-terminal products w/ and w/o methionine

* delete remaining initiator meth behavior dependances

* remove reference to meth behavior in biomarker test functions

* fix effected unit tests

* fix more unit tests

* Biomarkers changed to Truncations

* Biomarker to truncation

* added method summaries

* MsDataScan tests to boost coverage

* more MsDataScan tests

* more MsDataFile tests

* delete unused comment

Co-authored-by: MICHAEL SHORTREED <[email protected]>
  • Loading branch information
trishorts and MICHAEL SHORTREED authored Apr 20, 2022
1 parent b6f3851 commit 3d0a4e4
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 282 deletions.
184 changes: 50 additions & 134 deletions mzLib/Proteomics/Protein/Protein.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mzLib/Proteomics/ProteolyticDigestion/Protease.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public CleavageSpecificity GetCleavageSpecificity(Protein protein, int startInde
/// <param name="maxPeptideLength"></param>
/// <returns></returns>
internal List<ProteolyticPeptide> GetUnmodifiedPeptides(Protein protein, int maximumMissedCleavages, InitiatorMethionineBehavior initiatorMethionineBehavior,
int minPeptideLength, int maxPeptideLength, Protease specificProtease, bool topDownBiomarkerSearch = false)
int minPeptideLength, int maxPeptideLength, Protease specificProtease, bool topDownTruncationSearch = false)
{
List<ProteolyticPeptide> peptides = new List<ProteolyticPeptide>();

Expand All @@ -111,7 +111,7 @@ internal List<ProteolyticPeptide> GetUnmodifiedPeptides(Protein protein, int max
//top-down
else if (CleavageSpecificity == CleavageSpecificity.None)
{
if (!topDownBiomarkerSearch)//standard top-down
if (!topDownTruncationSearch)//standard top-down
{
// retain methionine
if ((initiatorMethionineBehavior != InitiatorMethionineBehavior.Cleave || protein[0] != 'M')
Expand Down
4 changes: 2 additions & 2 deletions mzLib/Proteomics/ProteolyticDigestion/ProteinDigestion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ public IEnumerable<ProteolyticPeptide> SpeedySemiSpecificDigestion(Protein prote
/// </summary>
/// <param name="protein"></param>
/// <returns></returns>
public IEnumerable<ProteolyticPeptide> Digestion(Protein protein, bool topDownBiomarkerSearch = false)
public IEnumerable<ProteolyticPeptide> Digestion(Protein protein, bool topDownTruncationSearch = false)
{
return Protease.GetUnmodifiedPeptides(protein, MaximumMissedCleavages, InitiatorMethionineBehavior, MinPeptideLength, MaxPeptideLength, DigestionParams.SpecificProtease, topDownBiomarkerSearch);
return Protease.GetUnmodifiedPeptides(protein, MaximumMissedCleavages, InitiatorMethionineBehavior, MinPeptideLength, MaxPeptideLength, DigestionParams.SpecificProtease, topDownTruncationSearch);
}
}
}
127 changes: 57 additions & 70 deletions mzLib/Test/TestDigestionMotif.cs

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions mzLib/Test/TestMsDataFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,37 @@ public void DataFileTest()
Assert.AreEqual(0, ok3);
}

[Test]
public void TestFunctionsOfMsDataScan()
{
MsDataScan theSpectrum = new MsDataScan(_mzSpectrumA, 1, 1, true, Polarity.Positive, 1, new MzRange(300, 1000), "fake scan filter", MZAnalyzerType.Unknown, _mzSpectrumA.SumOfAllY, 1, null, "scan=1");
List<IsotopicEnvelope> isolatedMassesAndCharges = theSpectrum.GetIsolatedMassesAndCharges(_mzSpectrumA, 1, 10, 10, 1).ToList();
Assert.AreEqual(0, isolatedMassesAndCharges.Count); //Isolation range is null, so we get an empty set

Assert.Throws<MzLibException>(() => theSpectrum.RefineSelectedMzAndIntensity(_mzSpectrumA)); //no isolation Mz throws error

theSpectrum.SetOneBasedPrecursorScanNumber(6);
Assert.AreEqual(6, theSpectrum.OneBasedPrecursorScanNumber);

theSpectrum.SetNativeID("bubba");
Assert.AreEqual("bubba", theSpectrum.NativeId);

theSpectrum.SetIsolationMz(42);
Assert.AreEqual(42, theSpectrum.IsolationMz);
}

[Test]
public void MoreMsDataFilesTests()
{
MsDataFile fakeDataFile = new MsDataFile(new MsDataScan[1], new SourceFile(@"scan number only nativeID format", "mzML format", null, "SHA-1", @"C:\fake.mzML", null));
Assert.AreEqual(1, fakeDataFile.NumSpectra);
Assert.AreEqual("scan number only nativeID format", fakeDataFile.SourceFile.NativeIdFormat);
Assert.AreEqual("mzML format", fakeDataFile.SourceFile.MassSpectrometerFileFormat);
Assert.IsNull(fakeDataFile.SourceFile.CheckSum);
Assert.AreEqual("SHA-1", fakeDataFile.SourceFile.FileChecksumType);
Assert.IsNull(fakeDataFile.SourceFile.Id);
}

[Test]
public void TestAMoreRealFile()
{
Expand Down
20 changes: 10 additions & 10 deletions mzLib/Test/TestPeptideWithSetMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -931,30 +931,30 @@ public static void CountTargetsWithMatchingDecoys()
}

[Test]
public static void TestPeptideWithSetModsReturnsBiomarkersInTopDown()
public static void TestPeptideWithSetModsReturnsTruncationsInTopDown()
{
string xmlDatabase = Path.Combine(TestContext.CurrentContext.TestDirectory, "DataFiles", "humanInsulin.xml");

Protein insulin = ProteinDbLoader.LoadProteinXML(xmlDatabase, true,
DecoyType.None, null, false, null, out var unknownModifications, addBiomarkers: true)[0];
DecoyType.None, null, false, null, out var unknownModifications, addTruncations: true)[0];

Protease protease = new Protease("top-down", CleavageSpecificity.None, "", "", new List<DigestionMotif>(), null);
List<PeptideWithSetModifications> insulinBiomarkers = insulin.Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownBiomarkerSearch: true).ToList();
Assert.AreEqual(56, insulinBiomarkers.Count);
List<PeptideWithSetModifications> insulinTruncations = insulin.Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownTruncationSearch: true).ToList();
Assert.AreEqual(68, insulinTruncations.Count);
}

[Test]
public static void TestPeptideWithSetModsReturnsDecoyBiomarkersInTopDown()
public static void TestPeptideWithSetModsReturnsDecoyTruncationsInTopDown()
{
string xmlDatabase = Path.Combine(TestContext.CurrentContext.TestDirectory, "DataFiles", "humanInsulin.xml");
List<Protein> insulinProteins = ProteinDbLoader.LoadProteinXML(xmlDatabase, true,
DecoyType.Reverse, null, false, null, out var unknownModifications, addBiomarkers: true);
DecoyType.Reverse, null, false, null, out var unknownModifications, addTruncations: true);

Protease protease = new Protease("top-down", CleavageSpecificity.None, "", "", new List<DigestionMotif>(), null);
List<PeptideWithSetModifications> insulintTargetBiomarkers = insulinProteins.Where(p=>!p.IsDecoy).First().Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownBiomarkerSearch: true).ToList();
Assert.AreEqual(56, insulintTargetBiomarkers.Count);
List<PeptideWithSetModifications> insulintDecoyBiomarkers = insulinProteins.Where(p => p.IsDecoy).First().Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownBiomarkerSearch: true).ToList();
Assert.AreEqual(56, insulintDecoyBiomarkers.Count);
List<PeptideWithSetModifications> insulintTargetTruncations = insulinProteins.Where(p=>!p.IsDecoy).First().Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownTruncationSearch: true).ToList();
Assert.AreEqual(68, insulintTargetTruncations.Count);
List<PeptideWithSetModifications> insulintDecoyTruncations = insulinProteins.Where(p => p.IsDecoy).First().Digest(new DigestionParams(protease: protease.Name), new List<Modification>(), new List<Modification>(), topDownTruncationSearch: true).ToList();
Assert.AreEqual(68, insulintDecoyTruncations.Count);
}

[Test]
Expand Down
Loading

0 comments on commit 3d0a4e4

Please sign in to comment.