Exemplo n.º 1
0
        public void ForJohnJacobs()
        {
            const string myfht = @"C:\DMS_WorkDir\Step_1_ASCORE\U54_HPp1_LoBMI_NS_11_5Sep08_Draco_08-07-15_xt.txt";
            const string mydta = @"C:\DMS_WorkDir\Step_1_ASCORE\dtas\U54_HPp1_LoBMI_NS_11_5Sep08_Draco_08-07-15_dta.txt";
            const string mypar = @"C:\DMS_WorkDir\Step_1_ASCORE\DynMWPYOx_EmH20_QmNH3_cid.xml";

            var peptideMassCalculator = GetDefaultPeptideMassCalculator();

            PsmResultsManager dataman = new XTandemFHT(myfht);
            //DtaManager dta = new DtaManager(mydta);
            var spectraCache = new SpectraManagerCache(peptideMassCalculator);

            spectraCache.OpenFile(mydta);
            var          par          = new ParameterFileManager(mypar);
            const string fileOutput   = @"C:\DMS_WorkDir\Step_1_ASCORE\U54_HPp1_LoBMI_NS_11_5Sep08_Draco_08-07-15_xt_ascore.txt";
            var          ascoreEngine = new AScore_DLL.AScoreProcessor();

            //ascoreEngine.AlgorithmRun(dta, dataman, par, fileOutput);
            ascoreEngine.RunAScoreOnSingleFile(spectraCache, dataman, par, fileOutput);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Configure and run the AScore algorithm
        /// </summary>
        /// <param name="ascoreOptions"></param>
        /// <returns></returns>
        public int RunAScore(AScoreOptions ascoreOptions)
        {
            var paramManager = new ParameterFileManager(ascoreOptions.AScoreParamFile);

            RegisterEvents(paramManager);

            Console.WriteLine();

            if (paramManager.DynamicMods.Count > 0 || paramManager.StaticMods.Count > 0)
            {
                OnStatusEvent("Loaded modifications from: " + ascoreOptions.AScoreParamFile);

                foreach (var mod in paramManager.StaticMods)
                {
                    OnStatusEvent(Utilities.GetModDescription("Static,   ", mod));
                }

                foreach (var mod in paramManager.DynamicMods)
                {
                    OnStatusEvent(Utilities.GetModDescription("Dynamic,  ", mod));
                }

                foreach (var mod in paramManager.TerminiMods)
                {
                    OnStatusEvent(Utilities.GetModDescription("Terminus, ", mod));
                }

                Console.WriteLine();
            }

            PsmResultsManager psmResultsManager;

            switch (ascoreOptions.SearchType)
            {
            case AScoreOptions.SearchMode.XTandem:
                OnStatusEvent("Caching data in " + PathUtils.CompactPathString(ascoreOptions.DbSearchResultsFile, 80));
                psmResultsManager = new XTandemFHT(ascoreOptions.DbSearchResultsFile);
                break;

            case AScoreOptions.SearchMode.Sequest:
                OnStatusEvent("Caching data in " + PathUtils.CompactPathString(ascoreOptions.DbSearchResultsFile, 80));
                psmResultsManager = new SequestFHT(ascoreOptions.DbSearchResultsFile);
                break;

            case AScoreOptions.SearchMode.Inspect:
                OnStatusEvent("Caching data in " + PathUtils.CompactPathString(ascoreOptions.DbSearchResultsFile, 80));
                psmResultsManager = new InspectFHT(ascoreOptions.DbSearchResultsFile);
                break;

            case AScoreOptions.SearchMode.Msgfdb:
            case AScoreOptions.SearchMode.Msgfplus:
                OnStatusEvent("Caching data in " + PathUtils.CompactPathString(ascoreOptions.DbSearchResultsFile, 80));
                if (ascoreOptions.SearchResultsType == AScoreOptions.DbSearchResultsType.Mzid)
                {
                    if (ascoreOptions.CreateUpdatedDbSearchResultsFile)
                    {
                        psmResultsManager = new MsgfMzidFull(ascoreOptions.DbSearchResultsFile);
                    }
                    else
                    {
                        psmResultsManager = new MsgfMzid(ascoreOptions.DbSearchResultsFile);
                    }
                }
                else
                {
                    psmResultsManager = new MsgfdbFHT(ascoreOptions.DbSearchResultsFile);
                }
                break;

            default:
                OnErrorEvent(string.Format(
                                 "Incorrect search type: {0} , supported values are {1}",
                                 ascoreOptions.SearchType,
                                 string.Join(", ", Enum.GetNames(typeof(AScoreOptions.SearchMode)))
                                 ));
                return(-13);
            }
            var peptideMassCalculator = new PeptideMassCalculator();

            var spectraManager = new SpectraManagerCache(peptideMassCalculator);

            RegisterEvents(spectraManager);

            OnStatusEvent("Output directory: " + ascoreOptions.OutputDirectoryInfo.FullName);

            var ascoreEngine = new AScoreAlgorithm();

            RegisterEvents(ascoreEngine);

            // Initialize the options
            FilterOnMSGFScore = ascoreOptions.FilterOnMSGFScore;

            // Run the algorithm
            if (ascoreOptions.MultiJobMode)
            {
                RunAScoreWithMappingFile(ascoreOptions, spectraManager, psmResultsManager, paramManager);
            }
            else
            {
                spectraManager.OpenFile(ascoreOptions.MassSpecFile, ascoreOptions.ModSummaryFile);

                RunAScoreOnSingleFile(ascoreOptions, spectraManager, psmResultsManager, paramManager);
            }

            OnStatusEvent("AScore Complete");

            if (ascoreOptions.CreateUpdatedDbSearchResultsFile)
            {
                if (ascoreOptions.SearchResultsType == AScoreOptions.DbSearchResultsType.Fht)
                {
                    CreateUpdatedFirstHitsFile(ascoreOptions);
                }
                else if (psmResultsManager is MsgfMzidFull mzidFull)
                {
                    mzidFull.WriteToMzidFile(ascoreOptions.UpdatedDbSearchResultsFileName);
                    OnStatusEvent("Results merged; new file: " + PathUtils.CompactPathString(ascoreOptions.UpdatedDbSearchResultsFileName, 80));
                }
            }

            return(0);
        }