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 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); } } }