Exemplo n.º 1
0
        private IIdentifiedProteinGroup ReadNextProteinGroup(StreamReader filein,
                                                             Dictionary <string, IIdentifiedSpectrum> peptideMap,
                                                             ref string lastLine)
        {
            while (!IsProteinLine(lastLine) && (lastLine = filein.ReadLine()) != null)
            {
            }

            if (lastLine == null)
            {
                return(null);
            }

            IIdentifiedProteinGroup result = new IdentifiedProteinGroup();

            while (IsProteinLine(lastLine))
            {
                IIdentifiedProtein protein = new IdentifiedProtein();
                this.proteinConverter.SetProperty(protein, lastLine);
                result.Add(protein);

                lastLine = filein.ReadLine();
            }

            var peptides = new List <IIdentifiedSpectrum>();

            while (!IsProteinLine(lastLine))
            {
                IIdentifiedSpectrum mphit = new IdentifiedSpectrum();
                this.peptideConverter.SetProperty(mphit, lastLine);
                string id = mphit.Query.FileScan.LongFileName + "-" + mphit.Rank;
                if (!peptideMap.ContainsKey(id))
                {
                    peptideMap[id] = mphit;
                }
                else
                {
                    mphit = peptideMap[id];
                }

                peptides.Add(mphit);

                lastLine = filein.ReadLine();

                if (lastLine == null || lastLine.Trim().Length == 0)
                {
                    break;
                }
            }

            peptides.Sort();
            result.AddIdentifiedSpectra(peptides);

            return(result);
        }