Exemple #1
0
        private void DoQuantify(string detailDir, List <IIdentifiedSpectrum> querys)
        {
            Dictionary <string, List <IIdentifiedSpectrum> > filePepMap = IdentifiedSpectrumUtils.GetRawPeptideMap(querys);

            int fileCount = 0;

            foreach (string experimental in filePepMap.Keys)
            {
                fileCount++;

                if (Progress.IsCancellationPending())
                {
                    throw new UserTerminatedException();
                }

                string rawFilename = option.RawFormat.GetRawFile(option.RawDir, experimental);

                Progress.SetMessage(MyConvert.Format("{0}/{1} : Processing {2} ...", fileCount, filePepMap.Keys.Count, rawFilename));

                SilacQuantificationFileBuilder builder = new SilacQuantificationFileBuilder(option);
                builder.Progress        = this.Progress;
                builder.SoftwareVersion = this.SoftwareVersion;
                builder.MinScanNumber   = this.MinScanNumber;

                List <IIdentifiedSpectrum> peps = filePepMap[experimental];
                peps.Sort((m1, m2) => m1.IsExtendedIdentification().CompareTo(m2.IsExtendedIdentification()));

                builder.Quantify(rawFilename, peps, detailDir);
            }
        }
        public override IEnumerable <string> Process(string peptidesFilename)
        {
            List <IIdentifiedSpectrum> peptides = new SequestPeptideTextFormat().ReadFromFile(peptidesFilename);

            Dictionary <string, List <IIdentifiedSpectrum> > rawPeptideMap = IdentifiedSpectrumUtils.GetRawPeptideMap(peptides);

            Progress.SetRange(1, 1, rawPeptideMap.Count);

            List <string> raws = new List <string>(rawPeptideMap.Keys);

            raws.Sort();

            int position  = 0;
            int totalRaws = rawPeptideMap.Count;

            foreach (string raw in raws)
            {
                if (Progress.IsCancellationPending())
                {
                    throw new UserTerminatedException();
                }

                Progress.SetPosition(1, position++);
                Progress.SetMessage(1, MyConvert.Format("{0}/{1}, Extracting {2} for {3} peptides ...", position, totalRaws, raw, rawPeptideMap[raw].Count));

                if (!filePathMap.ContainsKey(raw))
                {
                    throw new Exception("Cannot find raw dtas/outs file for " + raw);
                }

                if (filePathMap[raw].Count == 1)
                {
                    ExtractSingleRaw(raw, filePathMap[raw][0], rawPeptideMap[raw]);
                }
                else
                {
                    ExtractMultipleRaw(raw, filePathMap[raw], rawPeptideMap[raw]);
                }
            }

            Progress.SetPosition(1, position);

            return(new List <string>());
        }