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); } } }
public static CensusProteinItemPropertyConverterFactory GetInstance() { if (null == instance) { instance = new CensusProteinItemPropertyConverterFactory(); instance.RegisterConverter(new CensusProteinItem_LOCUS_Converter()); IPropertyConverter <CensusProteinItem> averageRatioConverter = new CensusProteinItem_WEIGHTED_AVERAGE_RATIO_Converter(); instance.RegisterConverter(averageRatioConverter); instance.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(averageRatioConverter, "AVG(A_INT/B_INT)")); IPropertyConverter <CensusProteinItem> sdConverter = new CensusProteinItem_STANDARD_DEVIATION_Converter(); instance.RegisterConverter(sdConverter); instance.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(sdConverter, "STDEV(A_INT/B_INT)")); instance.RegisterConverter(new CensusProteinItem_PEPTIDE_NUM_Converter()); instance.RegisterConverter(new CensusProteinItem_SPEC_COUNT_Converter()); instance.RegisterConverter(new CensusProteinItem_DESCRIPTION_Converter()); } return(instance); }