示例#1
0
        /// <summary>
        /// Configure and return the appropriate target filter
        /// </summary>
        /// <param name="tool"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static ITargetFilter Create(LcmsIdentificationTool tool, Options options)
        {
            ITargetFilter targetFilter = null;

            switch (tool)
            {
            case LcmsIdentificationTool.MsgfPlus:
                targetFilter = new MsgfPlusTargetFilter(options);
                break;

            case LcmsIdentificationTool.MZIdentML:
                targetFilter = new MsgfPlusTargetFilter(options);
                break;

            case LcmsIdentificationTool.Sequest:
                targetFilter = new SequestTargetFilter(options);
                break;

            case LcmsIdentificationTool.XTandem:
                targetFilter = new XTandemTargetFilter(options);
                break;

            case LcmsIdentificationTool.MSAlign:
                targetFilter = new MsAlignTargetFilter(options);
                break;
            }

            return(targetFilter);
        }
        public override LcmsDataSet Read(string path)
        {
            var results = new List <MsAlignResult>();
            var filter  = new MsAlignTargetFilter(ReaderOptions);

            // Get the Evidences using PHRPReader which looks at the path that was passed in to determine the data type
            int resultsProcessed = 0;
            var reader           = InitializeReader(path);

            while (reader.MoveNext())
            {
                resultsProcessed++;
                if (resultsProcessed % 500 == 0)
                {
                    UpdateProgress(reader.PercentComplete);
                }

                if (AbortRequested)
                {
                    break;
                }

                // Skip this PSM if it doesn't pass the import filters
                double eValue = reader.CurrentPSM.GetScoreDbl(clsPHRPParserMSAlign.DATA_COLUMN_EValue, 0);

                double specProb = 0;
                if (!string.IsNullOrEmpty(reader.CurrentPSM.MSGFSpecProb))
                {
                    specProb = Convert.ToDouble(reader.CurrentPSM.MSGFSpecProb);
                }

                if (filter.ShouldFilter(eValue, specProb))
                {
                    continue;
                }

                reader.FinalizeCurrentPSM();

                if (reader.CurrentPSM.ResultID == 0)
                {
                    continue;
                }

                var result = new MsAlignResult
                {
                    AnalysisId = reader.CurrentPSM.ResultID
                };

                StorePsmData(result, reader, specProb);

                StoreDatasetInfo(result, reader, path);
                result.DataSet.Tool = LcmsIdentificationTool.MSAlign;

                // Populate items specific to MSAlign
                result.EValue            = eValue;
                result.DiscriminantValue = eValue;

                results.Add(result);
            }

            ComputeNets(results);

            return(new LcmsDataSet(Path.GetFileNameWithoutExtension(path), LcmsIdentificationTool.MSAlign, results));
        }