Skip to content

Commit 5bbaeed

Browse files
trishortsMICHAEL SHORTREED
andauthored
Return Water and Ammonia Loss Product Ions (#648)
* correct Within calculation * update unit tests * this is the spot * unused namespaces * degree and star to ammonia and water * waterAndAmmoniaLossProductTypeMethods * ammonia and water loss fragment product ion unit tests Co-authored-by: MICHAEL SHORTREED <mrshortreed@wisc.edu>
1 parent 6acb727 commit 5bbaeed

File tree

5 files changed

+89
-35
lines changed

5 files changed

+89
-35
lines changed

mzLib/Proteomics/Fragmentation/DissociationTypeCollection.cs

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Chemistry;
2+
using Easy.Common.Extensions;
23
using MassSpectrometry;
34
using System.Collections.Generic;
45
using System.Linq;
@@ -11,7 +12,7 @@ public class DissociationTypeCollection
1112
{
1213
{ DissociationType.Unknown, new List<ProductType>() },
1314
{ DissociationType.CID, new List<ProductType>{ ProductType.b, ProductType.y } },
14-
{ DissociationType.LowCID, new List<ProductType>{ ProductType.b, ProductType.y, ProductType.aStar, ProductType.bStar, ProductType.yStar, ProductType.aDegree, ProductType.bDegree, ProductType.yDegree } },
15+
{ DissociationType.LowCID, new List<ProductType>{ ProductType.b, ProductType.y, ProductType.aStar, ProductType.b_NH3, ProductType.y_NH3, ProductType.aDegree, ProductType.b_H2O, ProductType.y_H2O } },
1516
{ DissociationType.IRMPD, new List<ProductType>{ ProductType.b, ProductType.y } },
1617
{ DissociationType.ECD, new List<ProductType>{ ProductType.c, ProductType.y, ProductType.zDot } },
1718
{ DissociationType.PQD, new List<ProductType>() },
@@ -43,6 +44,42 @@ public static List<ProductType> GetTerminusSpecificProductTypesFromDissociation(
4344
return productTypes;
4445
}
4546

47+
public static List<ProductType> GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType dissociationType, FragmentationTerminus fragmentationTerminus)
48+
{
49+
List<ProductType> productList = new();
50+
51+
switch (dissociationType)
52+
{
53+
case DissociationType.CID:
54+
case DissociationType.IRMPD:
55+
case DissociationType.HCD:
56+
case DissociationType.AnyActivationType:
57+
case DissociationType.EThcD:
58+
if (fragmentationTerminus == FragmentationTerminus.N || fragmentationTerminus == FragmentationTerminus.Both)
59+
{
60+
productList.Add(ProductType.b_H2O);
61+
productList.Add(ProductType.b_NH3);
62+
}
63+
if (fragmentationTerminus == FragmentationTerminus.C || fragmentationTerminus == FragmentationTerminus.Both)
64+
{
65+
productList.Add(ProductType.y_H2O);
66+
productList.Add(ProductType.y_NH3);
67+
}
68+
break;
69+
case DissociationType.ECD:
70+
case DissociationType.ETD:
71+
if (fragmentationTerminus == FragmentationTerminus.C || fragmentationTerminus == FragmentationTerminus.Both)
72+
{
73+
productList.Add(ProductType.y_H2O);
74+
productList.Add(ProductType.y_NH3);
75+
}
76+
break;
77+
default:
78+
break;
79+
}
80+
return productList;
81+
}
82+
4683
private static Dictionary<(DissociationType, FragmentationTerminus), List<ProductType>> TerminusSpecificProductTypesFromDissociation
4784
= new Dictionary<(DissociationType, FragmentationTerminus), List<ProductType>>();
4885

@@ -52,13 +89,13 @@ public static List<ProductType> GetTerminusSpecificProductTypesFromDissociation(
5289
{ ProductType.aStar, null},//-C -O -N -H3
5390
{ ProductType.aDegree, null},//-C -O2 -H2
5491
{ ProductType.b, null},//no change
55-
{ ProductType.bStar, null},//-N -H3
56-
{ ProductType.bDegree, null},//-H2 -O1
92+
{ ProductType.b_NH3, null},//-N -H3
93+
{ ProductType.b_H2O, null},//-H2 -O1
5794
{ ProductType.c, null},//+N1 +H3
5895
{ ProductType.x, null},//+C1 +O2
5996
{ ProductType.y, null},//+O +H2
60-
{ ProductType.yStar, null},//+O -H -N
61-
{ ProductType.yDegree, null},//no change
97+
{ ProductType.y_NH3, null},//+O -H -N
98+
{ ProductType.y_H2O, null},//no change
6299
{ ProductType.zDot, null },// +O -NH + e- + p+
63100
{ ProductType.zPlusOne, null},//+O +H -N: A Zdot ion is also known as z+1. It is not a z-ion in the Biemann nomenclature. It differs from a y-ion by N-1 H-1;
64101
{ ProductType.M, null},// neutral Molecular product can be used with neutral loss as fragment
@@ -106,13 +143,13 @@ public static double GetMassShiftFromProductType(ProductType productType)
106143
case ProductType.aStar: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("C-1O-1N-1H-3").MonoisotopicMass; break;
107144
case ProductType.aDegree: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("C-1O-2H-2").MonoisotopicMass; break; // -46.0054793036,-C -O2 -H2
108145
case ProductType.b: NeutralMassShiftFromProductType[productType] = 0; break;// 0, no change
109-
case ProductType.bStar: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("N-1H-3").MonoisotopicMass; break;// -17.02654910112, -N -H3
110-
case ProductType.bDegree: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("H-2O-1").MonoisotopicMass; break;// -18.01056468403, -H2 -O1
146+
case ProductType.b_NH3: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("N-1H-3").MonoisotopicMass; break;// -17.02654910112, -N -H3
147+
case ProductType.b_H2O: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("H-2O-1").MonoisotopicMass; break;// -18.01056468403, -H2 -O1
111148
case ProductType.c: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("N1H3").MonoisotopicMass; break;// 17.02654910112, +N1 +H3
112149
case ProductType.x: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("C1O2").MonoisotopicMass; break;// 43.98982923914, +C1 +O2
113150
case ProductType.y: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("H2O1").MonoisotopicMass; break;// 18.01056468403, +O +H2
114-
case ProductType.yStar: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("O1H-1N-1").MonoisotopicMass; break;// 0.98401558291000057, +O -H -N
115-
case ProductType.yDegree: NeutralMassShiftFromProductType[productType] = 0; break;// 0, no change
151+
case ProductType.y_NH3: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("O1H-1N-1").MonoisotopicMass; break;// 0.98401558291000057, +O -H -N
152+
case ProductType.y_H2O: NeutralMassShiftFromProductType[productType] = 0; break;// 0, no change
116153
case ProductType.zDot: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("O1N-1H-1").MonoisotopicMass + Constants.ElectronMass + Constants.ProtonMass; break; //1.991840552567, +O -NH + e- + p+
117154
case ProductType.zPlusOne: NeutralMassShiftFromProductType[productType] = ChemicalFormula.ParseFormula("O1H1N-1").MonoisotopicMass; break;//; 2.9996656473699996, +O +H -N:
118155
case ProductType.M: NeutralMassShiftFromProductType[productType] = 0; break;// no change

mzLib/Proteomics/Fragmentation/ProductType.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public enum ProductType
2525
aStar,
2626
aDegree,
2727
b,
28-
bStar,
29-
bDegree,
28+
b_NH3,
29+
b_H2O,
3030
//BnoB1ions,
3131
c,
3232
x,
3333
y,
34-
yStar,
35-
yDegree,
34+
y_NH3,
35+
y_H2O,
3636
zPlusOne,//This is zDot plus H
3737
zDot,
3838
M, //this is the molecular ion // [M]

mzLib/Proteomics/Fragmentation/TerminusSpecificProductTypes.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public class TerminusSpecificProductTypes
88
{
99
public static Dictionary<FragmentationTerminus, List<ProductType>> ProductIonTypesFromSpecifiedTerminus = new Dictionary<FragmentationTerminus, List<ProductType>>
1010
{
11-
{FragmentationTerminus.N, new List<ProductType>{ ProductType.a, ProductType.aDegree, ProductType.aStar, ProductType.b, ProductType.bDegree, ProductType.bStar, ProductType.c } }, //all ion types that include the N-terminus
12-
{FragmentationTerminus.C, new List<ProductType>{ ProductType.x, ProductType.y, ProductType.yDegree, ProductType.yStar, ProductType.zDot, ProductType.zPlusOne } }, //all ion types that include the C-terminus
13-
{FragmentationTerminus.Both, new List<ProductType>{ ProductType.a, ProductType.aDegree, ProductType.aStar, ProductType.b, ProductType.bDegree, ProductType.bStar, ProductType.c, ProductType.x, ProductType.y, ProductType.yDegree, ProductType.yStar, ProductType.zDot, ProductType.zPlusOne} },
11+
{FragmentationTerminus.N, new List<ProductType>{ ProductType.a, ProductType.aDegree, ProductType.aStar, ProductType.b, ProductType.b_H2O, ProductType.b_NH3, ProductType.c } }, //all ion types that include the N-terminus
12+
{FragmentationTerminus.C, new List<ProductType>{ ProductType.x, ProductType.y, ProductType.y_H2O, ProductType.y_NH3, ProductType.zDot, ProductType.zPlusOne } }, //all ion types that include the C-terminus
13+
{FragmentationTerminus.Both, new List<ProductType>{ ProductType.a, ProductType.aDegree, ProductType.aStar, ProductType.b, ProductType.b_H2O, ProductType.b_NH3, ProductType.c, ProductType.x, ProductType.y, ProductType.y_H2O, ProductType.y_NH3, ProductType.zDot, ProductType.zPlusOne} },
1414
{FragmentationTerminus.None, new List<ProductType>() }
1515
};
1616

@@ -20,13 +20,13 @@ public class TerminusSpecificProductTypes
2020
{ ProductType.aDegree, FragmentationTerminus.N },
2121
{ ProductType.aStar, FragmentationTerminus.N },
2222
{ ProductType.b, FragmentationTerminus.N },
23-
{ ProductType.bDegree, FragmentationTerminus.N },
24-
{ ProductType.bStar, FragmentationTerminus.N },
23+
{ ProductType.b_H2O, FragmentationTerminus.N },
24+
{ ProductType.b_NH3, FragmentationTerminus.N },
2525
{ ProductType.c, FragmentationTerminus.N },
2626
{ ProductType.x, FragmentationTerminus.C },
2727
{ ProductType.y, FragmentationTerminus.C },
28-
{ ProductType.yDegree, FragmentationTerminus.C },
29-
{ ProductType.yStar, FragmentationTerminus.C },
28+
{ ProductType.y_H2O, FragmentationTerminus.C },
29+
{ ProductType.y_NH3, FragmentationTerminus.C },
3030
{ ProductType.zDot, FragmentationTerminus.C },
3131
{ ProductType.zPlusOne, FragmentationTerminus.C },
3232
};

mzLib/Proteomics/ProteolyticDigestion/PeptideWithSetModifications.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ public void Fragment(DissociationType dissociationType, FragmentationTerminus fr
324324
{
325325
if (dissociationType == DissociationType.LowCID)
326326
{
327-
if (!haveSeenNTermStarIon && (nTermProductTypes[i] == ProductType.aStar || nTermProductTypes[i] == ProductType.bStar))
327+
if (!haveSeenNTermStarIon && (nTermProductTypes[i] == ProductType.aStar || nTermProductTypes[i] == ProductType.b_NH3))
328328
{
329329
continue;
330330
}
331331

332-
if (!haveSeenNTermDegreeIon && (nTermProductTypes[i] == ProductType.aDegree || nTermProductTypes[i] == ProductType.bDegree))
332+
if (!haveSeenNTermDegreeIon && (nTermProductTypes[i] == ProductType.aDegree || nTermProductTypes[i] == ProductType.b_H2O))
333333
{
334334
continue;
335335
}
@@ -410,12 +410,12 @@ public void Fragment(DissociationType dissociationType, FragmentationTerminus fr
410410

411411
if (dissociationType == DissociationType.LowCID)
412412
{
413-
if (!haveSeenCTermStarIon && cTermProductTypes[i] == ProductType.yStar)
413+
if (!haveSeenCTermStarIon && cTermProductTypes[i] == ProductType.y_NH3)
414414
{
415415
continue;
416416
}
417417

418-
if (!haveSeenCTermDegreeIon && cTermProductTypes[i] == ProductType.yDegree)
418+
if (!haveSeenCTermDegreeIon && cTermProductTypes[i] == ProductType.y_H2O)
419419
{
420420
continue;
421421
}

mzLib/Test/TestFragments.cs

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// License along with Proteomics. If not, see <http://www.gnu.org/licenses/>.
1818

1919
using Chemistry;
20+
using Easy.Common.Extensions;
2021
using MassSpectrometry;
2122
using MzLibUtil;
2223
using NUnit.Framework;
@@ -25,11 +26,9 @@
2526
using Proteomics.Fragmentation;
2627
using Proteomics.ProteolyticDigestion;
2728
using System;
28-
using System.Collections.Concurrent;
2929
using System.Collections.Generic;
3030
using System.Linq;
31-
using System.Threading.Tasks;
32-
using UsefulProteomicsDatabases;
31+
3332
using Stopwatch = System.Diagnostics.Stopwatch;
3433

3534
namespace Test
@@ -471,6 +470,24 @@ public static void Test_GetTheoreticalFragments_nTerminalModifiedPeptide_Neutral
471470
CollectionAssert.AreEquivalent(expectedCTerminalMassesLabels, cTerminalMassesLabels);
472471
}
473472

473+
[Test]
474+
public static void Test_WaterAndAmmoniaLossFragmentProductIons()
475+
{
476+
CollectionAssert.AreEquivalent(new List<ProductType>(){ ProductType.b_H2O, ProductType.b_NH3, ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.CID, FragmentationTerminus.Both));
477+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.b_H2O, ProductType.b_NH3, ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.IRMPD, FragmentationTerminus.Both));
478+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.b_H2O, ProductType.b_NH3, ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.HCD, FragmentationTerminus.Both));
479+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.b_H2O, ProductType.b_NH3, ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.EThcD, FragmentationTerminus.Both));
480+
481+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.ECD, FragmentationTerminus.Both));
482+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.ETD, FragmentationTerminus.Both));
483+
484+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.b_H2O, ProductType.b_NH3 }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.CID, FragmentationTerminus.N));
485+
CollectionAssert.AreEquivalent(new List<ProductType>() { ProductType.y_NH3, ProductType.y_H2O }, DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.CID, FragmentationTerminus.C));
486+
487+
CollectionAssert.IsEmpty(DissociationTypeCollection.GetWaterAndAmmoniaLossProductTypesFromDissociation(DissociationType.Unknown, FragmentationTerminus.Both));
488+
489+
}
490+
474491
[Test]
475492
public static void Test_GetTheoreticalFragments_ProductTypeLabel()
476493
{
@@ -669,11 +686,11 @@ public static void Test_Fragment_ProductTypesWithAminoAcidSpecificities(string f
669686
myPeptide.Fragment(dissociationType, FragmentationTerminus.Both, theseTheoreticalFragments);//Note that dissociation type here intentionally mismatched to dissociation type in modification constructor
670687

671688
Assert.AreEqual(aStarCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.aStar).Count());
672-
Assert.AreEqual(bStarCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.bStar).Count());
689+
Assert.AreEqual(bStarCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.b_NH3).Count());
673690
Assert.AreEqual(aDegreeCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.aDegree).Count());
674-
Assert.AreEqual(bDegreeCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.bDegree).Count());
675-
Assert.AreEqual(yStarCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.yStar).Count());
676-
Assert.AreEqual(yDegreeCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.yDegree).Count());
691+
Assert.AreEqual(bDegreeCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.b_H2O).Count());
692+
Assert.AreEqual(yStarCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.y_NH3).Count());
693+
Assert.AreEqual(yDegreeCount, theseTheoreticalFragments.Where(f => f.ProductType == ProductType.y_H2O).Count());
677694
Assert.AreEqual(totalFragmentCount, theseTheoreticalFragments.Count());
678695
}
679696

@@ -701,11 +718,11 @@ public static void Test_NeutralMassShiftFromProductType()
701718
Assert.AreEqual(0, mass);
702719
break;
703720

704-
case ProductType.bDegree:
721+
case ProductType.b_H2O:
705722
Assert.AreEqual(Chemistry.ClassExtensions.RoundedDouble(ChemicalFormula.ParseFormula("H-2O-1").MonoisotopicMass).Value, mass);
706723
break;
707724

708-
case ProductType.bStar:
725+
case ProductType.b_NH3:
709726
Assert.AreEqual(Chemistry.ClassExtensions.RoundedDouble(ChemicalFormula.ParseFormula("N-1H-3").MonoisotopicMass).Value, mass);
710727
break;
711728

@@ -737,11 +754,11 @@ public static void Test_NeutralMassShiftFromProductType()
737754
Assert.AreEqual(Chemistry.ClassExtensions.RoundedDouble(ChemicalFormula.ParseFormula("H2O1").MonoisotopicMass).Value, mass);
738755
break;
739756

740-
case ProductType.yDegree:
757+
case ProductType.y_H2O:
741758
Assert.AreEqual(0, mass);
742759
break;
743760

744-
case ProductType.yStar:
761+
case ProductType.y_NH3:
745762
Assert.AreEqual(Chemistry.ClassExtensions.RoundedDouble(ChemicalFormula.ParseFormula("O1H-1N-1").MonoisotopicMass).Value, mass);
746763
break;
747764

0 commit comments

Comments
 (0)