Beispiel #1
0
        public void MultiLabelTypeListTest()
        {
            TestSmallMolecules = false; // we don't expect to roundtrip export/import of transition lists for non-proteomic molecules

            int         startRev = 0;
            SrmDocument document = new SrmDocument(SrmSettingsList.GetDefault().ChangeTransitionInstrument(inst => inst.ChangeMaxMz(1800)));

            // Add some FASTA
            IdentityPath path, pathRoot = IdentityPath.ROOT;
            SrmDocument  docFasta = document.ImportFasta(new StringReader(ExampleText.TEXT_FASTA_YEAST_LIB), false, pathRoot, out path);
            const int    initProt = 2, initPep = 26, initTran = 89;

            AssertEx.IsDocumentState(docFasta, ++startRev, initProt, initPep, initTran);

            // Add multiple heavy types
            var settings = docFasta.Settings.ChangePeptideModifications(mods => new PeptideModifications(mods.StaticModifications,
                                                                                                         new[]
            {
                new TypedModifications(LABEL_TYPE13_C, HEAVY_MODS_13_C),
                new TypedModifications(LABEL_TYPE15_N, HEAVY_MODS_15_N)
            }));
            var docMulti = docFasta.ChangeSettings(settings);

            // CONSIDER: make explicit S-Lens, cone voltage, CE etc roundtrip?
            // docMulti.MoleculeTransitionGroups.FirstOrDefault().ChangeExplicitValues(ExplicitTransitionGroupValues.TEST)


            // Make sure transition lists export to various formats and roundtrip
            VerifyExportRoundTrip(new ThermoMassListExporter(docMulti), docFasta);
            // Add Oxidation (M) as a static modification to challenge new mass list importing flexibility
            VerifyExportRoundTrip(new AbiMassListExporter(AddOxidationM(docMulti)), AddOxidationM(docFasta));
            VerifyExportRoundTrip(new AgilentMassListExporter(docMulti), docFasta);
            VerifyExportRoundTrip(new WatersMassListExporter(docMulti), docFasta);
        }
Beispiel #2
0
        protected override void DoTest()
        {
            var document   = new SrmDocument(SrmSettingsList.GetDefault());
            var staticMods = document.Settings.PeptideSettings.Modifications.StaticModifications.ToList();

            staticMods.Add(UniMod.GetModification("Phospho (ST)", true).ChangeVariable(true));
            var heavyMods = new List <StaticMod> {
                UniMod.GetModification("Label:13C(6)15N(4) (C-term R)", false)
            };

            document = document.ChangeSettings(document.Settings
                                               .ChangePeptideModifications(mods => mods.ChangeStaticModifications(staticMods)
                                                                           .ChangeModifications(IsotopeLabelType.heavy, heavyMods))
                                               .ChangeTransitionFilter(filt => filt.ChangePeptidePrecursorCharges(Adduct.ProtonatedFromCharges(2, 3, 4, 5))));
            Assert.IsTrue(SkylineWindow.SetDocument(document, SkylineWindow.Document));

            RunUI(() => SkylineWindow.Paste(TextUtil.LineSeparate(PEPTIDE_MODIFIED, PEPTIDE_UNMODIFIED)));
            document = WaitForDocumentChangeLoaded(document);
            RunUI(() => SkylineWindow.Paste(PEPTIDE_EXTRA));
            var docPaste1 = WaitForDocumentChangeLoaded(document);

            AssertEx.IsDocumentState(docPaste1, null, 2, 6, 44, 129);

            TestErrorMessages();
            TestUse();
        }
Beispiel #3
0
        public CommandLineUI(string[] args, CommandStatusWriter consoleOut)
        {
            _commandArgs = new CommandArgs(consoleOut, false);
            if (!_commandArgs.ParseArgs(args))
            {
                consoleOut.WriteLine(Resources.CommandLine_Run_Exiting___);
                return;
            }

            Program.UnitTest                = Program.FunctionalTest = true;
            Program.TestExceptions          = new List <Exception>();
            Program.NoSaveSettings          = true;
            Program.DisableJoining          = _commandArgs.ImportDisableJoining;
            Program.NoAllChromatogramsGraph = _commandArgs.NoAllChromatogramsGraph;
            Settings.Default.AutoShowAllChromatogramsGraph = !_commandArgs.HideAllChromatogramsGraph;
            LocalizationHelper.InitThread();

            // Run test in new thread (Skyline on main thread).
            Program.Init();
            Settings.Default.SrmSettingsList[0] = SrmSettingsList.GetDefault();
            // Reset defaults with names from resources for testing different languages
            Settings.Default.BackgroundProteomeList[0] = BackgroundProteomeList.GetDefault();
            Settings.Default.DeclusterPotentialList[0] = DeclusterPotentialList.GetDefault();
            Settings.Default.RetentionTimeList[0]      = RetentionTimeList.GetDefault();
            Settings.Default.ShowStartupForm           = false;

            var threadTest = new Thread(Run);

            LocalizationHelper.InitThread(threadTest);
            threadTest.Start();
            Program.Main();
            threadTest.Join();
        }
Beispiel #4
0
        public void TestAllColumnToolTipsAreLocalized()
        {
            var documentContainer = new MemoryDocumentContainer();

            Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document));
            SkylineDataSchema skylineDataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());
            var missingCaptions = new HashSet <ColumnCaption>();

            foreach (var columnDescriptor in
                     EnumerateAllColumnDescriptors(skylineDataSchema, STARTING_TYPES))
            {
                var invariantDescription = skylineDataSchema.GetColumnDescription(columnDescriptor);
                if (string.IsNullOrEmpty(invariantDescription))
                {
                    var invariantCaption = skylineDataSchema.GetColumnCaption(columnDescriptor) as ColumnCaption;
                    if (invariantCaption != null)
                    {
                        missingCaptions.Add(invariantCaption);
                    }
                }
            }
            if (missingCaptions.Count == 0)
            {
                return;
            }
            StringWriter message = new StringWriter();

            WriteResXFile(message, missingCaptions);
            Assert.Fail("Missing localized tooltips for column captions: {0}", message.ToString().Replace("<data", "\r\n<data"));
        }
Beispiel #5
0
        public void TestGenerateResxFile()
        {
            var documentContainer = new MemoryDocumentContainer();

            Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document));
            GenerateResXFile(new StringWriter() /* Console.Out */, new SkylineDataSchema(documentContainer, DataSchemaLocalizer.INVARIANT), STARTING_TYPES);
        }
Beispiel #6
0
        public void TestPermuteComplexIons()
        {
            var mainPeptide      = new Peptide("MERCURY");
            var srmSettings      = SrmSettingsList.GetDefault();
            var transitionFilter = srmSettings.TransitionSettings.Filter;

            transitionFilter = transitionFilter
                               .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name)
                               .ChangeFragmentRangeLastName(@"last ion")
                               .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b });
            srmSettings = srmSettings.ChangeTransitionSettings(
                srmSettings.TransitionSettings.ChangeFilter(transitionFilter));

            var transitionGroup           = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var crosslinkerDef            = new StaticMod("disulfide", "C", null, "-H2");
            var linkedPeptide             = new LinkedPeptide(new Peptide("ARSENIC"), 6, null);
            var crosslinkMod              = new ExplicitMod(3, crosslinkerDef).ChangeLinkedPeptide(linkedPeptide);
            var explicitModsWithCrosslink = new ExplicitMods(mainPeptide, new[] { crosslinkMod }, new TypedExplicitModifications[0]);
            var transitionGroupDocNode    = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings,
                                                                       explicitModsWithCrosslink, null, ExplicitTransitionGroupValues.EMPTY, null, null, false);
            var choices = transitionGroupDocNode.GetPrecursorChoices(srmSettings, explicitModsWithCrosslink, true)
                          .Cast <TransitionDocNode>().ToArray();
            var complexFragmentIons = choices.Select(transition => transition.ComplexFragmentIon.GetName()).ToArray();

            Assert.AreNotEqual(0, complexFragmentIons.Length);
        }
Beispiel #7
0
        public void TestAuditLogSerialization()
        {
            const int entryCount  = 20000;
            var       document    = new SrmDocument(SrmSettingsList.GetDefault());
            var       simpleEntry = AuditLogEntry.CreateSimpleEntry(document, MessageType.test_only, string.Empty);
            var       entries     = Enumerable.Range(0, entryCount).Select(index => simpleEntry).ToArray();

            Array.Reverse(entries);
            AuditLogEntry headEntry = null;

            foreach (var entry in entries)
            {
                if (headEntry == null)
                {
                    headEntry = entry;
                }
                else
                {
                    headEntry = entry.ChangeParent(headEntry);
                }
            }
            Assert.IsNotNull(headEntry);
            Assert.AreEqual(entryCount, headEntry.Count);
            Assert.AreEqual(headEntry.Count, headEntry.Enumerate().Count());
            var auditLogList       = new AuditLogList(headEntry);
            var serializedAuditLog = new StringWriter();
            var serializer         = new XmlSerializer(typeof(AuditLogList));

            serializer.Serialize(serializedAuditLog, auditLogList);
            var roundTrip = (AuditLogList)serializer.Deserialize(new StringReader(serializedAuditLog.ToString()));

            Assert.IsNotNull(roundTrip);
            Assert.AreEqual(auditLogList.AuditLogEntries.Count, roundTrip.AuditLogEntries.Count);
        }
Beispiel #8
0
        //[TestMethod]
        public void TestDdaSmall()
        {
            ChorusAccount TEST_ACCOUNT = new ChorusAccount("https://chorusproject.org", "*****@*****.**", "pwd");
            var           stream       = typeof(ChromTaskListTest).Assembly.GetManifestResourceStream(typeof(ChromTaskListTest),
                                                                                                      "DdaSmall.ChorusRequest.xml");

            Assert.IsNotNull(stream);
            var chromatogramRequest = (ChromatogramRequestDocument) new XmlSerializer(typeof(ChromatogramRequestDocument)).Deserialize(stream);
            var chromTaskList       = new ChromTaskList(() => { }, new SrmDocument(SrmSettingsList.GetDefault()), TEST_ACCOUNT,
                                                        TEST_ACCOUNT.GetChorusUrl().SetFileId(28836), ChromTaskList.ChunkChromatogramRequest(chromatogramRequest, 100));

            chromTaskList.SetMinimumSimultaneousTasks(10);
            var failedTasks = new HashSet <ChromatogramGeneratorTask>();

            foreach (var chromKey in chromTaskList.ChromKeys)
            {
                TimeIntensities timeIntensities;
                chromTaskList.GetChromatogram(chromKey, out timeIntensities);
                if (null == timeIntensities)
                {
                    var task = chromTaskList.GetGeneratorTask(chromKey);
                    if (failedTasks.Add(task))
                    {
                        var memoryStream = new MemoryStream();
                        var xmlWriter    = XmlWriter.Create(memoryStream, new XmlWriterSettings {
                            Encoding = Encoding.UTF8
                        });
                        new XmlSerializer(typeof(ChromatogramRequestDocument)).Serialize(xmlWriter, task.ChromatogramRequestDocument);
                        Console.Out.WriteLine("Failed to get data for {0}", Encoding.UTF8.GetString(memoryStream.ToArray()));
                    }
                }
            }
            Assert.AreEqual(0, failedTasks.Count);
        }
Beispiel #9
0
        public void TestAllColumnCaptionsAreLocalized()
        {
            var documentContainer = new MemoryDocumentContainer();

            Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document));
            SkylineDataSchema skylineDataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());
            var missingCaptions = new HashSet <ColumnCaption>();

            foreach (var columnDescriptor in
                     EnumerateAllColumnDescriptors(skylineDataSchema, STARTING_TYPES))
            {
                var invariantCaption = skylineDataSchema.GetColumnCaption(columnDescriptor) as ColumnCaption;
                if (invariantCaption != null && !skylineDataSchema.DataSchemaLocalizer.HasEntry(invariantCaption))
                {
                    missingCaptions.Add(invariantCaption);
                }
            }
            if (missingCaptions.Count == 0)
            {
                return;
            }
            StringWriter message = new StringWriter();

            WriteResXFile(message, missingCaptions);
            Assert.Fail("Missing localized column captions {0}", message);
        }
Beispiel #10
0
        public void TestCheckForUnusedColumnTooltips()
        {
            var documentContainer = new MemoryDocumentContainer();

            Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document));
            SkylineDataSchema dataSchema = new SkylineDataSchema(documentContainer, DataSchemaLocalizer.INVARIANT);
            var columnCaptions           = new HashSet <string>();
            var resourceManager          = ColumnToolTips.ResourceManager;
            var resourceSet = resourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, true);
            var enumerator  = resourceSet.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string key = enumerator.Key as string;
                if (null != key)
                {
                    columnCaptions.Add(key);
                }
            }
            foreach (var columnDescriptor in EnumerateAllColumnDescriptors(dataSchema, STARTING_TYPES))
            {
                var invariantCaption = dataSchema.GetColumnCaption(columnDescriptor);
                columnCaptions.Remove(invariantCaption.GetCaption(DataSchemaLocalizer.INVARIANT));
            }
            var unusedCaptions = columnCaptions.ToArray();

            Assert.AreEqual(0, unusedCaptions.Length, "Unused entries found in ColumnToolTips.resx: {0}", string.Join(",", unusedCaptions));
        }
Beispiel #11
0
 private void PrepareDocument(string documentFile)
 {
     RunUI(SkylineWindow.NewDocument);
     RunUI(() => SkylineWindow.ModifyDocument("Set default settings",
                                              doc => doc.ChangeSettings(SrmSettingsList.GetDefault())));
     RunUI(() => SkylineWindow.SaveDocument(GetTestPath(documentFile)));
 }
        public void TestThermoDIAChunked()
        {
            if (!RunPerfTests)
            {
                return; // PerfTests only run when the global "allow perf tests" flag is set
            }
            var xmlSerializer = new XmlSerializer(typeof(ChromatogramRequestDocument));
            var stream        = typeof(PerfChorusGenerateChromatograms).Assembly.GetManifestResourceStream(
                typeof(PerfChorusGenerateChromatograms), "ThermoDIA.ChorusRequest.xml");

            Assert.IsNotNull(stream);
            var chromatogramRequestDocument = (ChromatogramRequestDocument)xmlSerializer.Deserialize(stream);
            var chorusUrl   = TEST_ACCOUNT.GetChorusUrl().SetFileId(28836);
            var srmDocument = new SrmDocument(SrmSettingsList.GetDefault());

            foreach (int chunkChromatogramCount in new[] { 50, 100, 150, 200, 300 })
            {
                ChromTaskList chromTaskList = new ChromTaskList(() => { }, srmDocument, TEST_ACCOUNT, chorusUrl, ChromTaskList.ChunkChromatogramRequest(chromatogramRequestDocument, chunkChromatogramCount));
                chromTaskList.SetMinimumSimultaneousTasks(30);
                DateTime startTime = DateTime.Now;
                while (chromTaskList.PercentComplete < 100)
                {
                    Thread.Sleep(100);
                }
                DateTime endTime = DateTime.Now;
                Assert.AreEqual(0, chromTaskList.ListExceptions().Count);
                Console.Out.WriteLine("*******************************************");
                Console.Out.WriteLine("Chromatograms per chunk: {0}", chunkChromatogramCount);
                Console.Out.WriteLine("Number of chunks: {0}", chromTaskList.TaskCount);
                Console.Out.WriteLine("Elapsed time {0}", endTime.Subtract(startTime));
                Console.Out.WriteLine("*******************************************");
            }
        }
Beispiel #13
0
        public void TestAuditLogRef()
        {
            const string TEST_PREFIX      = "test";
            const int    TEST_ENTRY_COUNT = 3;
            var          document         = new SrmDocument(SrmSettingsList.GetDefault());

            Assert.IsTrue(document.AuditLog.AuditLogEntries.IsRoot);
            Assert.AreEqual(0, AuditLogEntryRef.PROTOTYPE.ListChildrenOfParent(document).Count());
            AuditLogEntry headEntry = document.AuditLog.AuditLogEntries;

            for (int i = 0; i < TEST_ENTRY_COUNT; i++)
            {
                var auditLogEntry = AuditLogEntry.CreateTestOnlyEntry(DateTime.UtcNow, SrmDocument.DOCUMENT_TYPE.mixed, TEST_PREFIX + i);
                headEntry = auditLogEntry.ChangeParent(headEntry);
            }
            Assert.IsNotNull(headEntry);
            Assert.AreEqual(TEST_ENTRY_COUNT, headEntry.Count);
            document = document.ChangeAuditLog(headEntry);
            var auditLogRefs = AuditLogEntryRef.PROTOTYPE.ListChildrenOfParent(document).Cast <AuditLogEntryRef>().ToList();

            Assert.AreEqual(TEST_ENTRY_COUNT, auditLogRefs.Count);
            var extraLogEntry = AuditLogEntry
                                .CreateTestOnlyEntry(DateTime.UtcNow, SrmDocument.DOCUMENT_TYPE.mixed, "extra entry")
                                .ChangeParent(document.AuditLog.AuditLogEntries);
            var document2 = document.ChangeAuditLog(extraLogEntry);

            Assert.AreEqual(TEST_ENTRY_COUNT + 1, AuditLogEntryRef.PROTOTYPE.ListChildrenOfParent(document2).Count());
            foreach (var auditLogRef in auditLogRefs)
            {
                var entry1 = auditLogRef.FindAuditLogEntry(document);
                var entry2 = auditLogRef.FindAuditLogEntry(document2);
                Assert.AreEqual(entry1, entry2);
            }
        }
Beispiel #14
0
        public void LibraryNoIonsTest()
        {
            var streamManager = new MemoryStreamManager();
            var loader        = new LibraryLoadTest.TestLibraryLoader {
                StreamManager = streamManager
            };

            // Create X! Hunter library with 20 lowest intensity peaks in NIST library
            LibraryLoadTest.CreateHunterFile(streamManager, loader, LibraryLoadTest.TEXT_LIB_YEAST_NIST, true);

            var hunterSpec = new XHunterLibSpec("Yeast (X!)", LibraryLoadTest.PATH_HUNTER_LIB);

            // For serialization, add the library spec to the settings
            TestLibraryList = new SpectralLibraryList {
                hunterSpec
            };

            var libraryManager = new LibraryManager {
                StreamManager = streamManager
            };
            var docContainer = new TestDocumentContainer();

            SrmSettings settings = SrmSettingsList.GetDefault();

            settings = settings.ChangePeptideLibraries(l => l.ChangeLibrarySpecs(new LibrarySpec[] { hunterSpec }));

            int         startRev;
            SrmDocument docLoaded = CreateLibraryDocument(settings, ExampleText.TEXT_FASTA_YEAST_LIB, false,
                                                          docContainer, libraryManager, out startRev);

            // Peptides should have been chosen, but no transitions, since the spectra are garbage
            AssertEx.IsDocumentState(docLoaded, startRev, 2, 4, 0);
        }
Beispiel #15
0
        public void TestCrosslinkGetNeutralFormula()
        {
            var mainPeptide = new Peptide("MERCURY");
            var srmSettings = SrmSettingsList.GetDefault();

            srmSettings = srmSettings.ChangePeptideSettings(
                srmSettings.PeptideSettings.ChangeModifications(srmSettings.PeptideSettings.Modifications
                                                                .ChangeStaticModifications(new StaticMod[0])));
            var transitionGroup            = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var mainTransitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings,
                                                                        null, null, ExplicitTransitionGroupValues.EMPTY, null, null, false);
            var unlinkedFormula = mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, null);

            Assert.AreEqual("C37H61N13O11S2Se", unlinkedFormula.ToString());

            var linkedPeptide = new LinkedPeptide(new Peptide("ARSENIC"), 2, null);

            var linkedPeptideFormula = linkedPeptide.GetNeutralFormula(srmSettings, IsotopeLabelType.light);

            Assert.AreEqual("C30H53N11O12S", linkedPeptideFormula.ToString());
            var crosslinkMod = new StaticMod("disulfide", null, null, "-H2");


            var explicitModsWithCrosslink = new ExplicitMods(mainPeptide,
                                                             new[] { new ExplicitMod(3, crosslinkMod).ChangeLinkedPeptide(linkedPeptide) },
                                                             new TypedExplicitModifications[0]);
            var crosslinkedFormula =
                mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, explicitModsWithCrosslink);

            Assert.AreEqual("C67H112N24O23S3Se", crosslinkedFormula.Molecule.ToString());
        }
Beispiel #16
0
        public void TestSingleAminoAcidLinkedPeptide()
        {
            var srmSettings                = SrmSettingsList.GetDefault();
            var mainPeptide                = new Peptide("A");
            var staticMod                  = new StaticMod("crosslinker", null, null, "-C2");
            var linkedPeptide              = new LinkedPeptide(new Peptide("D"), 0, null);
            var mainTransitionGroup        = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var mainTransitionGroupDocNode = new TransitionGroupDocNode(mainTransitionGroup,
                                                                        Annotations.EMPTY, srmSettings, null, null,
                                                                        ExplicitTransitionGroupValues.EMPTY, null, new TransitionDocNode[0], false);
            var modsWithoutLinkedPeptide = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(0, staticMod), }, new TypedExplicitModifications[0]);

            Assert.AreEqual("C3H7NO2", AminoAcidFormulas.Default.GetFormula("A").ToString());
            Assert.AreEqual("C3H7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, null).Molecule.ToString());
            Assert.AreEqual("CH7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithoutLinkedPeptide).Molecule.ToString());
            Assert.AreEqual("C4H7NO4", AminoAcidFormulas.Default.GetFormula("D").ToString());
            var modsWithLinkedPeptide = new ExplicitMods(mainPeptide,
                                                         new[] { new ExplicitMod(0, staticMod).ChangeLinkedPeptide(linkedPeptide) },
                                                         new TypedExplicitModifications[0]);

            Assert.AreEqual("C5H14N2O6", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithLinkedPeptide).Molecule.ToString());
            var mainComplexFragmentIon   = new ComplexFragmentIon(new Transition(mainTransitionGroup, IonType.precursor, mainPeptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, modsWithLinkedPeptide.Crosslinks);
            var linkedComplexFragmentIon = new ComplexFragmentIon(
                new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED),
                               IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE);
            var complexFragmentIon =
                mainComplexFragmentIon.AddChild(new ModificationSite(0, staticMod.Name), linkedComplexFragmentIon);
            var transition       = complexFragmentIon.MakeTransitionDocNode(srmSettings, modsWithLinkedPeptide, null);
            var sequenceMassCalc = new SequenceMassCalc(MassType.Monoisotopic);
            var expectedMz       = sequenceMassCalc.GetPrecursorMass("A") + sequenceMassCalc.GetPrecursorMass("D") - 24 - BioMassCalc.MassProton;

            Assert.AreEqual(expectedMz, transition.Mz, .00001);
        }
Beispiel #17
0
        public void SpecialFragmentTest()
        {
            var          docOriginal = new SrmDocument(SrmSettingsList.GetDefault());
            IdentityPath path;
            var          docPeptide = docOriginal.ImportFasta(new StringReader(">peptide1\nPEPMCIDEPR"),
                                                              true, IdentityPath.ROOT, out path);

            // One of the prolines should have caused an extra transition
            Assert.AreEqual(4, docPeptide.PeptideTransitionCount);
            Assert.IsTrue(docPeptide.PeptideTransitions.Contains(nodeTran => nodeTran.Transition.Ordinal == 8)); // y8

            // Switch to the legacy version of the proline fragment where min length is 1
            var docLegacyProline = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter =>
                                                                                                        filter.ChangeMeasuredIons(new[] { MeasuredIonList.NTERM_PROLINE_LEGACY })));

            Assert.AreEqual(5, docLegacyProline.PeptideTransitionCount);
            // Allow b-ions
            var docLegacyProlineB = docLegacyProline.ChangeSettings(docLegacyProline.Settings.ChangeTransitionFilter(filter =>
                                                                                                                     filter.ChangePeptideIonTypes(new[] { IonType.b, IonType.y })));

            Assert.AreEqual(9, docLegacyProlineB.PeptideTransitionCount);

            // Add C-terminal Glu and Asp to the original peptide document
            var docGluAsp = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter =>
                                                                                                 filter.ChangeMeasuredIons(new List <MeasuredIon>(filter.MeasuredIons)
            {
                MeasuredIonList.CTERM_GLU_ASP
            })));

            Assert.AreEqual(5, docGluAsp.PeptideTransitionCount);
            Assert.IsTrue(docGluAsp.PeptideTransitions.Contains(nodeTran => nodeTran.Transition.Ordinal == 3)); // y3

            // Use the legacy version instead
            var docGluAspLegacy = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter =>
                                                                                                       filter.ChangeMeasuredIons(new List <MeasuredIon>(filter.MeasuredIons)
            {
                MeasuredIonList.CTERM_GLU_ASP_LEGACY
            })));

            Assert.AreEqual(6, docGluAspLegacy.PeptideTransitionCount);
            Assert.IsTrue(docGluAspLegacy.PeptideTransitions.Contains(nodeTran => nodeTran.Transition.Ordinal == 2)); // y2

            // Add Proline to the C-terminal modification
            var docGluAspPro = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter =>
                                                                                                    filter.ChangeMeasuredIons(new[] { new MeasuredIon("C-term GAP", "EDP", null, SequenceTerminus.C, 1) })));

            Assert.AreEqual(8, docGluAspPro.PeptideTransitionCount);
            Assert.IsTrue(docGluAspPro.PeptideTransitions.Contains(nodeTran =>
                                                                   nodeTran.Transition.Ordinal == 2 || // y2
                                                                   nodeTran.Transition.Ordinal == 8)); // y8

            // Restrict
            var docGluAspProRestrict = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter =>
                                                                                                            filter.ChangeMeasuredIons(new[] { new MeasuredIon("C-term GAP", "EDP", "P", SequenceTerminus.C, 1) })));

            Assert.AreEqual(6, docGluAspProRestrict.PeptideTransitionCount);
            Assert.IsFalse(docGluAspProRestrict.PeptideTransitions.Contains(nodeTran =>
                                                                            nodeTran.Transition.Ordinal == 2 || // not y2
                                                                            nodeTran.Transition.Ordinal == 8)); // not y8
        }
Beispiel #18
0
        public void TestLooplinkCrosslinkLibraryKey()
        {
            var crosslinkLibraryKey = new CrosslinkLibraryKey(new [] { new PeptideLibraryKey("AKIQDKEGIPPDQQR", 0) }, new[] { new CrosslinkLibraryKey.Crosslink("+138.0681", new[] { new [] { 2, 6 } }) }, 3);
            var srmSettings         = SrmSettingsList.GetDefault();

            srmSettings = srmSettings.ChangePeptideSettings(
                srmSettings.PeptideSettings.ChangeModifications(srmSettings.PeptideSettings.Modifications
                                                                .ChangeStaticModifications(
                                                                    srmSettings.PeptideSettings.Modifications.StaticModifications
                                                                    .Append(new StaticMod("DSS", "K", null, "C8H10O2").ChangeCrosslinkerSettings(
                                                                                CrosslinkerSettings.EMPTY)).ToList()
                                                                    )));
            var libKeyModificationMatcher = new LibKeyModificationMatcher();

            libKeyModificationMatcher.CreateMatches(srmSettings, new[] { new LibKey(crosslinkLibraryKey) },
                                                    new MappedList <string, StaticMod>(), new MappedList <string, StaticMod>());

            var peptideDocNode = libKeyModificationMatcher.CreateDocNodeFromSettings(new LibKey(crosslinkLibraryKey),
                                                                                     new Peptide("AKIQDKEGIPPDQQR"), SrmSettingsDiff.ALL, out _);

            Assert.IsNotNull(peptideDocNode);
            Assert.IsNotNull(peptideDocNode.ExplicitMods);
            Assert.AreEqual(1, peptideDocNode.ExplicitMods.Crosslinks.Count);
            Assert.AreEqual(null, peptideDocNode.ExplicitMods.Crosslinks[0].Value.Peptide);
        }
Beispiel #19
0
        public void TestComplexIonMz()
        {
            var srmSettings      = SrmSettingsList.GetDefault();
            var peptide          = new Peptide("DLGEEHFKGLVLIAFSQYLQQCPFDEHVK");
            var linkedPeptide    = new LinkedPeptide(new Peptide("LVNELTEFAKTCVADESHAGCEK"), 9, null);
            var transitionGroup  = new TransitionGroup(peptide, Adduct.QUADRUPLY_PROTONATED, IsotopeLabelType.light);
            var crosslinkMod     = new StaticMod("linker", "K", null, "C8H10O2");
            var explicitMod      = new ExplicitMod(7, crosslinkMod).ChangeLinkedPeptide(linkedPeptide);
            var explicitMods     = new ExplicitMods(peptide, new[] { explicitMod }, new List <TypedExplicitModifications>());
            var linkedTransition =
                new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED),
                               IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED);
            var expectedMzs = new[]
            {
                Tuple.Create(IonType.b, 2, 1, 229.1183),
                Tuple.Create(IonType.b, 10, 3, 1291.2766)
            };

            foreach (var tuple in expectedMzs)
            {
                int offset             = Transition.OrdinalToOffset(tuple.Item1, tuple.Item2, peptide.Sequence.Length);
                var transition         = new Transition(transitionGroup, tuple.Item1, offset, 0, Adduct.FromChargeProtonated(tuple.Item3));
                var complexFragmentIon = new ComplexFragmentIon(transition, null, explicitMods.Crosslinks);
                if (complexFragmentIon.IncludesAaIndex(explicitMod.IndexAA))
                {
                    complexFragmentIon = complexFragmentIon.AddChild(explicitMod.ModificationSite,
                                                                     new ComplexFragmentIon(linkedTransition, null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE));
                }
                var complexTransitionDocNode = complexFragmentIon.MakeTransitionDocNode(srmSettings, explicitMods, null);
                Assert.AreEqual(tuple.Item4, complexTransitionDocNode.Mz, .0001, "{0}{1}{2}", tuple.Item1, tuple.Item2,
                                Transition.GetChargeIndicator(Adduct.FromChargeProtonated(tuple.Item3)));
            }
        }
Beispiel #20
0
        public void TestCrosslinkModSerialization()
        {
            var settings       = SrmSettingsList.GetDefault();
            var crosslinkerDef = new StaticMod("disulfide", null, null, "-H2")
                                 .ChangeCrosslinkerSettings(CrosslinkerSettings.EMPTY);

            settings = settings.ChangePeptideSettings(settings.PeptideSettings.ChangeModifications(
                                                          settings.PeptideSettings.Modifications.ChangeStaticModifications(new[] { crosslinkerDef })));
            settings = settings.ChangeTransitionSettings(settings.TransitionSettings.ChangeFilter(
                                                             settings.TransitionSettings.Filter
                                                             .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name)
                                                             .ChangeFragmentRangeLastName(@"last ion")
                                                             .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b })
                                                             )); var mainPeptide = new Peptide("MERCURY");
            var transitionGroup           = new TransitionGroup(mainPeptide, Adduct.DOUBLY_PROTONATED, IsotopeLabelType.light);
            var linkedPeptide             = new LinkedPeptide(new Peptide("ARSENIC"), 2, null);
            var crosslinkMod              = new ExplicitMod(3, crosslinkerDef).ChangeLinkedPeptide(linkedPeptide);
            var explicitModsWithCrosslink = new ExplicitMods(mainPeptide, new[] { crosslinkMod }, new TypedExplicitModifications[0]);
            var transitionGroupDocNode    = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, settings,
                                                                       explicitModsWithCrosslink, null, ExplicitTransitionGroupValues.EMPTY, null, null, true);

            var peptideDocNode = new PeptideDocNode(mainPeptide, settings, explicitModsWithCrosslink, null, ExplicitRetentionTimeInfo.EMPTY, new [] { transitionGroupDocNode }, false);

            peptideDocNode = peptideDocNode.ChangeSettings(settings, SrmSettingsDiff.ALL);
            Assert.AreNotEqual(0, peptideDocNode.TransitionCount);
            var peptideGroupDocNode = new PeptideGroupDocNode(new PeptideGroup(), Annotations.EMPTY, "Peptides", null, new [] { peptideDocNode });
            var srmDocument         = (SrmDocument) new SrmDocument(settings).ChangeChildren(new[] { peptideGroupDocNode });

            AssertEx.Serializable(srmDocument);
            string docXML = null;

            AssertEx.RoundTrip(srmDocument, ref docXML);
            Assert.IsNotNull(docXML);
        }
 public void Initialize(ImportPeptideSearchDlg.Workflow workflow)
 {
     if (workflow != ImportPeptideSearchDlg.Workflow.dia)
     {
         int offset = lblTolerance.Top - cbExclusionUseDIAWindow.Top;
         Array.ForEach(new Control[] { lblTolerance, txtTolerance, lblToleranceUnits, lblIonCount, txtIonCount, lblIonCountUnits }, c => c.Top -= offset);
         cbExclusionUseDIAWindow.Hide();
     }
     // If these are just the document defaults, use something more appropriate for DIA
     else
     {
         var settingsCurrent = _documentContainer.Document.Settings.TransitionSettings;
         var settings        = settingsCurrent;
         var defSettings     = SrmSettingsList.GetDefault().TransitionSettings;
         if (Equals(settings.Filter, defSettings.Filter))
         {
             settings = settings.ChangeFilter(settings.Filter
                                              .ChangePeptidePrecursorCharges(new[] { Adduct.DOUBLY_PROTONATED, Adduct.TRIPLY_PROTONATED })
                                              .ChangePeptideProductCharges(new[] { Adduct.SINGLY_PROTONATED, Adduct.DOUBLY_PROTONATED })
                                              .ChangePeptideIonTypes(new[] { IonType.y, IonType.b, IonType.precursor }));
         }
         if (Equals(settings.Libraries, defSettings.Libraries))
         {
             settings = settings.ChangeLibraries(settings.Libraries.ChangeIonMatchTolerance(0.05)
                                                 .ChangeIonCount(6)
                                                 .ChangeMinIonCount(6));
         }
         if (!ReferenceEquals(settings, settingsCurrent))
         {
             SetFields(settings);
         }
     }
 }
Beispiel #22
0
        public void TestComplexIonGetNeutralFormula()
        {
            var srmSettings         = SrmSettingsList.GetDefault();
            var fullTransitionGroup = new TransitionGroupDocNode(
                new TransitionGroup(new Peptide("ELVIS"), Adduct.SINGLY_PROTONATED, IsotopeLabelType.light),
                Annotations.EMPTY, srmSettings, null, null, ExplicitTransitionGroupValues.EMPTY,
                null, null, false);
            var fullFormula = fullTransitionGroup.GetNeutralFormula(srmSettings, null);

            Assert.AreEqual("C25H45N5O9", fullFormula.Molecule.ToString());

            var hydrolysisDef = new StaticMod("hydrolysis", null, ModTerminus.C, "-H2O")
                                .ChangeCrosslinkerSettings(CrosslinkerSettings.EMPTY);
            var crossLinkMod = new ExplicitMod(1, hydrolysisDef)
                               .ChangeLinkedPeptide(new LinkedPeptide(new Peptide("VIS"), 0, null));
            var mainPeptide         = new Peptide("EL");
            var explicitMods        = new ExplicitMods(mainPeptide, new[] { crossLinkMod }, new TypedExplicitModifications[0]);
            var mainTransitionGroup = new TransitionGroupDocNode(
                new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light),
                Annotations.EMPTY, srmSettings,
                explicitMods, null,
                ExplicitTransitionGroupValues.EMPTY,
                null, null, false);
            var mainFullFormula = mainTransitionGroup.GetNeutralFormula(srmSettings, explicitMods);

            Assert.AreEqual(fullFormula, mainFullFormula);
        }
Beispiel #23
0
        public void NeutralLossListTest()
        {
            TestSmallMolecules = false; // No concept of neutral loss for small molecules

            var phosphoLossMod = new StaticMod("Phospho Loss", "S, T, Y", null, false, "HPO3",
                                               LabelAtoms.None, RelativeRT.Matching, null, null, new[] { new FragmentLoss("H3PO4"), });

            SrmDocument document = new SrmDocument(SrmSettingsList.GetDefault().ChangePeptideModifications(mods =>
                                                                                                           mods.ChangeStaticModifications(new List <StaticMod>(mods.StaticModifications)
            {
                phosphoLossMod
            })));
            IdentityPath path     = IdentityPath.ROOT;
            SrmDocument  docFasta = document.ImportFasta(new StringReader(TEXT_FASTA_YEAST_7), false, path, out path);

            Assert.AreEqual(0, GetLossCount(docFasta, 1));

            // Insert losses into the first transition group
            var pathPeptide  = docFasta.GetPathTo((int)SrmDocument.Level.Molecules, 0);
            var nodePep      = (PeptideDocNode)docFasta.FindNode(pathPeptide);
            var nodeGroup    = (TransitionGroupDocNode)nodePep.Children[0];
            var listChildren = new List <DocNode>(nodeGroup.Children);

            foreach (var nodeTran in nodeGroup.GetTransitions(docFasta.Settings,
                                                              nodePep.ExplicitMods, nodeGroup.PrecursorMz, null, null, null, false))
            {
                if (!nodeTran.HasLoss)
                {
                    continue;
                }

                var tran       = nodeTran.Transition;
                int matchIndex = listChildren.IndexOf(node =>
                                                      Equals(tran, ((TransitionDocNode)node).Transition));
                if (matchIndex == -1)
                {
                    continue;
                }

                while (matchIndex < listChildren.Count &&
                       Equals(tran, ((TransitionDocNode)listChildren[matchIndex]).Transition))
                {
                    matchIndex++;
                }
                listChildren.Insert(matchIndex, nodeTran);
            }

            var docLosses = (SrmDocument)docFasta.ReplaceChild(pathPeptide,
                                                               nodeGroup.ChangeChildren(listChildren));

            int lossCount = GetLossCount(docLosses, 1);

            Assert.IsTrue(lossCount > 0);
            var docRoundTripped = AssertEx.RoundTripTransitionList(new ThermoMassListExporter(docLosses));

            Assert.AreEqual(lossCount, GetLossCount(docRoundTripped, 1));
            docRoundTripped = AssertEx.RoundTripTransitionList(new AgilentMassListExporter(docLosses));
            Assert.AreEqual(lossCount, GetLossCount(docRoundTripped, 1));
        }
Beispiel #24
0
            public static BrowsingDataSchema GetBrowsingDataSchema()
            {
                var memoryDocumentContainer = new MemoryDocumentContainer();
                var document = new SrmDocument(SrmSettingsList.GetDefault());

                memoryDocumentContainer.SetDocument(document, memoryDocumentContainer.Document);
                return(new BrowsingDataSchema(memoryDocumentContainer, GetLocalizedSchemaLocalizer()));
            }
Beispiel #25
0
        public override void Dispose()
        {
            base.Dispose();

            var docEmpty = new SrmDocument(SrmSettingsList.GetDefault());

            Assert.IsTrue(SetDocument(docEmpty, Document));
        }
Beispiel #26
0
        private SkylineDataSchema GetDataSchema()
        {
            var document  = new SrmDocument(SrmSettingsList.GetDefault());
            var container = new MemoryDocumentContainer();

            Assert.IsTrue(container.SetDocument(document, container.Document));
            return(new SkylineDataSchema(container, DataSchemaLocalizer.INVARIANT));
        }
Beispiel #27
0
        public void MultiLabelExplicitSerialTest()
        {
            // Create a simple document and add two peptides
            SrmDocument  document     = new SrmDocument(SrmSettingsList.GetDefault());
            const string pepSequence1 = "QFVLSCVILR";
            const string pepSequence2 = "DIEVYCDGAITTK";
            var          reader       = new StringReader(string.Join("\n", new[] { ">peptides1", pepSequence1, pepSequence2 }));
            IdentityPath path;

            document = document.ImportFasta(reader, true, IdentityPath.ROOT, out path);
            Assert.AreEqual(2, document.PeptideCount);

            // Add some modifications in two new label types
            var modCarb      = new StaticMod("Carbamidomethyl Cysteine", "C", null, "C2H3ON");
            var modOther     = new StaticMod("Another Cysteine", "C", null, "CO8N2");
            var staticMods   = new[] { modCarb, modOther };
            var mod15N       = new StaticMod("All 15N", null, null, null, LabelAtoms.N15, null, null);
            var modK13C      = new StaticMod("13C K", "K", ModTerminus.C, null, LabelAtoms.C13, null, null);
            var modR13C      = new StaticMod("13C R", "R", ModTerminus.C, null, LabelAtoms.C13, null, null);
            var modV13C      = new StaticMod("Heavy V", "V", null, null, LabelAtoms.C13 | LabelAtoms.N15, null, null);
            var heavyMods    = new[] { mod15N, modK13C, modR13C, modV13C };
            var labelTypeAA  = new IsotopeLabelType("heavy AA", IsotopeLabelType.FirstHeavy);
            var labelTypeAll = new IsotopeLabelType("heavy All", IsotopeLabelType.FirstHeavy + 1);

            var settings = document.Settings;

            settings = settings.ChangePeptideModifications(mods =>
                                                           new PeptideModifications(mods.StaticModifications,
                                                                                    new[]
            {
                new TypedModifications(labelTypeAA, new[] { modK13C, modR13C }),
                new TypedModifications(labelTypeAll, new[] { mod15N })
            }));
            document = document.ChangeSettings(settings);
            Assert.AreEqual(6, document.PeptideTransitionGroupCount);

            // Add modifications to light and heavy AA in the first peptide
            path = document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
            var nodePepMod  = (PeptideDocNode)document.FindNode(path);
            var explicitMod = new ExplicitMods(nodePepMod.Peptide,
                                               new[] { new ExplicitMod(pepSequence1.IndexOf('C'), modOther) },
                                               new[] { new TypedExplicitModifications(nodePepMod.Peptide, labelTypeAA, new ExplicitMod[0]) });

            document = document.ChangePeptideMods(path, explicitMod, staticMods, heavyMods);
            Assert.AreEqual(5, document.PeptideTransitionGroupCount);

            // Add a modification to heavy All in the second peptide
            path        = document.GetPathTo((int)SrmDocument.Level.Molecules, 1);
            nodePepMod  = (PeptideDocNode)document.FindNode(path);
            explicitMod = new ExplicitMods(nodePepMod.Peptide, null,
                                           new[] { new TypedExplicitModifications(nodePepMod.Peptide, labelTypeAll,
                                                                                  new[] { new ExplicitMod(pepSequence2.IndexOf('V'), modV13C) }) });
            document = document.ChangePeptideMods(path, explicitMod, staticMods, heavyMods);
            Assert.AreEqual(5, document.PeptideTransitionGroupCount);

            AssertEx.Serializable(document, 3, AssertEx.DocumentCloned);
        }
Beispiel #28
0
        public IEnumerable <SkylineDataSchema> EnumerateDataSchemas()
        {
            var documentContainer = new MemoryDocumentContainer();

            Assert.IsTrue(documentContainer.SetDocument(new SrmDocument(SrmSettingsList.GetDefault()), documentContainer.Document));
            var dataSchema = new SkylineDataSchema(documentContainer, SkylineDataSchema.GetLocalizedSchemaLocalizer());

            yield return(dataSchema);
        }
Beispiel #29
0
        public void TestTransitionGroupDocNodeGetNeutralFormula()
        {
            var peptide                = new Peptide("PEPTIDE");
            var transitionGroup        = new TransitionGroup(peptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light);
            var srmSettings            = SrmSettingsList.GetDefault();
            var transitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings, null, null, ExplicitTransitionGroupValues.EMPTY, null, null, false);
            var moleculeOffset         = transitionGroupDocNode.GetNeutralFormula(srmSettings, null);

            Assert.AreEqual("C34H53N7O15", moleculeOffset.Molecule.ToString());
        }
Beispiel #30
0
        public void DynamicMinMzTest()
        {
            var revisionIndex = 1;
            var settings      = SrmSettingsList.GetDefault().ChangeTransitionFilter(filter =>
                                                                                    filter.ChangePeptideIonTypes(new[] { IonType.y, IonType.b })
                                                                                    .ChangeFragmentRangeFirstName("ion 1")
                                                                                    .ChangeFragmentRangeLastName("last ion"));
            var          docOriginal = new SrmDocument(settings);
            IdentityPath path;
            var          docPeptides = docOriginal.ImportFasta(new StringReader(">peptides\nESTIGNSAFELLLEVAK\nTVYHAGTK"),
                                                               true, IdentityPath.ROOT, out path);

            AssertEx.IsDocumentState(docPeptides, revisionIndex++, 1, 2, 2, 40);
            // Both precursors should contain 1 and 2 ions
            foreach (var nodeGroup in docPeptides.PeptideTransitionGroups)
            {
                Assert.IsTrue(nodeGroup.Children.Contains(node => ((TransitionDocNode)node).Transition.Ordinal == 1));
                Assert.IsTrue(nodeGroup.Children.Contains(node => ((TransitionDocNode)node).Transition.Ordinal == 2));
            }

            // Switch to using dynamic minimum for product ions
            settings = settings.ChangeTransitionInstrument(instrument => instrument.ChangeIsDynamicMin(true));
            var docDynamicMin = docPeptides.ChangeSettings(settings);

            AssertEx.IsDocumentState(docDynamicMin, revisionIndex++, 1, 2, 35);
            var arrayNodeGroups = docDynamicMin.PeptideTransitionGroups.ToArray();

            // The larger precursor should no longer have 1 or 2 ions
            Assert.IsFalse(arrayNodeGroups[0].Children.Contains(node =>
                                                                ((TransitionDocNode)node).Transition.Ordinal == 1 ||
                                                                ((TransitionDocNode)node).Transition.Ordinal == 2));
            // But the smaller precursor should retain at least one of both
            Assert.IsTrue(arrayNodeGroups[1].Children.Contains(node => ((TransitionDocNode)node).Transition.Ordinal == 1));
            Assert.IsTrue(arrayNodeGroups[1].Children.Contains(node => ((TransitionDocNode)node).Transition.Ordinal == 2));

            // Use a minimum that is high enough to exclude the smaller precursor
            settings = settings.ChangeTransitionInstrument(instrument => instrument.ChangeMinMz(500));
            var docHighMinDynamicMz = docDynamicMin.ChangeSettings(settings);

            AssertEx.IsDocumentState(docHighMinDynamicMz, revisionIndex++, 1, 2, 1, 22);
            // Because of the dynamic minimum for product ions, the remaining precursor should not have changed
            var nodeGroupHigh = docHighMinDynamicMz.PeptideTransitionGroups.ToArray()[0];

            Assert.AreSame(arrayNodeGroups[0], nodeGroupHigh);

            // Remove dynamic minimum, and verify that product ions are removed
            settings = settings.ChangeTransitionInstrument(instrument => instrument.ChangeIsDynamicMin(false));
            var docHighMinMz = docHighMinDynamicMz.ChangeSettings(settings);

            AssertEx.IsDocumentState(docHighMinMz, revisionIndex, 1, 2, 1, 17);

            // No library test, because it is hard to test.  Many of the library
            // spectra are likely gathered with LTQs which apply the same dynamic
            // minimum to the ms/ms peaks they measure.
        }