private void InitLabelFormat(List <string> headers)
        {
            string sline = string.Empty;

            foreach (string header in headers)
            {
                if (header.StartsWith("H	PLINE"))
                {
                    this.proteinFormat = new LineFormat <CensusProteinItem>(CensusProteinItemPropertyConverterFactory.GetInstance(), header.Substring(2));
                }
                else if (header.StartsWith("H	SLINE"))
                {
                    sline = header.Substring(2).Trim();
                    this.peptideFormat = new LineFormat <CensusPeptideItem>(CensusPeptideItemPropertyConverterFactory.GetInstance(), sline);
                }
                else if (header.StartsWith("H	&SLINE"))
                {
                    string line = header.Substring(3).Trim();
                    if (line.Equals(sline))
                    {
                        continue;
                    }

                    if (line.Length > sline.Length)
                    {
                        this.peptideFormat = new LineFormat <CensusPeptideItem>(CensusPeptideItemPropertyConverterFactory.GetInstance(), line);
                    }
                }
            }
        }
        public static CensusPeptideItemPropertyConverterFactory GetInstance()
        {
            if (instance == null)
            {
                instance = new CensusPeptideItemPropertyConverterFactory();

                instance.RegisterConverter(new CensusPeptideItem_UNIQUE_Converter());
                instance.RegisterConverter(new CensusPeptideItem_SEQUENCE_Converter());

                IPropertyConverter <CensusPeptideItem> ratioConverter = new CensusPeptideItem_RATIO_Converter();
                instance.RegisterConverter(ratioConverter);

                instance.RegisterConverter(new CensusPeptideItem_REGRESSION_FACTOR_Converter());
                instance.RegisterConverter(new CensusPeptideItem_DETERMINANT_FACTOR_Converter());

                IPropertyConverter <CensusPeptideItem> samIntConverter = new CensusPeptideItem_SAM_INT_Converter();
                instance.RegisterConverter(samIntConverter);

                IPropertyConverter <CensusPeptideItem> refIntConverter = new CensusPeptideItem_REF_INT_Converter();
                instance.RegisterConverter(refIntConverter);

                instance.RegisterConverter(new CensusPeptideItem_AREA_RATIO_Converter());
                instance.RegisterConverter(new CensusPeptideItem_PROFILE_SCORE_Converter());
                instance.RegisterConverter(new CensusPeptideItem_FILE_NAME_Converter());
                instance.RegisterConverter(new CensusPeptideItem_SCAN_Converter());
            }

            return(instance);
        }
 private void InitDefaultFormat()
 {
     this.proteinFormat = new LineFormat <CensusProteinItem>(
         CensusProteinItemPropertyConverterFactory.GetInstance(),
         "PLINE	LOCUS	AVERAGE_RATIO	STANDARD_DEVIATION	WEIGHTED_AVERAGE	PEPTIDE_NUM	SPEC_COUNT	DESCRIPTION");
     this.peptideFormat = new LineFormat <CensusPeptideItem>(
         CensusPeptideItemPropertyConverterFactory.GetInstance(),
         "SLINE	UNIQUE	SEQUENCE	RATIO	REGRESSION_FACTOR	DETERMINANT_FACTOR	XCorr	deltaCN	SAM_INT	REF_INT	AREA_RATIO	SINGLETON_SCORE	FILE_NAME");
 }
        private void InitLabelFreeFormat(List <string> headers)
        {
            Regex  proteinReg    = new Regex(@"AVG\((\S+)_INT/(\S+)_INT\)");
            string sampleName    = "";
            string referenceName = "";

            foreach (string header in headers)
            {
                if (header.StartsWith("H	PLINE"))
                {
                    Match m = proteinReg.Match(header);
                    sampleName    = m.Groups[1].Value;
                    referenceName = m.Groups[2].Value;

                    CensusProteinItemPropertyConverterFactory factory = CensusProteinItemPropertyConverterFactory.GetInstance();

                    IPropertyConverter <CensusProteinItem> averageRatioConverter = new CensusProteinItem_AVERAGE_RATIO_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(averageRatioConverter, MyConvert.Format("AVG({0}_INT/{1}_INT)", sampleName, referenceName)));

                    IPropertyConverter <CensusProteinItem> sdConverter = new CensusProteinItem_STANDARD_DEVIATION_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(sdConverter, MyConvert.Format("STDEV({0}_INT/{1}_INT)", sampleName, referenceName)));

                    this.proteinFormat = new LineFormat <CensusProteinItem>(factory, header.Substring(2));
                }
                else if (header.StartsWith("H	SLINE"))
                {
                    string        peptideHeader = header.Substring(2);
                    List <string> parts         = new List <string>(peptideHeader.Split(new char[] { '\t' }));
                    parts.Remove(MyConvert.Format("SPEC_COUNT({0})", sampleName));
                    parts.Remove(MyConvert.Format("SPEC_COUNT({0})", referenceName));
                    peptideHeader = StringUtils.Merge(parts, "\t");

                    CensusPeptideItemPropertyConverterFactory factory = CensusPeptideItemPropertyConverterFactory.GetInstance();

                    IPropertyConverter <CensusPeptideItem> ratioConverter = new CensusPeptideItem_RATIO_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(ratioConverter, MyConvert.Format("{0}_INT/{1}_INT", sampleName, referenceName)));

                    IPropertyConverter <CensusPeptideItem> samIntConverter = new CensusPeptideItem_SAM_INT_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(samIntConverter, MyConvert.Format("INT({0})", sampleName)));

                    IPropertyConverter <CensusPeptideItem> refIntConverter = new CensusPeptideItem_REF_INT_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(refIntConverter, MyConvert.Format("INT({0})", referenceName)));

                    this.peptideFormat = new LineFormat <CensusPeptideItem>(factory, peptideHeader);
                }
            }
        }