Пример #1
0
        /// <summary>
        /// Writes the incremental results to a txt file and clears the RAM of existing results.
        /// </summary>
        /// <param name="outputFile"></param>
        internal void FlushResultsToSQTFile(string outputFile, RegexGeneration.RegexGenerationParams regexParams)
        {
            StreamWriter sw = new StreamWriter(outputFile);

            sw.WriteLine("#ScanNo\tDeltaCN\tScore\tName\tMeasuredMZ\tEstPrecursorZ\tSequence");
            sw.WriteLine("Database searched:" + fastaParser.DBName);
            string header = regexParams.PrintHeader();

            sw.WriteLine(header);

            foreach (SearchResult sr in mySearchResults)
            {
                sw.WriteLine("M\t" + sr.ScanNumber + "\t" + Math.Round(sr.DeltaCN, 3) + "\t" + sr.TheResults[0].Score + "\t" + sr.TheResults[0].Name + "\t" + sr.MeasuredPrecursorMZ + "\t" + sr.EstimatedPrecursorCharge + "\t" + sr.TheResults[0].Sequence);

                foreach (PatternTools.T_ReXS.RegexGenerationTools.SearchResult.RegexAndPath rp in sr.TheResults[0].RegexAndPaths)
                {
                    string path = "";
                    foreach (int i in rp.NodePath)
                    {
                        path += i + ":";
                    }
                    path.Remove(path.Length - 1, 1);


                    sw.WriteLine("R\t" + rp.TheRegex + "\t" + path);
                }
            }
            sw.Close();

            mySearchResults.Clear();
        }
Пример #2
0
        internal void IncrementalBatchSearch(MSParser.MSFull ms, List <PathCandidate> pathCandidates, RegexGeneration.RegexGenerationParams regexParams)
        {
            //Handle the precursor stuff
            double precursor       = -1;
            double precursorCharge = -1;

            double lowerSearchBound = -1;
            double upperSearchBound = -1;

            if (ms.ZLines.Count > 0 && regexParams.UsePrecursorInformation)
            {
                string[] zLine = tabSplitterRegex.Split(ms.ZLines[0]);
                precursorCharge = double.Parse(zLine[1]);

                precursor = PatternTools.pTools.DechargeMSPeakToPlus1(ms.ChargedPrecursor, precursorCharge);

                if (precursorCharge <= regexParams.MinTrustedCharge)
                {
                    lowerSearchBound = precursor - regexParams.PrecursorLowerBound;
                    upperSearchBound = precursor + regexParams.PrecursorUpperBound;
                }
                else
                {
                    lowerSearchBound = PatternTools.pTools.DechargeMSPeakToPlus1(ms.ChargedPrecursor, regexParams.MinTrustedCharge);
                    upperSearchBound = -1;
                }
            }
            else if (regexParams.UsePrecursorInformation && ms.ZLines.Count == 0)
            {
                lowerSearchBound = (regexParams.MinTrustedCharge * ms.ChargedPrecursor) - 500;
                upperSearchBound = -1;
            }
            else if (!regexParams.UsePrecursorInformation)
            {
                lowerSearchBound = ms.MSData[(int)(ms.MSData.Count * 0.8)].MZ;
                upperSearchBound = -1;
            }

            SearchResult sr = Search(lowerSearchBound, upperSearchBound, pathCandidates, regexParams.MaxRegexes, ms.ScanNumber, ms.ChargedPrecursor, precursorCharge);

            sr.TheResults.Sort((a, b) => b.Score.CompareTo(a.Score));
            if (sr.TheResults.Count > 0)
            {
                if (sr.DeltaCN > 0)
                {
                    mySearchResults.Add(sr);
                }
            }
        }