Beispiel #1
0
        /// <summary>
        /// Determines if the target should be filtered or not.
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool ShouldFilter(Target t)
        {
            // This is a bad way to do this...but
            // I don't want to put the immediate effort into redesigning this...more work
            // is needed to segment out the options class out of a general options class and into
            // a concrete class or classes
            SequestResult sequest = t as SequestResult;

            if (sequest != null)
            {
                // If it is to be exported, then we should not filter it
                return(!IsToBeExported(sequest));
            }
            XTandemResult xtandem = t as XTandemResult;

            if (xtandem != null)
            {
                return(!IsToBeExported(xtandem));
            }

            MsgfPlusResult msgfResult = t as MsgfPlusResult;

            if (msgfResult != null)
            {
                return(!IsToBeExported(msgfResult));
            }

            return(true);
        }
        /// <summary>
        /// Determines if a feature should be filtered or not.
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public bool ShouldFilter(Target target)
        {
            Sequence sequence = target.SequenceData;

            if (sequence == null)
            {
                return(true);
            }

            // in the alignment we will only use the unmodified peptides
            if (sequence.ModificationCount > Options.MaxModificationsForAlignment)
            {
                return(true);
            }

            XTandemResult result = target as XTandemResult;

            if (result == null)
            {
                return(true);
            }

            if (result.LogPeptideEValue > Options.MaxLogEValForXTandemAlignment)
            {
                return(true);
            }

            return(false);
        }
Beispiel #3
0
 public bool IsToBeExported(XTandemResult xtResult)
 {
     if (xtResult.LogPeptideEValue > MaxLogEValForXTandemExport)
     {
         return(false);
     }
     if (xtResult.TrypticState == 2)
     {
         if (!ExportTryptic)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     if (xtResult.TrypticState == 1)
     {
         if (!ExportPartiallyTryptic)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     if (xtResult.TrypticState == 0)
     {
         if (!ExportNonTryptic)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #4
0
        /// <summary>
        /// Read and process a XTandem PHRP file
        /// </summary>
        /// <param name="path">XTandem file to read</param>
        /// <returns></returns>
        public override LcmsDataSet Read(string path)
        {
            var results = new List <XTandemResult>();
            var filter  = new XTandemTargetFilter(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, "Reading peptides");
                }

                if (AbortRequested)
                {
                    break;
                }

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

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

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

                reader.FinalizeCurrentPSM();

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

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

                StorePsmData(result, reader, specProb);

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

                // Populate items specific to X!Tandem
                result.NumTrypticEnds = reader.CurrentPSM.NumTrypticTerminii;

                result.BScore            = reader.CurrentPSM.GetScoreDbl(clsPHRPParserXTandem.DATA_COLUMN_b_score, 0);
                result.DeltaCn2          = reader.CurrentPSM.GetScoreDbl(clsPHRPParserXTandem.DATA_COLUMN_DeltaCn2, 0);
                result.LogIntensity      = reader.CurrentPSM.GetScoreDbl(clsPHRPParserXTandem.DATA_COLUMN_Peptide_Intensity_LogI, 0);
                result.LogPeptideEValue  = logPepEValue;
                result.DiscriminantValue = logPepEValue;
                result.NumberBIons       = (short)reader.CurrentPSM.GetScoreInt(clsPHRPParserXTandem.DATA_COLUMN_b_ions);
                result.NumberYIons       = (short)reader.CurrentPSM.GetScoreInt(clsPHRPParserXTandem.DATA_COLUMN_y_ions);
                result.PeptideHyperscore = reader.CurrentPSM.GetScoreDbl(clsPHRPParserXTandem.DATA_COLUMN_Peptide_Hyperscore, 0);
                result.YScore            = reader.CurrentPSM.GetScoreDbl(clsPHRPParserXTandem.DATA_COLUMN_y_score, 0);

                results.Add(result);
            }

            ComputeNets(results);

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