public metFrag ( double exactMass, string strPeaks, int mode, double mzabs, double mzppm, |
||
exactMass | double | |
strPeaks | string | |
mode | int | |
mzabs | double | |
mzppm | double | |
isCancelled | ||
return | IEnumerable |
public void WhenCandidateHasUnkownElement_GeneratesNoHits() { var fragger = new MetFrag(Encoding.Default.GetString(Resources.Digoxin_with_unknown_element)); var results = fragger.metFrag(TestConfig.ExactMass, TestConfig.Peaks, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results[0].FragmentPics.Count(), Is.EqualTo(0)); }
public void WhenNoPeaksAreGiven_GeneratesNoHits() { var fragger = new MetFrag(Encoding.Default.GetString(Resources.Dihydrohydroxyciguatoxin)); var results = fragger.metFrag(TestConfig.ExactMass, "", TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results[0].FragmentPics.Count(), Is.EqualTo(0)); }
public void Negative_GainsAndLosesHydrogen() { const string peaks = @"113.076583862305 3.40501737594604 117.040496826172 3.55244660377502 118.999359130859 4.39520215988159 124.740966796875 2.43928718566895 142.267822265625 2.85816287994385"; var fragger = new MetFrag(Encoding.Default.GetString(Resources.Melibiose)); var results = fragger.metFrag(double.MaxValue, peaks, -1, mzAbs, mzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(1)); var frags = results[0].FragmentPics.ToList(); Assert.That(frags.Count, Is.EqualTo(6)); Assert.That(frags[0], new FragConstraint("C4H7O4", "", 119.0344)); Assert.That(frags[1], new FragConstraint("C4H6O4", "+H", 119.0344)); Assert.That(frags[2], new FragConstraint("C4H8O4", "-H", 119.0344)); Assert.That(frags[3], new FragConstraint("C4H6O4", "-H", 117.0188)); Assert.That(frags[4], new FragConstraint("C5H8O3", "+H", 117.0552)); Assert.That(frags[5], new FragConstraint("C5H6O3", "-H", 113.0239)); }
public void Positive_GainsAndLosesHydrogen() { const string peaks = @"121.065101623535 91 180.260803222656 112 133.076599121094 441 179.09489440918 765 171.044692993164 283"; var fragger = new MetFrag(Encoding.Default.GetString(Resources.Norsalsolinol)); var results = fragger.metFrag(double.MaxValue, peaks, 1, mzAbs, mzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(1)); var frags = results[0].FragmentPics.ToList(); Assert.That(frags.Count, Is.EqualTo(7)); Assert.That(frags[0], new FragConstraint("C10H13NO2", "", 179.0946)); Assert.That(frags[1], new FragConstraint("C9H10N", "+H", 133.0891)); Assert.That(frags[2], new FragConstraint("C9H8O", "+H", 133.0653)); Assert.That(frags[3], new FragConstraint("C8H7NO", "", 133.0528)); Assert.That(frags[4], new FragConstraint("C8H10N", "+H", 121.0891)); Assert.That(frags[5], new FragConstraint("C8H11N", "", 121.0891)); Assert.That(frags[6], new FragConstraint("C7H6O2", "-H", 121.029)); }
private void BioMolecules_CreatesExpectedNumberOfFragments() { var peaksToUse = @"100.397850036621 6084.7646484375 111.041725158691 89713.7109375 112.049331665039 20392.29296875 115.121894836426 7023.431640625 125.057731628418 55243.30078125 126.065040588379 19947.212890625 126.586647033691 7430.0810546875 127.432609558105 9791.2099609375 130.686874389648 6125.7294921875 133.519241333008 6250.6025390625 139.073135375977 27194.77734375 140.081024169922 8653.3701171875 141.052490234375 85327.2109375 154.907775878906 7291.3662109375 155.068099975586 82133.109375 169.083847045898 77232.203125 170.09147644043 33127.890625 178.624557495117 34086.44140625 183.099609375 46221.48046875 184.106597900391 13683.2734375 185.078720092773 99354.1953125 187.058700561523 7701.8564453125 199.094619750977 78201.640625 199.97981262207 6970.1728515625 201.763946533203 9139.736328125 205.904205322266 7815.9130859375 213.110275268555 124392.3515625 226.469482421875 7387.001953125 227.125961303711 46340.45703125 229.105331420898 70555.1015625 235.869552612305 6644.9130859375 243.120620727539 45280.11328125 245.080383300781 6373.5869140625 257.139770507813 85038.3515625 263.521484375 30267.38671875 267.500640869141 7684.5 271.152374267578 109083.7265625 272.155822753906 14334.482421875 273.023498535156 6279.8740234375 273.131652832031 46495.15234375 275.341491699219 7122.2392578125 280.299743652344 8165.2646484375 287.147369384766 65601.890625 301.162475585938 114764.4296875 302.164978027344 9164.154296875 303.142547607422 10162.73828125 315.1787109375 39774.31640625 315.193908691406 2338.04077148438 317.157653808594 43387.875 330.478851318359 6405.681640625 331.174163818359 14949.921875 336.116638183594 66353.78125 345.18896484375 30641.76953125 351.135986328125 7979.638671875 359.208770751953 9361.5390625 361.183563232422 61034.578125 375.199493408203 20278.478515625 389.215484619141 144133.21875 390.218841552734 16875.31640625 391.195587158203 10765.55859375 403.2373046875 7835.2333984375 405.210510253906 94771.1171875 406.212066650391 15495.28515625 407.217956542969 7172.7373046875 433.242797851563 38040.390625 463.212585449219 7296.9775390625 463.502777099609 11091.3154296875 477.049591064453 6946.8330078125 485.83154296875 10096.712890625 513.268432617188 11768.0068359375 527.283508300781 96462.8671875 528.289245605469 18344.2578125 540.370361328125 6746.7958984375 553.298706054688 39186.1015625 554.300170898438 9778.431640625 567.3154296875 134498.140625 568.318603515625 52262.67578125 581.3310546875 17197.34375 619.9345703125 8013.0400390625 623.527465820313 7393.41796875 634.746765136719 11545.482421875 637.441528320313 50469.31640625 638.072387695313 12601.759765625 638.375793457031 14698.759765625 638.446655273438 24503.33984375 639.271606445313 95686.96875 639.302062988281 82458.1484375 639.409240722656 12545069 640.283447265625 38409.87109375 640.412353515625 4322288 640.67236328125 21821.986328125 640.758728027344 18302.59765625 641.057983398438 12969.8701171875 643.178955078125 10643.67578125 646.502868652344 21642.703125"; var fragger = new MetFrag(Encoding.Default.GetString(Resources.Nonoxynol)); var results = fragger.metFrag(TestConfig.ExactMass, peaksToUse, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(4)); Assert.That(results[0].FragmentPics.Count(), Is.EqualTo(4)); Assert.That(results[1].FragmentPics.Count(), Is.EqualTo(4)); Assert.That(results[2].FragmentPics.Count(), Is.EqualTo(4)); Assert.That(results[3].FragmentPics.Count(), Is.EqualTo(4)); }
private static void AssertResults(string peaksToUse, byte[] sdfBytes, IEnumerable<Tuple<int, int>> expected) { var fragger = new MetFrag(Encoding.Default.GetString(sdfBytes)); var results = fragger.metFrag(TestConfig.ExactMass, peaksToUse, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None); var resultTuples = results.ToList().Select(row => Tuple.Create(Convert.ToInt32(row.ID), row.FragmentPics.Count())); CollectionAssert.AreEquivalent(expected, resultTuples); }
private void Biomolecules_Compound_528_GeneratesExpectedNumberOfFragments() { var peaksToUse = @"102.223709106445 3210.46923828125 109.74959564209 3258.2373046875 111.347877502441 3622.7626953125 126.423698425293 3760.78759765625 135.749435424805 3437.94580078125 139.073059082031 11373.1259765625 149.730972290039 3446.09326171875 149.934875488281 3356.4697265625 151.096466064453 6603.8251953125 153.052429199219 15212.22265625 154.625671386719 4323.99462890625 156.099334716797 17933.58203125 166.083923339844 27749.3125 169.052032470703 7839.13916015625 169.06526184082 9693.599609375 169.083633422852 960484.875 170.086303710938 4417.09423828125 171.04508972168 8310.52734375 174.853546142578 3689.14111328125 178.616241455078 14135.0908203125 186.110153198242 82545.78125 191.1884765625 3792.20068359375 193.539337158203 2928.16357421875 194.05256652832 3195.65576171875 196.094589233398 436245.53125 198.056106567383 10465.3837890625 198.979934692383 4609.01904296875 200.125869750977 239590.109375 201.780685424805 4804.7412109375 210.109939575195 17231.0234375 212.071975708008 4897.8544921875 218.138671875 19326.67578125 223.080139160156 3454.17236328125 226.105163574219 1077427.375 226.138916015625 6267.35546875 227.108108520508 9400.05078125 228.066436767578 66124.921875 240.120620727539 18978.65625 241.128707885742 59685.7890625 242.082382202148 24625.2578125 257.082000732422 8046.85791015625 258.077362060547 174270.25 262.049163818359 3310.32373046875 263.557312011719 11641.001953125 272.092987060547 64867.05078125 274.093078613281 830.994750976563 274.108642578125 50666.91015625 276.126831054688 6096.8759765625 316.249267578125 4243.96337890625 319.161010742188 4038.40966796875 323.728179931641 3614.86181640625 324.229095458984 3384.89599609375 328.155670166016 9943.76171875 330.135040283203 106208.4609375 336.0947265625 33201.1953125 336.258331298828 3417.14111328125 344.150451660156 17088.328125 356.847930908203 4898.21240234375 358.166259765625 163220.796875 368.100372314453 3360.1171875 372.743530273438 3510.92236328125 374.160827636719 6473.884765625 378.499359130859 3736.86474609375 388.123504638672 6655.21826171875 388.176635742188 50415.32421875 390.138244628906 85968.2734375 400.10693359375 3835.88427734375 403.123352050781 3748.4169921875 406.132232666016 10317.5361328125 419.234588623047 3820.03466796875 420.148712158203 44647.453125 422.164428710938 300265.3125 430.658172607422 3244.580078125 440.176879882813 3332.71240234375 463.493530273438 4825.72265625 473.44482421875 3562.62060546875 485.704467773438 5128.36962890625 505.448028564453 3554.8486328125 506.185699462891 34175.1796875 508.200256347656 15585.77734375 510.431457519531 3322.82275390625 553.191772460938 6261.05419921875 554.188293457031 62017.9765625"; var fragger = new MetFrag(Encoding.Default.GetString(Resources.Alpha_Trisaccharide)); var results = fragger.metFrag(TestConfig.ExactMass, peaksToUse, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(4)); Assert.That(results[0].FragmentPics.Count(), Is.EqualTo(15)); Assert.That(results[1].FragmentPics.Count(), Is.EqualTo(4)); Assert.That(results[2].FragmentPics.Count(), Is.EqualTo(13)); Assert.That(results[3].FragmentPics.Count(), Is.EqualTo(6)); }
public void DoesNotCrash_WithCompoundThatHasCrazyRingStructure() { var fragger = new MetFrag(Encoding.Default.GetString(Resources.Dihydrohydroxyciguatoxin)); fragger.metFrag(TestConfig.ExactMass, TestConfig.Peaks, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); }
public void MolecularFormulas_AreAsExpected() { var peaksToUse = @"218.292037963867 4814.0087890625 251.08984375 4636.91015625 255.294479370117 4333.99462890625 262.05908203125 4842.00537109375 263.503967285156 17012.8515625 316.170104980469 9390.609375 330.142669677734 5896.49560546875 336.126068115234 30484.8515625 388.176727294922 98447.6875 420.146850585938 30213.833984375 422.163482666016 35773.4296875 436.082305908203 5405.27880859375 445.210327148438 7284.78369140625 454.136291503906 138159.09375 485.711242675781 5883.47705078125 492.739959716797 4392.4541015625 671.27001953125 52046.59375 673.223999023438 13191.6015625 699.439758300781 7179.86279296875 708.473022460938 5404.1103515625 709.756103515625 4595.73779296875 746.69970703125 6625.22314453125 765.3642578125 12489.841796875 765.697509765625 18657.2578125 787.299255371094 11979.267578125 925.471130371094 5533.615234375 1001.71899414063 5344.462890625 1006.49475097656 43394.28515625 1006.99371337891 32465.154296875 1070.025390625 8782.123046875 1071.01171875 109050.328125 1071.51245117188 75879.2734375 1108.54565429688 21520.17578125 1108.66394042969 7866.89990234375 1109.04162597656 20998.587890625 1136.55224609375 10964.8427734375 1137.05126953125 8957.07421875 1137.54138183594 8071.50927734375 1201.56555175781 5949.6748046875 1216.61267089844 24844.447265625 1217.12524414063 23370.1796875 1217.60144042969 929436.875 1218.10131835938 1008759.75 1218.60095214844 140482.171875 1854.02758789063 11936.041015625 1941.10046386719 6494.98876953125 1942.84094238281 8874.51953125"; var fragger = new MetFrag(Encoding.Default.GetString(Resources.Digoxin)); var results = fragger.metFrag(TestConfig.ExactMass, peaksToUse, TestConfig.Mode, TestConfig.MzAbs, TestConfig.MzPpm, CancellationToken.None).ToList(); Assert.That(results.Count, Is.EqualTo(5)); // Note (Steve): These now only allow +/- 1 hydrogen (because the tree depth is always 1). CollectionAssert.AreEquivalent(results[0].FragmentPics.Select(p => Clean(p.MolecularFormula)), new[] { "C18H27O9", "C18H29O9", "C15H23O8" }); CollectionAssert.AreEquivalent(results[0].FragmentPics.Select(p => p.NeutralChange), new[] { "+H", "-H", "-H" }); CollectionAssert.AreEquivalent(results[1].FragmentPics.Select(p => Clean(p.MolecularFormula)), new[] { "C18H27O9", "C18H29O9", "C15H23O8" }); CollectionAssert.AreEquivalent(results[1].FragmentPics.Select(p => p.NeutralChange), new[] { "+H", "-H", "-H" }); CollectionAssert.AreEquivalent(results[2].FragmentPics.Select(p => Clean(p.MolecularFormula)), new[] { "C24H30NO7" }); CollectionAssert.AreEquivalent(results[2].FragmentPics.Select(p => p.NeutralChange), new[] { "+H" }); CollectionAssert.AreEquivalent(results[3].FragmentPics.Select(p => Clean(p.MolecularFormula)), new[] { "C21H32O10", "C15H23O8", "C10H14O8" }); CollectionAssert.AreEquivalent(results[3].FragmentPics.Select(p => p.NeutralChange), new[] { "+H", "-H", "" }); CollectionAssert.AreEquivalent(results[4].FragmentPics.Select(p => Clean(p.MolecularFormula)), new[] { "C35H57O18", "C35H56O18", "C28H47O18", "C22H29O6" }); CollectionAssert.AreEquivalent(results[4].FragmentPics.Select(p => p.NeutralChange), new[] { "", "+H", "", "-H" }); }