Пример #1
0
 private static void ValidateLibraryDocs(SrmDocument docTarget, SrmDocument docActual, LibraryManager libraryManager)
 {
     var docContainer = new TestDocumentContainer();
     libraryManager.Register(docContainer);
     try
     {
         AssertEx.IsDocumentState(docActual, 0, docTarget.PeptideGroupCount, docTarget.PeptideCount,
             docTarget.PeptideTransitionGroupCount, docTarget.PeptideTransitionCount);
         docActual = docActual.ChangeSettings(docActual.Settings.ConnectLibrarySpecs(FindLibrarySpec));
         Assert.IsTrue(docContainer.SetDocument(docActual, null, true));
         SrmDocument docLoaded = docContainer.Document;
         AssertEx.DocumentCloned(docTarget, docLoaded);
     //                Assert.IsTrue(ArrayUtil.ReferencesEqual(docActual.Transitions.ToArray(), docLoaded.Transitions.ToArray()));
     //                Assert.IsTrue(ArrayUtil.ReferencesEqual(docActual.TransitionGroups.ToArray(), docLoaded.TransitionGroups.ToArray()));
     //                Assert.IsTrue(ArrayUtil.ReferencesEqual(docActual.Peptides.ToArray(), docLoaded.Peptides.ToArray()));
         Assert.IsTrue(ArrayUtil.ReferencesEqual(docActual.Children, docLoaded.Children));
     }
     finally
     {
         libraryManager.Unregister(docContainer);
     }
 }
Пример #2
0
        private static SrmDocument CreateLibraryDocument(SrmSettings settings, string textFasta, bool peptideList,
            TestDocumentContainer docContainer, BackgroundLoader libraryManager, out int startRev)
        {
            startRev = 0;
            SrmDocument document = new SrmDocument(SrmSettingsList.GetDefault0_6());
            Assert.IsTrue(docContainer.SetDocument(document, null));

            // Register after first set document
            libraryManager.Register(docContainer);

            // Add libraries
            SrmDocument docLibraries = document.ChangeSettings(settings);
            ++startRev;

            // Add some FASTA
            IdentityPath path = IdentityPath.ROOT;
            SrmDocument docFasta = docLibraries.ImportFasta(new StringReader(textFasta), peptideList, path, out path);
            ++startRev;

            // Until libraries are loaded, only the sequences should appear
            if (!peptideList)
                AssertEx.IsDocumentState(docFasta, startRev, textFasta.Count(c => c == '>'), 0, 0);

            // Run the library load
            Assert.IsTrue(docContainer.SetDocument(docFasta, document, true));
            ++startRev;

            // After library load completes peptides and transitions should have expected library info
            SrmDocument docLoaded = docContainer.Document;

            // Check expected library inforamation
            foreach (var nodePeptide in docLoaded.Peptides)
                Assert.IsNull(nodePeptide.Rank);
            foreach (var nodeTran in docLoaded.PeptideTransitions)
            {
                Assert.IsTrue(nodeTran.HasLibInfo);
                Assert.IsTrue(nodeTran.LibInfo.Rank <= 3);
            }

            return docLoaded;
        }