diff --git a/src/Common/CommonStandard/Lipidomics/MsmsCharacterization.cs b/src/Common/CommonStandard/Lipidomics/MsmsCharacterization.cs index 2a66ca721..0cbc424bb 100644 --- a/src/Common/CommonStandard/Lipidomics/MsmsCharacterization.cs +++ b/src/Common/CommonStandard/Lipidomics/MsmsCharacterization.cs @@ -3438,7 +3438,7 @@ public static LipidMolecule JudgeIfSphingomyelin(IMSScanProperty msScanProp, dou var diagnosticMz2 = 168.042572 + Electron; var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true || isClassIon2Found != true) return null; + if (isClassIon1Found == false || isClassIon2Found == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -4001,7 +4001,7 @@ public static LipidMolecule JudgeIfMag(IMSScanProperty msScanProp, double ms2Tol if (maxSn1DoubleBond > totalDoubleBond) maxSn1DoubleBond = totalDoubleBond; if (adduct.IonMode == IonMode.Positive) { // positive ion mode - if (adduct.AdductIonName == "[M+NH4]+") + if (adduct.AdductIonName == "[M+NH4]+" || adduct.AdductIonName == "[M+H]+") { // seek -17.026549 (NH3) var threshold = 5; @@ -5013,11 +5013,11 @@ public static LipidMolecule JudgeIfEtherlysope(IMSScanProperty msScanProp, doubl { var EtherFrag = "e"; // case LPE P- - // seek PreCursor -154 + // seek PreCursor -154 [SN1ether+C2H8NO]+ var threshold = 5.0; var diagnosticMz = theoreticalMz - (12 * 3 + MassDiffDictionary.PhosphorusMass + MassDiffDictionary.OxygenMass * 5 + MassDiffDictionary.HydrogenMass * 7); var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); - // seek PreCursor -172 + // seek PreCursor -172 [SN1ether+C2H6N]+ var threshold2 = 50.0; var diagnosticMz2 = diagnosticMz - H2O; var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); @@ -5908,21 +5908,17 @@ public static LipidMolecule JudgeIfDgdg(IMSScanProperty msScanProp, double ms2To // 2 x Hex loss var nl_SN1 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn1Carbon, sn1Double) - 341.108935 - 17.026549; var nl_SN2 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn2Carbon, sn2Double) - 341.108935 - 17.026549; - var nl_SN1_H2O = nl_SN1 - H2O; - var nl_SN2_H2O = nl_SN2 - H2O; var query = new List { new SpectrumPeak() { Mass = nl_SN1, Intensity = 1 }, new SpectrumPeak() { Mass = nl_SN2, Intensity = 1 }, - new SpectrumPeak() { Mass = nl_SN1_H2O, Intensity = 1 }, - new SpectrumPeak() { Mass = nl_SN2_H2O, Intensity = 1 }, }; var foundCount = 0; var averageIntensity = 0.0; LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query, ms2Tolerance, out foundCount, out averageIntensity); - if (foundCount >= 2) + if (foundCount >= 1) { // now I set 2 as the correct level var molecule = LipidMsmsCharacterizationUtility.getPhospholipidMoleculeObjAsLevel2("DGDG", LbmClass.DGDG, sn1Carbon, sn1Double, sn2Carbon, sn2Double, averageIntensity); @@ -5947,8 +5943,8 @@ public static LipidMolecule JudgeIfDgdg(IMSScanProperty msScanProp, double ms2To var sn2Carbon = totalCarbon - sn1Carbon; var sn2Double = totalDoubleBond - sn1Double; - var nl_SN1 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn1Carbon, sn1Double) - H2O + Proton; - var nl_SN2 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn2Carbon, sn2Double) - H2O + Proton; + var nl_SN1 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn1Carbon, sn1Double) - H2O + MassDiffDictionary.HydrogenMass; + var nl_SN2 = theoreticalMz - LipidMsmsCharacterizationUtility.acylCainMass(sn2Carbon, sn2Double) - H2O + MassDiffDictionary.HydrogenMass; var query = new List { new SpectrumPeak() { Mass = nl_SN1, Intensity = 0.1 }, @@ -6093,7 +6089,7 @@ public static LipidMolecule JudgeIfEthermgdg(IMSScanProperty msScanProp, double var threshold = 1; var diagnosticMz = theoreticalMz - 202.04533; // - Hex and Na var isClassIonFound = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); - if (isClassIonFound == false) return null; + //if (isClassIonFound == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -9185,7 +9181,7 @@ public static LipidMolecule JudgeIfCeramidens(IMSScanProperty msScanProp, double var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true && isClassIon2Found != true) return null; + if (isClassIon1Found == false || isClassIon2Found == false) return null; if (adduct.AdductIonName == "[M+CH3COO]-" || adduct.AdductIonName == "[M+Hac-H]-") { @@ -9451,7 +9447,7 @@ public static LipidMolecule JudgeIfCeramidends(IMSScanProperty msScanProp, doubl var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true || isClassIon2Found != true) return null; + if (isClassIon1Found == false || isClassIon2Found == false) return null; if (adduct.AdductIonName == "[M+CH3COO]-" || adduct.AdductIonName == "[M+Hac-H]-") { @@ -10599,7 +10595,7 @@ public static LipidMolecule JudgeIfCeramideap(IMSScanProperty msScanProp, double var diagnosticMz2 = diagnosticMz - H2O; var isClassIonFound = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIonFound == !true || isClassIon2Found == !true) return null; + if (isClassIonFound == false || isClassIon2Found == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -10768,7 +10764,7 @@ public static LipidMolecule JudgeIfCeramideabp(IMSScanProperty msScanProp, doubl var diagnosticMz2 = diagnosticMz - H2O; var isClassIonFound = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIonFound == !true || isClassIon2Found == !true) return null; + if (isClassIonFound == false || isClassIon2Found == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -11340,10 +11336,10 @@ public static LipidMolecule JudgeIfCeramideNhD9(IMSScanProperty msScanProp, doub //if (acylCarbon < minSphCarbon) { break; } var acylDouble = totalDoubleBond - sphDouble; - var sphChain_loss = diagnosticMz - (LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble) + MassDiffDictionary.OxygenMass) - - Proton + var sphChain_loss = diagnosticMz - (LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble) + MassDiffDictionary.OxygenMass) + - Proton + MassDiffDictionary.HydrogenMass * 3 + MassDiffDictionary.NitrogenMass + 12 * 2; // "[FA+NCCO-O-3H]-" - var sphFragment = LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble)+MassDiffDictionary.OxygenMass - Proton - (12*2+MassDiffDictionary.NitrogenMass+MassDiffDictionary.OxygenMass+ MassDiffDictionary.HydrogenMass * 3); // "[Sph-NCCO-3H]-" + var sphFragment = LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble) + MassDiffDictionary.OxygenMass - Proton - (12 * 2 + MassDiffDictionary.NitrogenMass + MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass * 3); // "[Sph-NCCO-3H]-" var acylamide = LipidMsmsCharacterizationUtility.acylCainMass(acylCarbon, acylDouble) - MassDiffDictionary.HydrogenMass * 9 + MassDiffDictionary.Hydrogen2Mass * 9 + MassDiffDictionary.NitrogenMass + Electron; var query = new List { new SpectrumPeak() { Mass = sphChain_loss, Intensity = 1 }, @@ -11398,7 +11394,7 @@ public static LipidMolecule JudgeIfHexceramideap(IMSScanProperty msScanProp, dou var diagnosticMz2 = adductform == "[M+H]+" ? diagnosticMz - H2O : diagnosticMz; var isClassIonFound = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIonFound == !true || isClassIon2Found == !true) return null; + if (isClassIonFound == false || isClassIon2Found == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -11586,7 +11582,7 @@ public static LipidMolecule JudgeIfCeramideas(IMSScanProperty msScanProp, double var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true && isClassIon2Found != true) return null; + if (isClassIon1Found == false && isClassIon2Found == false) return null; var isSolventAdduct = false; if (adduct.AdductIonName == "[M+CH3COO]-" || adduct.AdductIonName == "[M+Hac-H]-") @@ -11694,7 +11690,7 @@ public static LipidMolecule JudgeIfCeramideads(IMSScanProperty msScanProp, doubl var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true && isClassIon2Found != true) return null; + if (isClassIon1Found == false && isClassIon2Found == false) return null; var isSolventAdduct = false; if (adduct.AdductIonName == "[M+CH3COO]-" || adduct.AdductIonName == "[M+Hac-H]-") @@ -12000,7 +11996,7 @@ public static LipidMolecule JudgeIfCeramidenp(IMSScanProperty msScanProp, double var diagnosticMz2 = diagnosticMz - H2O; var isClassIonFound = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIonFound == !true || isClassIon2Found == !true) return null; + if (isClassIonFound == false || isClassIon2Found == false) return null; // from here, acyl level annotation is executed. var candidates = new List(); @@ -12094,7 +12090,7 @@ public static LipidMolecule JudgeIfCeramidenp(IMSScanProperty msScanProp, double var isClassIon1Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz1, threshold1); var isClassIon2Found = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); - if (isClassIon1Found != true && isClassIon2Found != true) return null; + if (isClassIon1Found == false && isClassIon2Found == false) return null; if (adduct.AdductIonName == "[M+CH3COO]-" || adduct.AdductIonName == "[M+Hac-H]-") { @@ -12159,15 +12155,15 @@ public static LipidMolecule JudgeIfCeramidenp(IMSScanProperty msScanProp, double public static LipidMolecule JudgeIfCeramideeos(IMSScanProperty msScanProp, double ms2Tolerance, double theoreticalMz, int totalCarbon, int totalDoubleBond, // If the candidate PC 46:6, totalCarbon = 46 and totalDoubleBond = 6 int minSphCarbon, int maxSphCarbon, int minSphDoubleBond, int maxSphDoubleBond, - int minOmegaacylCarbon, int maxOmegaacylCarbon, int minOmegaacylDoubleBond, int maxOmegaacylDoubleBond, + int minAcylCarbon, int maxAcylCarbon, int minAcylDoubleBond, int maxAcylDoubleBond, AdductIon adduct) { var spectrum = msScanProp.Spectrum; if (spectrum == null || spectrum.Count == 0) return null; if (maxSphCarbon > totalCarbon) maxSphCarbon = totalCarbon; if (maxSphDoubleBond > totalDoubleBond) maxSphDoubleBond = totalDoubleBond; - if (maxOmegaacylCarbon > totalCarbon) maxOmegaacylCarbon = totalCarbon; - if (maxOmegaacylDoubleBond > totalDoubleBond) maxOmegaacylDoubleBond = totalDoubleBond; + if (maxAcylCarbon > totalCarbon) maxAcylCarbon = totalCarbon; + if (maxAcylDoubleBond > totalDoubleBond) maxAcylDoubleBond = totalDoubleBond; if (adduct.IonMode == IonMode.Negative) { // negative ion mode @@ -12203,27 +12199,23 @@ public static LipidMolecule JudgeIfCeramideeos(IMSScanProperty msScanProp, doubl { var remainCarbon = totalCarbon - sphCarbon; var remainDouble = totalDoubleBond - sphDouble; - var carbonLimit = Math.Min(remainCarbon, maxOmegaacylCarbon); - var doubleLimit = Math.Min(remainDouble, maxOmegaacylDoubleBond); + var carbonLimit = Math.Min(remainCarbon, maxAcylCarbon); + var doubleLimit = Math.Min(remainDouble, maxAcylDoubleBond); - for (int acylCarbon = minOmegaacylCarbon; acylCarbon <= carbonLimit; acylCarbon++) + for (int acylCarbon = minAcylCarbon; acylCarbon <= carbonLimit; acylCarbon++) { for (int acylDouble = 0; acylDouble <= doubleLimit; acylDouble++) { var terminalCarbon = totalCarbon - sphCarbon - acylCarbon; //if (acylCarbon < maxSphCarbon) break; var terminalDouble = totalDoubleBond - sphDouble - acylDouble; - - var esterloss = diagnosticMz - LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble) + - MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass; // + //var esterloss = diagnosticMz - LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble) + // + MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass; // var esterFa = LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble); - var acylamide = LipidMsmsCharacterizationUtility.fattyacidProductIon(acylCarbon, acylDouble) + - MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass + Electron; - - //Console.WriteLine("d" + sphCarbon + ":" + sphDouble + "/" + omegaAcylCarbon + ":" + omegaAcylDouble + "-O-" + - // acylCarbon + ":" + acylDouble + " " + - // esterloss + " " + esterFa + " " + acylamide); - + var acylamide = LipidMsmsCharacterizationUtility.fattyacidProductIon(acylCarbon, acylDouble) + + MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass + Electron; + var sphIon = LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble) + - (12 * 2 + MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass * 5 + MassDiffDictionary.OxygenMass) + Electron; var query1 = new List { new SpectrumPeak() { Mass = esterFa, Intensity = 30 }, }; @@ -12236,22 +12228,22 @@ public static LipidMolecule JudgeIfCeramideeos(IMSScanProperty msScanProp, doubl { // the diagnostic acyl ion must be observed for level 2 annotation var query2 = new List { - new SpectrumPeak() { Mass = esterloss, Intensity = 1 }, - new SpectrumPeak() { Mass = esterFa, Intensity = 30 }, - new SpectrumPeak() { Mass = acylamide, Intensity = 0.01 } + new SpectrumPeak() { Mass = acylamide, Intensity = 0.1 }, + new SpectrumPeak() { Mass = sphIon, Intensity = 0.1 } + }; var foundCount2 = 0; var averageIntensity2 = 0.0; LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query2, ms2Tolerance, out foundCount2, out averageIntensity2); - if (foundCount2 == 3) + if (foundCount2 >= 1) { var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("Cer", LbmClass.Cer_EOS, "d", sphCarbon, sphDouble, acylCarbon, acylDouble, terminalCarbon, terminalDouble, averageIntensity1); candidates.Add(molecule); } - else if (foundCount2 == 2) + else { var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2_0("Cer", LbmClass.Cer_EOS, "d", sphCarbon + acylCarbon, sphDouble + acylDouble, terminalCarbon, terminalDouble, averageIntensity2); @@ -12390,7 +12382,7 @@ public static LipidMolecule JudgeIfCeramideeos(IMSScanProperty msScanProp, doubl public static LipidMolecule JudgeIfCeramideeods(IMSScanProperty msScanProp, double ms2Tolerance, double theoreticalMz, int totalCarbon, int totalDoubleBond, // If the candidate PC 46:6, totalCarbon = 46 and totalDoubleBond = 6 int minSphCarbon, int maxSphCarbon, int minSphDoubleBond, int maxSphDoubleBond, - int minOmegaacylCarbon, int maxOmegaacylCarbon, int minOmegaacylDoubleBond, int maxOmegaacylDoubleBond, + int minAcylCarbon, int maxAcylCarbon, int minAcylDoubleBond, int maxAcylDoubleBond, AdductIon adduct) { var spectrum = msScanProp.Spectrum; @@ -12424,21 +12416,22 @@ public static LipidMolecule JudgeIfCeramideeods(IMSScanProperty msScanProp, doub var remainCarbon = totalCarbon - sphCarbon; var remainDouble = totalDoubleBond - sphDouble; - var carbonLimit = Math.Min(remainCarbon, maxOmegaacylCarbon); - var doubleLimit = Math.Min(remainDouble, maxOmegaacylDoubleBond); - for (int acylCarbon = minOmegaacylCarbon; acylCarbon <= carbonLimit; acylCarbon++) + var carbonLimit = Math.Min(remainCarbon, maxAcylCarbon); + var doubleLimit = Math.Min(remainDouble, maxAcylDoubleBond); + for (int acylCarbon = minAcylCarbon; acylCarbon <= carbonLimit; acylCarbon++) { for (int acylDouble = 0; acylDouble <= doubleLimit; acylDouble++) { var terminalCarbon = totalCarbon - sphCarbon - acylCarbon; var terminalDouble = totalDoubleBond - sphDouble - acylDouble; - var esterloss = diagnosticMz - LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble) - + MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass; // + //var esterloss = diagnosticMz - LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble) + // + MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass; // var esterFa = LipidMsmsCharacterizationUtility.fattyacidProductIon(terminalCarbon, terminalDouble); var acylamide = LipidMsmsCharacterizationUtility.fattyacidProductIon(acylCarbon, acylDouble) + MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass + Electron; - + var sphIon = LipidMsmsCharacterizationUtility.SphingoChainMass(sphCarbon, sphDouble) + - (12 * 2 + MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass * 5 + MassDiffDictionary.OxygenMass) + Electron; var query1 = new List { new SpectrumPeak() { Mass = esterFa, Intensity = 30 }, }; @@ -12452,24 +12445,23 @@ public static LipidMolecule JudgeIfCeramideeods(IMSScanProperty msScanProp, doub { // the diagnostic acyl ion must be observed for level 2 annotation var query2 = new List { - new SpectrumPeak() { Mass = esterloss, Intensity = 1 }, - new SpectrumPeak() { Mass = esterFa, Intensity = 30 }, - new SpectrumPeak() { Mass = acylamide, Intensity = 0.01 } + new SpectrumPeak() { Mass = acylamide, Intensity = 0.1 }, + new SpectrumPeak() { Mass = sphIon, Intensity = 0.1 } }; var foundCount2 = 0; var averageIntensity2 = 0.0; LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query2, ms2Tolerance, out foundCount2, out averageIntensity2); - if (foundCount2 == 3) + if (foundCount2 >= 1) { - var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("Cer", LbmClass.Cer_EOS, "d", sphCarbon, sphDouble, + var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("Cer", LbmClass.Cer_EODS, "d", sphCarbon, sphDouble, acylCarbon, acylDouble, terminalCarbon, terminalDouble, averageIntensity1); candidates.Add(molecule); } - else if (foundCount2 == 2) + else { - var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2_0("Cer", LbmClass.Cer_EOS, "d", sphCarbon + acylCarbon, + var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2_0("Cer", LbmClass.Cer_EODS, "d", sphCarbon + acylCarbon, sphDouble + acylDouble, terminalCarbon, terminalDouble, averageIntensity2); candidates.Add(molecule); } @@ -12500,15 +12492,15 @@ public static LipidMolecule JudgeIfCeramideeods(IMSScanProperty msScanProp, doub public static LipidMolecule JudgeIfHexceramideeos(IMSScanProperty msScanProp, double ms2Tolerance, double theoreticalMz, int totalCarbon, int totalDoubleBond, // In positive, HexCer-EOS d18:1/34:0: In negative, HexCer-EOS d38:1-O-18:2 int minSphCarbon, int maxSphCarbon, int minSphDoubleBond, int maxSphDoubleBond, - int minOmegaacylCarbon, int maxOmegaacylCarbon, int minOmegaacylDoubleBond, int maxOmegaacylDoubleBond, + int minAcylCarbon, int maxAcylCarbon, int minAcylDoubleBond, int maxAcylDoubleBond, AdductIon adduct) { var spectrum = msScanProp.Spectrum; if (spectrum == null || spectrum.Count == 0) return null; if (maxSphCarbon > totalCarbon) maxSphCarbon = totalCarbon; if (maxSphDoubleBond > totalDoubleBond) maxSphDoubleBond = totalDoubleBond; - if (maxOmegaacylCarbon > totalCarbon) maxOmegaacylCarbon = totalCarbon; - if (maxOmegaacylDoubleBond > totalDoubleBond) maxOmegaacylDoubleBond = totalDoubleBond; + if (maxAcylCarbon > totalCarbon) maxAcylCarbon = totalCarbon; + if (maxAcylDoubleBond > totalDoubleBond) maxAcylDoubleBond = totalDoubleBond; if (adduct.IonMode == IonMode.Negative) { // negative ion mode @@ -12540,17 +12532,12 @@ public static LipidMolecule JudgeIfHexceramideeos(IMSScanProperty msScanProp, do { for (int sphDouble = minSphDoubleBond; sphDouble <= maxSphDoubleBond; sphDouble++) { - var remainCarbon = totalCarbon - sphCarbon; - var remainDouble = totalDoubleBond - sphDouble; - var carbonLimit = Math.Min(remainCarbon, maxOmegaacylCarbon); - var doubleLimit = Math.Min(remainDouble, maxOmegaacylDoubleBond); - - for (int omegaAcylCarbon = minOmegaacylCarbon; omegaAcylCarbon <= carbonLimit; omegaAcylCarbon++) + for (int acylCarbon = minAcylCarbon; acylCarbon <= maxAcylCarbon; acylCarbon++) { - for (int omegaAcylDouble = 0; omegaAcylDouble <= doubleLimit; omegaAcylDouble++) + for (int acylDouble = 0; acylDouble <= maxAcylDoubleBond; acylDouble++) { - var acylCarbon = totalCarbon - sphCarbon - omegaAcylCarbon; - var acylDouble = totalDoubleBond - sphDouble - omegaAcylDouble; + var omegaAcylCarbon = acylCarbon; + var omegaAcylDouble = acylDouble; var omegaAcylloss = diagnosticMz - LipidMsmsCharacterizationUtility.fattyacidProductIon(omegaAcylCarbon, omegaAcylDouble) + MassDiffDictionary.OxygenMass + MassDiffDictionary.HydrogenMass; // var omegaAcyllossHexloss = omegaAcylloss - 162.052833; // @@ -12567,39 +12554,18 @@ public static LipidMolecule JudgeIfHexceramideeos(IMSScanProperty msScanProp, do var query = new List { new SpectrumPeak() { Mass = omegaAcylloss, Intensity = 0.01 }, new SpectrumPeak() { Mass = omegaAcyllossHexloss, Intensity = 0.01 }, - new SpectrumPeak() { Mass = omegaAcylFA, Intensity = 0.01 }, }; var foundCount = 0; var averageIntensity = 0.0; LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query, ms2Tolerance, out foundCount, out averageIntensity); - //if (sphCarbon == 48 && sphDouble == 3 && omegaAcylCarbon == 19 && omegaAcylDouble == 0) { - // Console.WriteLine(); - //} - - if (foundCount >= 2) + if (foundCount >= 1) { // the diagnostic acyl ion must be observed for level 2 annotation - var acylamide = LipidMsmsCharacterizationUtility.fattyacidProductIon(acylCarbon, acylDouble) + MassDiffDictionary.NitrogenMass + MassDiffDictionary.HydrogenMass + Electron; - var query2 = new List { - new SpectrumPeak() { Mass = acylamide, Intensity = 0.01 } - }; - var foundCount2 = 0; - var averageIntensity2 = 0.0; - LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query2, ms2Tolerance, out foundCount2, out averageIntensity2); - if (foundCount2 == 1) - { - var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("HexCer", LbmClass.HexCer_EOS, "d", sphCarbon, sphDouble, - acylCarbon, acylDouble, omegaAcylCarbon, omegaAcylDouble, averageIntensity); - candidates.Add(molecule); - } - else - { - var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2_0("HexCer", LbmClass.HexCer_EOS, "d", sphCarbon + acylCarbon, - sphDouble + acylDouble, omegaAcylCarbon, omegaAcylDouble, averageIntensity); + var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2_0("HexCer", LbmClass.HexCer_EOS, "d", sphCarbon, + sphDouble, omegaAcylCarbon, omegaAcylDouble, averageIntensity); candidates.Add(molecule); - } } } } @@ -12971,15 +12937,15 @@ public static LipidMolecule JudgeIfAcylsm(IMSScanProperty msScanProp, double ms2 public static LipidMolecule JudgeIfAcylcerbds(IMSScanProperty msScanProp, double ms2Tolerance, double theoreticalMz, int totalCarbon, int totalDoubleBond, // If the candidate PC 46:6, totalCarbon = 46 and totalDoubleBond = 6 int minSphCarbon, int maxSphCarbon, int minSphDoubleBond, int maxSphDoubleBond, - int minExtAcylCarbon, int maxExtAcylCarbon, int minExtAcylDoubleBond, int maxExtAcylDoubleBond, + int minAcylCarbon, int maxAcylCarbon, int minAcylDoubleBond, int maxAcylDoubleBond, AdductIon adduct) { var spectrum = msScanProp.Spectrum; if (spectrum == null || spectrum.Count == 0) return null; if (maxSphCarbon > totalCarbon) maxSphCarbon = totalCarbon; if (maxSphDoubleBond > totalDoubleBond) maxSphDoubleBond = totalDoubleBond; - if (maxExtAcylCarbon > totalCarbon) maxExtAcylCarbon = totalCarbon; - if (maxExtAcylDoubleBond > totalDoubleBond) maxExtAcylDoubleBond = totalDoubleBond; + if (maxAcylCarbon > totalCarbon) maxAcylCarbon = totalCarbon; + if (maxAcylDoubleBond > totalDoubleBond) maxAcylDoubleBond = totalDoubleBond; if (adduct.IonMode == IonMode.Negative) { // negative ion mode @@ -13010,9 +12976,9 @@ public static LipidMolecule JudgeIfAcylcerbds(IMSScanProperty msScanProp, double var carbonLimit = Math.Min(remainCarbon, maxSphCarbon); var doubleLimit = Math.Min(remainDouble, maxSphDoubleBond); - for (int acylCarbon = minExtAcylCarbon; acylCarbon <= carbonLimit; acylCarbon++) + for (int acylCarbon = minAcylCarbon; acylCarbon <= carbonLimit; acylCarbon++) { - for (int acylDB = minExtAcylDoubleBond; acylDB <= doubleLimit; acylDB++) + for (int acylDB = minAcylDoubleBond; acylDB <= doubleLimit; acylDB++) { var terminalC = totalCarbon - sphCarbon - acylCarbon; var terminalDB = totalDoubleBond - sphDouble - acylDB; @@ -13027,15 +12993,28 @@ public static LipidMolecule JudgeIfAcylcerbds(IMSScanProperty msScanProp, double new SpectrumPeak() { Mass = acylFragment, Intensity = 1 } }; - var foundCount = 0; - var averageIntensity = 0.0; - LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query, ms2Tolerance, out foundCount, out averageIntensity); + var query1 = new List { + new SpectrumPeak() { Mass = esterFa, Intensity = 30 }, + }; - if (foundCount >= 2) + var foundCount1 = 0; + var averageIntensity1 = 0.0; + LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query1, ms2Tolerance, out foundCount1, out averageIntensity1); + if (foundCount1 == 1) { - var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("Cer", LbmClass.Cer_EBDS, "d", sphCarbon, sphDouble, - acylCarbon, acylDB, terminalC, terminalDB, averageIntensity); - candidates.Add(molecule); + var query2 = new List { + new SpectrumPeak() { Mass = acylFragment, Intensity = 0.1 }, + }; + + var foundCount2 = 0; + var averageIntensity2 = 0.0; + LipidMsmsCharacterizationUtility.countFragmentExistence(spectrum, query2, ms2Tolerance, out foundCount2, out averageIntensity2); + if (foundCount2 > 0) + { + var molecule = LipidMsmsCharacterizationUtility.getEsterceramideMoleculeObjAsLevel2("Cer", LbmClass.Cer_EBDS, "d", sphCarbon, sphDouble, + acylCarbon, acylDB, terminalC, terminalDB, averageIntensity2); + candidates.Add(molecule); + } } } } @@ -16651,11 +16630,11 @@ public static LipidMolecule JudgeIfnoChainSterol(string lipidname, LbmClass lipi } if (adduct.AdductIonName == "[M+H-H2O]+") { - // calc [M+H-H2O]+ - var diagnosticMz = theoreticalMz; - diagnosticMz = diagnosticMz - H2O; - var threshold = 1; - var isSterolFrag = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); + //// calc [M+H-H2O]+ + //var diagnosticMz = theoreticalMz; + //diagnosticMz = diagnosticMz - H2O; + //var threshold = 1; + //var isSterolFrag = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz, threshold); var candidates = new List(); return LipidMsmsCharacterizationUtility.returnAnnotationNoChainResult(lipidname, lipidclass, "", theoreticalMz, adduct, totalCarbon, totalDoubleBond, 0, candidates, 0); @@ -19787,7 +19766,7 @@ public static LipidMolecule JudgeIfNAcylLeu(IMSScanProperty msScanProp, double m // seek -44(CO2 loss) var threshold2 = 0.5; - var diagnosticMz2 = theoreticalMz - 12- MassDiffDictionary.OxygenMass * 2; + var diagnosticMz2 = theoreticalMz - 12 - MassDiffDictionary.OxygenMass * 2; var isClassIonFound2 = LipidMsmsCharacterizationUtility.isDiagnosticFragmentExist(spectrum, ms2Tolerance, diagnosticMz2, threshold2); if (isClassIonFound2 == false) return null; diff --git a/src/Common/CommonStandard/Resources/LbmQueries.txt b/src/Common/CommonStandard/Resources/LbmQueries.txt index 39c12ea79..df4f4ec4f 100644 --- a/src/Common/CommonStandard/Resources/LbmQueries.txt +++ b/src/Common/CommonStandard/Resources/LbmQueries.txt @@ -34,6 +34,7 @@ NAE [M+H]+ Positive TRUE GPNAE [M+H]+ Positive TRUE MGDG [M+NH4]+ Positive TRUE DGDG [M+NH4]+ Positive TRUE +DGDG [M+Na]+ Positive FALSE MGMG [M+NH4]+ Positive TRUE DGMG [M+NH4]+ Positive TRUE EtherMGDG [M+NH4]+ Positive TRUE @@ -288,6 +289,8 @@ Cer_BDS [M+CH3COO]- Negative TRUE Cer_NP [M-H]- Negative TRUE Cer_NP [M+HCOO]- Negative TRUE Cer_NP [M+CH3COO]- Negative TRUE +Cer_NP [M+H]+ Positive True +Cer_NP [M+H-H2O]+ Positive True Cer_EOS [M+H]+ Positive TRUE Cer_EOS [M+H-H2O]+ Positive TRUE Cer_EOS [M-H]- Negative TRUE diff --git a/tests/Common/CommonStandardTests/Lipidomics/MsmsCharacterizationTests.cs b/tests/Common/CommonStandardTests/Lipidomics/MsmsCharacterizationTests.cs index 37c23fc0a..ce4648886 100644 --- a/tests/Common/CommonStandardTests/Lipidomics/MsmsCharacterizationTests.cs +++ b/tests/Common/CommonStandardTests/Lipidomics/MsmsCharacterizationTests.cs @@ -2483,6 +2483,103 @@ public void SMd9adductHCO3Test() Console.WriteLine($"LipidName:{result.LipidName}"); Console.WriteLine($"AnnotationLevel:{result.AnnotationLevel}"); } + [TestMethod()] + public void CerEODSTest() + { + //Cer 18:0;O2/16:0;O(FA 12:0) + var PRECURSORTYPE = "[M-H]-"; + var target = new MSScanProperty + { + PrecursorMz = 736.6824, + Spectrum = new List + { + new SpectrumPeak { Mass =736.682449, Intensity =200, }, + new SpectrumPeak { Mass =554.515383, Intensity =100, }, + new SpectrumPeak { Mass =296.260052, Intensity =50, }, + new SpectrumPeak { Mass =270.243853, Intensity =50, }, + new SpectrumPeak { Mass =239.238039, Intensity =50, }, + new SpectrumPeak { Mass =199.170354, Intensity =999, }, + } + }; + + var molMsRef = new MoleculeMsReference + { + Name = "Cer 18:0;O2/16:0;O(FA 12:0)", + PrecursorMz = 736.6824, + CompoundClass = "Cer_EODS", + }; + var molecule = LipidomicsConverter.ConvertMsdialLipidnameToLipidMoleculeObjectVS2(molMsRef); + var totalCarbon = molecule.TotalCarbonCount; //46 + var totalDbBond = molecule.TotalDoubleBondCount; //0 + var totalOxidized = molecule.TotalOxidizedCount; //4 + var sn1Carbon = molecule.Sn1CarbonCount; //18 + var sn1DbBond = molecule.Sn1DoubleBondCount; //0 + var sn2Carbon = molecule.Sn2CarbonCount; //16 + var sn2DbBond = molecule.Sn2DoubleBondCount; //0 + var ExCarbon = molecule.Sn3CarbonCount; //12 + var ExDbBond = molecule.Sn3DoubleBondCount; //0 + + var result = LipidMsmsCharacterization.JudgeIfCeramideeods(target, 0.025, + 736.6824f, totalCarbon, totalDbBond, + sn1Carbon, sn1Carbon, sn1DbBond, sn1DbBond, + sn2Carbon, sn2Carbon, sn2DbBond, sn2DbBond, + adduct = AdductIon.GetAdductIon(PRECURSORTYPE)); + + + Console.WriteLine($"CerEODS test (Cer 18:0;O2/16:0;O(FA 12:0))"); + Console.WriteLine(PRECURSORTYPE); + Console.WriteLine($"LipidName:{result.LipidName}"); + Console.WriteLine($"AnnotationLevel:{result.AnnotationLevel}"); + + } + + [TestMethod()] + public void HexCerEOSTest() + { + //HexCer 34:1;O3(FA 12:0) + var PRECURSORTYPE = "[M-H]-"; + var target = new MSScanProperty + { + PrecursorMz = 896.7196, + Spectrum = new List + { + new SpectrumPeak { Mass =896.719622, Intensity =999, }, + new SpectrumPeak { Mass =734.666799, Intensity =50, }, + new SpectrumPeak { Mass =714.552557, Intensity =100, }, + new SpectrumPeak { Mass =696.541992, Intensity =500, }, + new SpectrumPeak { Mass =552.499733, Intensity =50, }, + new SpectrumPeak { Mass =199.170354, Intensity =50, }, + } + }; + + var molMsRef = new MoleculeMsReference + { + Name = "HexCer 34:1;O3(FA 12:0)", + PrecursorMz = 896.7196, + CompoundClass = "HexCer_EOS", + }; + var molecule = LipidomicsConverter.ConvertMsdialLipidnameToLipidMoleculeObjectVS2(molMsRef); + var totalCarbon = molecule.TotalCarbonCount; //46 + var totalDbBond = molecule.TotalDoubleBondCount; //1 + var totalOxidized = molecule.TotalOxidizedCount; //3 + var sn1Carbon = molecule.Sn1CarbonCount; //34 + var sn1DbBond = molecule.Sn1DoubleBondCount; //1 + var sn2Carbon = molecule.Sn2CarbonCount; //12 + var sn2DbBond = molecule.Sn2DoubleBondCount; //0 + + var result = LipidMsmsCharacterization.JudgeIfHexceramideeos(target, 0.025, + 896.7196f, totalCarbon, totalDbBond, + sn1Carbon, sn1Carbon, sn1DbBond, sn1DbBond, + sn2Carbon, sn2Carbon, sn2DbBond, sn2DbBond, + adduct = AdductIon.GetAdductIon(PRECURSORTYPE)); + + + Console.WriteLine($"HexCerEOS test (HexCer 34:1;O3(FA 12:0))"); + Console.WriteLine(PRECURSORTYPE); + Console.WriteLine($"LipidName:{result.LipidName}"); + Console.WriteLine($"AnnotationLevel:{result.AnnotationLevel}"); + + } }