@@ -222,10 +222,9 @@ protected override MyResults RunSpecific()
222222 lp . Add ( ProductType . Y ) ;
223223
224224 Status ( "Loading proteins..." ) ;
225- var allKnownModifications = GetDict ( localizeableModifications ) ;
226225 Dictionary < string , Modification > um = null ;
227- var proteinList = dbFilenameList . SelectMany ( b => ProteinDbLoader . LoadProteinDb ( b . FileName , true , allKnownModifications , b . IsContaminant , out um ) ) . ToList ( ) ;
228- AnalysisEngine analysisEngine ;
226+ var proteinList = dbFilenameList . SelectMany ( b => ProteinDbLoader . LoadProteinDb ( b . FileName , true , GetDict ( localizeableModifications ) , b . IsContaminant , out um ) ) . ToList ( ) ;
227+
229228 AnalysisResults analysisResults = null ;
230229 var numRawFiles = currentRawFileList . Count ;
231230 for ( int spectraFileIndex = 0 ; spectraFileIndex < numRawFiles ; spectraFileIndex ++ )
@@ -240,38 +239,30 @@ protected override MyResults RunSpecific()
240239 Status ( "Opening spectra file..." ) ;
241240 myMsDataFile . Open ( ) ;
242241
243- var listOfSortedms2Scans = GetMs2Scans ( myMsDataFile ) . OrderBy ( b => b . PrecursorMass ) . ToArray ( ) ;
244-
245- var searchEngine = new ClassicSearchEngine ( listOfSortedms2Scans , myMsDataFile . NumSpectra , variableModifications , fixedModifications , proteinList , ProductMassTolerance , Protease , searchModes , MaxMissedCleavages , MaxModificationIsoforms , myMsDataFile . Name , lp ) ;
246-
247- var searchResults = ( ClassicSearchResults ) searchEngine . Run ( ) ;
242+ var searchResults = ( ClassicSearchResults ) new ClassicSearchEngine ( GetMs2Scans ( myMsDataFile ) . OrderBy ( b => b . PrecursorMass ) . ToArray ( ) , myMsDataFile . NumSpectra , variableModifications , fixedModifications , proteinList , ProductMassTolerance , Protease , searchModes , MaxMissedCleavages , MaxModificationIsoforms , myMsDataFile . Name , lp ) . Run ( ) ;
243+ myGPTMDresults . AddResultText ( searchResults ) ;
248244
249245 allPsms [ 0 ] . AddRange ( searchResults . OuterPsms [ 0 ] ) ;
250246
251- analysisEngine = new AnalysisEngine ( searchResults . OuterPsms , compactPeptideToProteinPeptideMatching , proteinList , variableModifications , fixedModifications , localizeableModifications , Protease , searchModes , myMsDataFile , ProductMassTolerance , ( BinTreeStructure myTreeStructure , string s ) => WriteTree ( myTreeStructure , OutputFolder , Path . GetFileNameWithoutExtension ( origDataFile ) + s ) , ( List < NewPsmWithFdr > h , string s ) => WritePsmsToTsv ( h , OutputFolder , Path . GetFileNameWithoutExtension ( origDataFile ) + s ) , null , false , MaxMissedCleavages , MaxModificationIsoforms , true , lp , binTolInDaltons , initiatorMethionineBehavior ) ;
252- analysisResults = ( AnalysisResults ) analysisEngine . Run ( ) ;
253- //output(analysisResults.ToString());
247+ analysisResults = ( AnalysisResults ) new AnalysisEngine ( searchResults . OuterPsms , compactPeptideToProteinPeptideMatching , proteinList , variableModifications , fixedModifications , localizeableModifications , Protease , searchModes , myMsDataFile , ProductMassTolerance , ( BinTreeStructure myTreeStructure , string s ) => WriteTree ( myTreeStructure , OutputFolder , Path . GetFileNameWithoutExtension ( origDataFile ) + s ) , ( List < NewPsmWithFdr > h , string s ) => WritePsmsToTsv ( h , OutputFolder , Path . GetFileNameWithoutExtension ( origDataFile ) + s ) , null , false , MaxMissedCleavages , MaxModificationIsoforms , true , lp , binTolInDaltons , initiatorMethionineBehavior ) . Run ( ) ;
248+ myGPTMDresults . AddResultText ( analysisResults ) ;
254249 }
255250
256251 if ( numRawFiles > 1 )
257252 {
258- analysisEngine = new AnalysisEngine ( allPsms . Select ( b => b . ToArray ( ) ) . ToArray ( ) , compactPeptideToProteinPeptideMatching , proteinList , variableModifications , fixedModifications , localizeableModifications , Protease , searchModes , null , ProductMassTolerance , ( BinTreeStructure myTreeStructure , string s ) => WriteTree ( myTreeStructure , OutputFolder , "aggregate" + s ) , ( List < NewPsmWithFdr > h , string s ) => WritePsmsToTsv ( h , OutputFolder , "aggregate" + s ) , null , false , MaxMissedCleavages , MaxModificationIsoforms , true , lp , binTolInDaltons , initiatorMethionineBehavior ) ;
259- analysisResults = ( AnalysisResults ) analysisEngine . Run ( ) ;
260- //output(analysisResults.ToString());
253+ analysisResults = ( AnalysisResults ) new AnalysisEngine ( allPsms . Select ( b => b . ToArray ( ) ) . ToArray ( ) , compactPeptideToProteinPeptideMatching , proteinList , variableModifications , fixedModifications , localizeableModifications , Protease , searchModes , null , ProductMassTolerance , ( BinTreeStructure myTreeStructure , string s ) => WriteTree ( myTreeStructure , OutputFolder , "aggregate" + s ) , ( List < NewPsmWithFdr > h , string s ) => WritePsmsToTsv ( h , OutputFolder , "aggregate" + s ) , null , false , MaxMissedCleavages , MaxModificationIsoforms , true , lp , binTolInDaltons , initiatorMethionineBehavior ) . Run ( ) ;
254+ myGPTMDresults . AddResultText ( analysisResults ) ;
261255 }
262256
263- var gptmdEngine = new GptmdEngine ( analysisResults . AllResultingIdentifications [ 0 ] , IsotopeErrors , gptmdModifications , combos , PrecursorMassTolerance ) ;
264- var gptmdResults = ( GptmdResults ) gptmdEngine . Run ( ) ;
265-
266- //output(gptmdResults.ToString());
257+ var gptmdResults = ( GptmdResults ) new GptmdEngine ( analysisResults . AllResultingIdentifications [ 0 ] , IsotopeErrors , gptmdModifications , combos , PrecursorMassTolerance ) . Run ( ) ;
258+ myGPTMDresults . AddResultText ( gptmdResults ) ;
267259
268260 string outputXMLdbFullName = Path . Combine ( OutputFolder , string . Join ( "-" , dbFilenameList . Select ( b => Path . GetFileNameWithoutExtension ( b . FileName ) ) ) + "GPTMD.xml" ) ;
269261
270262 WriteXmlDatabase ( gptmdResults . Mods , proteinList . Where ( b => ! b . IsDecoy ) . ToList ( ) , outputXMLdbFullName ) ;
271263
272264 SucessfullyFinishedWritingFile ( outputXMLdbFullName ) ;
273265
274- // TODO: Fix so not always outputting a contaminant
275266 myGPTMDresults . newDatabases . Add ( new DbForTask ( outputXMLdbFullName , false ) ) ;
276267
277268 return myGPTMDresults ;
0 commit comments