private void CheckPlexType(IsobaricType plexType, string expectHeader, string expectValue) { var ann = new IdentifiedSpectrum(); var pqr = new IsobaricItem() { PlexType = plexType, Valid = true, ValidProbability = 0.0005 }; var refItems = plexType.GetDefinition().Items; foreach (var item in refItems) { pqr[item.Index] = item.Mass; } ann.SetIsobaricItem(pqr); //从实例构建converter var converter = new ITraqItemPlexConverter <IAnnotation>(); List <IPropertyConverter <IAnnotation> > converters = new List <IPropertyConverter <IAnnotation> >(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter <IAnnotation> finalConverter = new CompositePropertyConverter <IAnnotation>(converters, ','); if (exportToConsole) { Console.WriteLine(finalConverter.Name); } Assert.AreEqual(expectHeader, finalConverter.Name); var line1 = finalConverter.GetProperty(ann); if (exportToConsole) { Console.WriteLine(line1); } Assert.AreEqual(expectValue, line1); var protein2 = new IdentifiedSpectrum(); //从factory根据header构建converter var finalC = IdentifiedSpectrumPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }
public void TestReadWrite() { var ann = new IdentifiedProtein(); var pqr = new ProteinQuantificationResult(); pqr.Items["D1"] = new QuantificationItem() { Enabled = true, Ratio = 1.5, SampleIntensity = 150, ReferenceIntensity = 100, Correlation = 0.9, ScanCount = 55, Filename = "test1.silac" }; pqr.Items["D2"] = new QuantificationItem() { Enabled = false, Ratio = 3, SampleIntensity = 250, ReferenceIntensity = 200, Correlation = 0.8, ScanCount = 77, Filename = "test2.silac" }; ann.Annotations[SilacQuantificationConstants.SILAC_KEY] = pqr; var converter = new SilacProteinQuantificationResultConverter2 <IAnnotation>(); List <IPropertyConverter <IAnnotation> > converters = new List <IPropertyConverter <IAnnotation> >(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter <IAnnotation> finalConverter = new CompositePropertyConverter <IAnnotation>(converters, ','); Assert.AreEqual("S_COUNT,SE_D1,SR_D1,SRC_D1,SSI_D1,SRI_D1,SE_D2,SR_D2,SRC_D2,SSI_D2,SRI_D2", finalConverter.Name); var line1 = finalConverter.GetProperty(ann); Assert.AreEqual("2,True,1.5000,0.9000,150.0,100.0,False,3.0000,0.8000,250.0,200.0", line1); var protein2 = new IdentifiedProtein(); var finalC = IdentifiedProteinPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }
public void TestReadWrite() { var ann = new IdentifiedProtein(); var pqr = new ProteinQuantificationResult(); pqr.Items["D1"] = new QuantificationItem() { Enabled = true, Ratio = 1.5, SampleIntensity = 150, ReferenceIntensity = 100, Correlation = 0.9, ScanCount = 55, Filename = "test1.silac" }; pqr.Items["D2"] = new QuantificationItem() { Enabled = false, Ratio = 3, SampleIntensity = 250, ReferenceIntensity = 200, Correlation = 0.8, ScanCount = 77, Filename = "test2.silac" }; ann.Annotations[SilacQuantificationConstants.SILAC_KEY] = pqr; var converter = new SilacProteinQuantificationResultConverter2<IAnnotation>(); List<IPropertyConverter<IAnnotation>> converters = new List<IPropertyConverter<IAnnotation>>(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter<IAnnotation> finalConverter = new CompositePropertyConverter<IAnnotation>(converters, ','); Assert.AreEqual("S_COUNT,SE_D1,SR_D1,SRC_D1,SSI_D1,SRI_D1,SE_D2,SR_D2,SRC_D2,SSI_D2,SRI_D2", finalConverter.Name); var line1 = finalConverter.GetProperty(ann); Assert.AreEqual("2,True,1.5000,0.9000,150.0,100.0,False,3.0000,0.8000,250.0,200.0", line1); var protein2 = new IdentifiedProtein(); var finalC = IdentifiedProteinPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }
private void CheckPlexType(IsobaricType plexType, string expectHeader, string expectValue) { var ann = new IdentifiedSpectrum(); var pqr = new IsobaricItem() { PlexType = plexType, Valid = true, ValidProbability = 0.0005 }; var refItems = plexType.GetDefinition().Items; foreach (var item in refItems) { pqr[item.Index] = item.Mass; } ann.SetIsobaricItem(pqr); //从实例构建converter var converter = new ITraqItemPlexConverter<IAnnotation>(); List<IPropertyConverter<IAnnotation>> converters = new List<IPropertyConverter<IAnnotation>>(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter<IAnnotation> finalConverter = new CompositePropertyConverter<IAnnotation>(converters, ','); if (exportToConsole) { Console.WriteLine(finalConverter.Name); } Assert.AreEqual(expectHeader, finalConverter.Name); var line1 = finalConverter.GetProperty(ann); if (exportToConsole) { Console.WriteLine(line1); } Assert.AreEqual(expectValue, line1); var protein2 = new IdentifiedSpectrum(); //从factory根据header构建converter var finalC = IdentifiedSpectrumPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }
public void TestReadWrite() { var ann = new IdentifiedProtein(); var pqr = new ITraqQuantificationResult(); pqr.DatasetMap["D1"] = new ITraqQuantificationDatasetItem() { DatasetName = "D1" }; pqr.DatasetMap["D1"].RatioMap["R114/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R114/REF", Ratio = 1.5 }; pqr.DatasetMap["D1"].RatioMap["R115/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R115/REF", Ratio = 1.8 }; pqr.DatasetMap["D2"] = new ITraqQuantificationDatasetItem() { DatasetName = "D2" }; pqr.DatasetMap["D2"].RatioMap["R116/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R116/REF", Ratio = 2.5 }; pqr.DatasetMap["D2"].RatioMap["R117/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R117/REF", Ratio = 3.8 }; ann.Annotations[ITraqConsts.ITRAQ_KEY] = pqr; var converter = new ITraqQuantificationResultConverter <IAnnotation>(); List <IPropertyConverter <IAnnotation> > converters = new List <IPropertyConverter <IAnnotation> >(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter <IAnnotation> finalConverter = new CompositePropertyConverter <IAnnotation>(converters, ','); if (exportToConsole) { Console.WriteLine(finalConverter.Name); } Assert.AreEqual("ITRAQ_COUNT,IR_D1_R114/REF,IR_D1_R115/REF,IR_D2_R116/REF,IR_D2_R117/REF", finalConverter.Name); var line1 = finalConverter.GetProperty(ann); if (exportToConsole) { Console.WriteLine(line1); } Assert.AreEqual("2,1.5000,1.8000,2.5000,3.8000", line1); var protein2 = new IdentifiedProtein(); var finalC = IdentifiedProteinPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }
public void TestReadWrite() { var ann = new IdentifiedProtein(); var pqr = new ITraqQuantificationResult(); pqr.DatasetMap["D1"] = new ITraqQuantificationDatasetItem() { DatasetName = "D1" }; pqr.DatasetMap["D1"].RatioMap["R114/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R114/REF", Ratio = 1.5 }; pqr.DatasetMap["D1"].RatioMap["R115/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R115/REF", Ratio = 1.8 }; pqr.DatasetMap["D2"] = new ITraqQuantificationDatasetItem() { DatasetName = "D2" }; pqr.DatasetMap["D2"].RatioMap["R116/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R116/REF", Ratio = 2.5 }; pqr.DatasetMap["D2"].RatioMap["R117/REF"] = new ITraqQuantificationChannelItem() { ChannelName = "R117/REF", Ratio = 3.8 }; ann.Annotations[ITraqConsts.ITRAQ_KEY] = pqr; var converter = new ITraqQuantificationResultConverter<IAnnotation>(); List<IPropertyConverter<IAnnotation>> converters = new List<IPropertyConverter<IAnnotation>>(); converters.Add(converter); converters.AddRange(converter.GetRelativeConverter(new IAnnotation[] { ann }.ToList())); CompositePropertyConverter<IAnnotation> finalConverter = new CompositePropertyConverter<IAnnotation>(converters, ','); if (exportToConsole) { Console.WriteLine(finalConverter.Name); } Assert.AreEqual("ITRAQ_COUNT,IR_D1_R114/REF,IR_D1_R115/REF,IR_D2_R116/REF,IR_D2_R117/REF", finalConverter.Name); var line1 = finalConverter.GetProperty(ann); if (exportToConsole) { Console.WriteLine(line1); } Assert.AreEqual("2,1.5000,1.8000,2.5000,3.8000", line1); var protein2 = new IdentifiedProtein(); var finalC = IdentifiedProteinPropertyConverterFactory.GetInstance().GetConverters(finalConverter.Name, ','); finalC.SetProperty(protein2, line1); var line2 = finalConverter.GetProperty(protein2); Assert.AreEqual(line1, line2); }