public override IEnumerable <string> Process(string targetFilename)
        {
            CensusStringResult target = new CensusStringResult();

            CensusStringResultFormat crf = new CensusStringResultFormat();

            Progress.SetRange(1, sourceFilenames.Length + 1);
            for (int i = 0; i < sourceFilenames.Length; i++)
            {
                string f = sourceFilenames[i];

                Progress.SetMessage("Reading from " + f + "...");
                Progress.SetPosition(i + 1);

                CensusStringResult cr = crf.ReadFromFile(f);

                target.Proteins.AddRange(cr.Proteins);
            }

            target.Proteins.Sort((p1, p2) => p2.Peptides.Count - p1.Peptides.Count);
            target.Headers = CensusUtils.ReadHeaders(sourceFilenames[0]);

            Progress.SetMessage("Writing to " + targetFilename + "...");
            crf.WriteToFile(targetFilename, target);
            Progress.SetMessage("Write to " + targetFilename + " finished.");
            Progress.SetPosition(sourceFilenames.Length + 1);

            return(new[] { targetFilename });
        }
        public override IEnumerable <string> Process(string targetFilename)
        {
            Dictionary <string, CensusProteinItem> proteinMap = new Dictionary <string, CensusProteinItem>();

            CensusResultFormat crf = new CensusResultFormat(true, isLabelFree);

            Progress.SetRange(1, sourceFilenames.Length + 1);
            for (int i = 0; i < sourceFilenames.Length; i++)
            {
                string f = sourceFilenames[i];

                Progress.SetMessage("Reading from " + f + "...");
                Progress.SetPosition(i + 1);

                CensusResult cr = crf.ReadFromFile(f);
                foreach (CensusProteinItem cpi in cr.Proteins)
                {
                    if (!proteinMap.ContainsKey(cpi.Locus))
                    {
                        proteinMap[cpi.Locus] = cpi;
                    }
                    else
                    {
                        proteinMap[cpi.Locus].Peptides.AddRange(cpi.Peptides);
                    }
                }
            }

            List <CensusProteinItem> proteins = new List <CensusProteinItem>(proteinMap.Values);

            foreach (CensusProteinItem cpi in proteins)
            {
                cpi.Recalculate();
                cpi.Peptides.Sort(delegate(CensusPeptideItem a, CensusPeptideItem b)
                {
                    int result = a.Sequence.CompareTo(b.Sequence);

                    if (0 == result)
                    {
                        result = a.Filename.Charge.CompareTo(b.Filename.Charge);
                    }

                    if (0 == result)
                    {
                        result = a.Filename.LongFileName.CompareTo(b.Filename.LongFileName);
                    }

                    return(result);
                });
            }

            proteins.Sort(delegate(CensusProteinItem a, CensusProteinItem b)
            {
                int result = b.PeptideNumber - a.PeptideNumber;

                if (0 == result)
                {
                    result = b.SpectraCount - a.SpectraCount;
                }

                if (0 == result)
                {
                    result = a.Locus.CompareTo(b.Locus);
                }

                return(result);
            });

            CensusResult target = new CensusResult();

            target.Headers  = CensusUtils.ReadHeaders(sourceFilenames[0]);
            target.Proteins = proteins;

            Progress.SetMessage("Writing to " + targetFilename + "...");
            crf.WriteToFile(targetFilename, target);
            Progress.SetMessage("Write to " + targetFilename + " finished.");
            Progress.SetPosition(sourceFilenames.Length + 1);

            return(new[] { targetFilename });
        }