private static void Add(ref List <DbParameter> list, object data, ParamListType ParamType) { Type objType = data.GetType(); List <PropertyInfo> propertyList = new List <PropertyInfo>(objType.GetProperties()); System.Attribute[] AttributeList = System.Attribute.GetCustomAttributes(objType); for (int i = 0; i < propertyList.Count; ++i) { var prop = propertyList.ToArray()[i]; DBKeyField keyAttr = (DBKeyField)AttributeList[i]; DBField attr = (DBField)AttributeList[i]; DbParameter param = new DbParameter(); object propValue = prop.GetValue(data, null); param.Name = prop.Name; param.Value = propValue; param.Direction = DbDirection.Input; param.SqlType = keyAttr == null ? attr.SqlDbType : keyAttr.SqlDbType; if (ParamType == ParamListType.Key) { if (keyAttr != null) { list.Add(param); } } else { list.Add(param); } } }
public static List <DbParameter> CreateParam(object objClass, ParamListType ParamType) { var list = new List <DbParameter>(); Add(ref list, objClass, ParamType); return(list); }
/// <summary> /// Creates a list of parametrs based off of the object class and it's values /// </summary> /// <param name="objClass">Class to be reflected into parameters</param> /// <param name="ListType">Value determines all columns, or just the key values should be parameterized</param> /// <returns></returns> public List <DbParameter> CreateParamList(object objClass, ParamListType ListType) { //Update to allow differeny ListTypes (Save = All columns, Get is Just PK) List <DbParameter> result = ClassToDbParameter.CreateParam(objClass, ListType); return(result); }
private void LoadSeqScores() { m_GreenTh = new double[4]; m_YellowTh = new double[4]; ParamListType ParamList = m_mzid.Data.AnalysisProtocolCollection.SpectrumIdentificationProtocol[0].AdditionalSearchParams; if( ParamList == null ) return; int ProteomeDiscovererSequestXcorr = 0; foreach( AbstractParamType param in ParamList.Items ) { if( !(param is CVParamType) ) continue; CVParamType cv = param as CVParamType; switch( cv.accession ) { case "MS:1001712": // ProteomeDiscoverer:SEQUEST:FT High Confidence XCorr Charge1 m_GreenTh[0] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001713": // ProteomeDiscoverer:SEQUEST:FT High Confidence XCorr Charge2 m_GreenTh[1] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001714": // ProteomeDiscoverer:SEQUEST:FT High Confidence XCorr Charge3 m_GreenTh[2] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001715": // ProteomeDiscoverer:SEQUEST:FT High Confidence XCorr Charge4 m_GreenTh[3] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001716": // ProteomeDiscoverer:SEQUEST:FT Medium Confidence XCorr Charge1 m_YellowTh[0] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001717": // ProteomeDiscoverer:SEQUEST:FT Medium Confidence XCorr Charge2 m_YellowTh[1] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001718": // ProteomeDiscoverer:SEQUEST:FT Medium Confidence XCorr Charge3 m_YellowTh[2] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; case "MS:1001719": // ProteomeDiscoverer:SEQUEST:FT Medium Confidence XCorr Charge4 m_YellowTh[3] = double.Parse(cv.value, m_Format); ProteomeDiscovererSequestXcorr++; break; } } if( ProteomeDiscovererSequestXcorr >= 8 ) { string yellow = "\t* Red-Yellow thresholds:"; string green = "\t* Yellow-Green thresholds:"; for( int i = 0; i < 4; i++ ) { green += " " + m_GreenTh[i] + "(" + (i+1) + ")"; yellow += " " + m_YellowTh[i] + "(" + (i+1) + ")"; } Notify( "Using ProteomeDiscoverer/SEQUEST XCorr values:"); Notify( yellow ); Notify( green ); SeqThreshold = Peptide.ConfidenceType.Yellow; } }
/// <summary> /// Create an object using the contents of the corresponding MzIdentML object /// </summary> /// <param name="pl"></param> /// <param name="idata"></param> public ParamListObj(ParamListType pl, IdentDataObj idata) : base(idata) { _items = null; if (pl != null && pl.Items.Count > 0) { Items = new IdentDataList <ParamBaseObj>(); foreach (var p in pl.Items) { if (p is CVParamType) { Items.Add(new CVParamObj(p as CVParamType, IdentData)); } else if (p is UserParamType) { Items.Add(new UserParamObj(p as UserParamType, IdentData)); } } } }
/// <summary> /// Create an object using the contents of the corresponding MzIdentML object /// </summary> /// <param name="pl"></param> /// <param name="idata"></param> public ParamListObj(ParamListType pl, IdentDataObj idata) : base(idata) { Items = new IdentDataList <ParamBaseObj>(1); if (pl?.Items.Count > 0) { Items.AddRange(pl.Items, p => { if (p is CVParamType cvp) { return(new CVParamObj(cvp, IdentData)); } if (p is UserParamType up) { return(new UserParamObj(up, IdentData)); } return(null); }); } }